Saturday, August 8, 2009

Ubuntu server

Setting up the server


  1. install ubuntu 5.04 server
  2. edit /etc/network/interfaces for static ip address by changing the primary interface to:
    •     # The primary network interface
         iface eth0 inet static
             address 158.59.195.113
             netmask 255.255.252.0
             gateway 158.59.192.1
  3. edit /etc/apt/sources.list removing cdrom source at top and uncommenting universe sources
  4. do the apt-get dance (apt-get update and apt-get upgrade)
  5. install the following using apt-get:
    • ssh
    • zip and unzip
    • apache2
    • mysql-server
    • phpmyadmin

Configuring mysql


  1. Point a web brower at http://158.59.195.113/phpmyadmin/
  2. By default, username root with no password is enabled
  3. Login, click on "Change password", and change the password
  4. Click "Databases", fill-in "Create new database" with moodle and click "Create"
  5. Click "Privileges" then "Add a new User"
  6. Add user moodle with all "Data" and "Structure" privileges checked

Configuring Apache Modules


  • As root, run the following:
    • ln -s /etc/apache2/mods-available/proxy.conf /etc/apache2/mods-enabled/proxy.conf
  • Repeat with proxy_connect.load and proxy.load

Configuring virtual hosts


  1. Edit /etc/apache2/apache2.conf, adding a NameVirtualHost line, so that the last three lines of the file look like this:
        # Include the virtual host configurations
       NameVirtualHost 158.59.195.113:80
       Include /etc/apache2/sites-enabled/[^.#]* 
  2. Create a file named azi.conf in /etc/apache2/sites-available with the following:
        
       ServerName linus.yhspatriot.net
       ServerAdmin jeff@elkner.net
       ProxyRequests off
       
       Order deny,allow
       Allow from all
       
       ProxyPass / http://158.59.195.113:8080/
       ProxyPassReverse / http://158.59.195.113:8080/
       ProxyPass /misc_ http://158.59.195.113:8080/misc_
       ProxyPassReverse /misc_ http://158.59.195.113:8080/misc_
       ProxyPass /p_ http://158.59.195.113:8080/p_
       ProxyPassReverse /p_ http://158.59.195.113:8080/p_
       
    
    
       
       ServerName mysql.yhspatriot.net
       ServerAdmin jeff@elkner.net
       ProxyRequests off
       
       Order deny,allow
       Allow from all
       
    
       DocumentRoot /var/www/phpmyadmin/
    
       Options +FollowSymLinks
    
       
               php_flag magic_quotes_gpc On
               php_flag magic_quotes_runtime Off
               php_flag file_uploads On
               php_flag short_open_tag On
               php_flag session.auto_start Off
               php_flag session.bug_compat_warn Off
    
               php_value upload_max_filesize 2M
               php_value post_max_size 2M
       
    
       
               DirectoryIndex index.php
       
       
    
    
       
       ServerName moodle.yhspatriot.net
       ServerAdmin jeff@elkner.net
       ProxyRequests off
       
       Order deny,allow
       Allow from all
       
    
       DocumentRoot /var/www/moodle/
    
       Options +FollowSymLinks
    
       
               php_flag magic_quotes_gpc On
               php_flag magic_quotes_runtime Off
               php_flag file_uploads On
               php_flag short_open_tag On
               php_flag session.auto_start Off
               php_flag session.bug_compat_warn Off
    
               php_value upload_max_filesize 2M
               php_value post_max_size 2M
       
    
       
               DirectoryIndex index.php
       
       
  3. create a sym-link in sites-enabled:
    ln -s /etc/apache2/sites-available/azi.conf /etc/apache2/sites-enabled/azi.conf