Skip to content

install on Ubuntu Lucid Lynx (10.04) (mostly complete, needs testing)

hanleybrand edited this page Nov 23, 2012 · 2 revisions

Introduction

Is there a need for an introduction? Probably.

This guide is based on building a development or testing environment for MDID3 on a virtual machine (e.g Virtual Box, VMware, etc.) and should not be used as a guide to set up a production server as several steps are specifically great ideas for goofing around locally but bad ideas for hosting a server. Ok, good. That's out of the way, let's have fun!

PS: You may find Useful Ubuntu Utterances & the Using mdid3 ubinstall scripts pages useful or interesting.

Build the Foundation

  1. Setup a virtual machine, and install Ubuntu 10.0.4, choosing LAMP configuration during the install.

    • Specify 64-bit / Ubuntu 64-bit to skip vmware's "easy install"
    • You will eventually want to be able to network from your host machine to the vm, so setting up Bridged networking is preferable
    • If you are on a mac or otherwise prefer using a shell on your host machine, you may find it easier to also include "OpenSSH server" as an install option, so you can ssh to the vm
    • Create an admin account (this document uses mdid3admin as the user name)
  2. Install Git (non-optional)

    sudo apt-get install git-core
    
  3. Create MDID utility account (this allows mdid3 to run programs on it's own behalf)

    sudo adduser mdid
    
  4. Add your admin account (not the mdid utility account) to the staff group

    sudo nano /etc/group
    

    Find the following line and append your username (not mdid)

    staff:x:50:
    

    it will look like this when you've done it

    staff:x:50:mdid3admin:
    

    (ctrl-x will exit, prompting you to "save modified buffer" (i.e. the file you have open) - type "y" and the return/enter key to save before exiting )

  5. Log out of the command line and log back in


    apt-get & easy-install Dependencies

  6. First, make sure your installation is up to date

    sudo apt-get -y upgrade && install
    
  7. Install additional Ubuntu software needed to run mdid (aka dependencies) with apt-get

    sudo apt-get install openjdk-6-jre-headless python-setuptools libjpeg62-dev /
    unixodbc unixodbc-dev freetds-dev tdsodbc python-dev libmysqlclient16-dev /
    python-ldap python-memcache memcached libapache2-mod-wsgi g++ mysql-server
    
  8. Install python packages with easy-install

    sudo easy_install pyodbc mysql-python pil python-dateutil flickrapi werkzeug reportlab
    
  9. Create the directory where MDID3 will be installed

    sudo mkdir /var/local/mdid
    sudo chown mdid /var/local/mdid
    sudo chmod 775 /var/local/mdid
    
  10. Git MDID3!

    cd /var/local/mdid  git init   
    git remote add rooibos git://github.com/cit-jmu/rooibos.git   
    git fetch rooibos   
    git merge rooibos/master
    sudo chown -R mdid:staff /var/local/mdid/*
    
  11. This step may not be necessary

    sudo chown -R mdid:staff /var/local/mdid/*
    

    Setup the database

  12. nano mdid.sql

    and type this text in

    CREATE DATABASE rooibos CHARACTER SET utf8;
     GRANT ALL PRIVILEGES ON rooibos.* TO rooibos@localhost
       IDENTIFIED BY 'rooibos';
     UPDATE mysql.user SET Select_priv='Y',Insert_priv='Y',
       Update_priv='Y',Delete_priv='Y',Create_priv='Y',
       Drop_priv='Y',Index_priv='Y',Alter_priv='Y'
       WHERE Host='localhost' AND User='rooibos';
     FLUSH PRIVILEGES;
     \q
    
  13. and then run the script with mysql

    mysql -u 'root' -p < mdid.sql
    
  14. type the following two commands at /var/local/mdid/rooibos :

    python manage.py syncdb --noinput
    python manage.py createcachetable cache
    
    Configure Apache & mod_wsgi 
    The developers of django recommend using a seperate webserver for static files on a production system
    See How to use Django with Apache and mod_wsgi for more information
    Edit /etc/apache2/httpd.conf:
    sudo cp /var/local/mdid/dist/linux/httpd.conf /etc/apache2/httpd.conf
    
  15. and add this line

    WSGIScriptAlias / /var/local/mdid/rooibos/dist/linux/django.wsgi
    

    note: the lone forward slash is not a typo - the first "/" indicates that mdid will be the root of your webserver, the second path points to the wsgi file that inks mdid3 & the apache webserver also I had to fiddle with my config file to get it to work, I'll add it to the repo so others can examine it

    This is an example if an http.conf that should work:

        alias /static/admin/ /var/local/mdid/django/contrib/admin/media/
        alias /static/ /var/local/mdid/rooibos/static/
    
        <Directory /var/local/mdid/rooibos/static>        
            Order deny,allow        
            Allow from all
        </Directory>
    
        <Directory /var/local/mdid/django/contrib/admin/media> 
            Order deny,allow
            Allow from all    
        </Directory>
        WSGIDaemonProcess mdid user=mdid group=staff threads=25
        WSGIProcessGRoup mdid
        WSGIScriptAlias / /var/local/mdid/dist/linux/django.wsgi
    
        <Directory "/var/local/mdid/dist/linux">
            Order allow,deny
            Allow from all
        </Directory>
    
  16. Refresh the apache server (this will apply changes to server config files)

    sudo /etc/init.d/apache2 reload
    

Setup solr to run on startup

> NOTE: It has been reported on the list that this section may not be correct > but it may have been fixed - thanks suhackett!

  1. Type in the following command in TERMINAL to add a startup script.

    sudo nano /etc/init.d/solr
    
  2. try this script as a starting point (work in progress)

    #!/bin/sh -e 
    
    # Starts, stops, and restarts solr 
    
    SOLR_DIR="/var/local/mdid/solr" 
    JAVA_OPTIONS="-jar start.jar" 
    LOG_FILE="/var/local/mdid/solr/logs/startup.log" 
    JAVA="/usr/bin/java" 
    
    case $1 in 
        start) 
            echo "Starting Solr" 
            cd $SOLR_DIR 
            $JAVA $JAVA_OPTIONS 2> $LOG_FILE & 
            ;; 
        stop) 
            echo "Stopping Solr" 
            cd $SOLR_DIR 
            $JAVA $JAVA_OPTIONS --stop 
            ;; 
        restart) 
            $0 stop 
            sleep 1 
            $0 start 
            ;; 
        *) 
            echo "Usage: $0 {start|stop|restart}" >&2 
            exit 1 
            ;; 
    esac
    
  3. Create all the links to the script.

    sudo update-rc.d solr defaults
    
  4. Make the startup script executable.

    sudo chmod a+rx /etc/init.d/solr
    
  5. restart ubuntu

    sudo reboot
    

source: http://drupal.org/node/507292

Add mime type for Desktop Media Viewer installer

Add this line to the Apache config file that you edited above (/etc/apache2/httpd.conf) AddType application/vnd.adobe.air-application-installer-package+zip .air

TO DO

  1. Test Relentlessly

Optional Installs

  1. Install ubuntu desktop (optional, provides a GUI you can use instead of pure command line) - note, this command will not start the desktop automatically when complete, but the GUI will thereafter launch by default on restart/booting after the vm is shutdown - explaining how to change that behavior is beyond the scope of this document.

    sudo apt-get install ubuntu-desktop
    
  2. This will take a while, even on a fast network connection - it's a good thing to do before taking a break. * When installation completes, ubuntu-desktop can be launched by typing

    startx
    

    References

    Apache / WSGI articles

    Installing Django on an Ubuntu Linux Server

Build Websites with Django, Apache and mod_wsgi on Ubuntu 10.04

solr

Solr with Jetty