Work is based on:

  • http://drupal.org/project/drubuntu
  • http://www.drupalcoder.com/story/650-preparing-ubuntu-server-for-hosting-drupal-sites

    Package Installs

    Install Sun Java Runtime environment
    cscf-adm@drupal$
    cscf-adm@drupal$ sudo add-apt-repository “deb http://archive.canonical.com/ lucid partner”
    cscf-adm@drupal$
    cscf-adm@drupal$ sudo apt-get update
    cscf-adm@drupal$ sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
    cscf-adm@drupal$ java -version
    java version "1.6.0_20"
    Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
    Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)
    cscf-adm@drupal$

    I've read a suggestion that the ubuntu-restricted-extras package
    cscf-adm@drupal$ sudo aptitude install ubuntu-restricted-extras

    Install the "essentials" metapackage and curl
    cscf-adm@drupal$
    cscf-adm@drupal$ sudo aptitude install build-essential
    cscf-adm@drupal$ sudo aptitude install curl
    cscf-adm@drupal$

    Most of this was done as part of the original install however
    Apache
    cscf-adm@drupal$ sudo apt-get install apache2 apache2-threaded-dev
    PHP5
    cscf-adm@drupal$ sudo apt-get install php5 php5-dev php-pear php5-gd
    MySQL
    cscf-adm@drupal$ sudo apt-get install mysql-server phpmyadmin
    Postfix (email)
    cscf-adm@drupal$ sudo apt-get install postfix
    cscf-adm@drupal$

    Tuning

    To enable clean urls in Drupal, we need to enable mod_rewrite.
    cscf-adm@drupal$ sudo a2enmod rewrite
    Let's also disable 2 Apache modules we won't use.
    cscf-adm@drupal$ sudo a2dismod cgi
    cscf-adm@drupal$ sudo a2dismod autoindex
    Increase some rather restrictive limits.
    PHP memory limit.
    cscf-adm@drupal$ sudo sed -i 's/memory_limit = .*/memory_limit = 256/' /etc/php5/apache2/php.ini
    Upload sizes
    cscf-adm@drupal$ sudo sed -i 's/upload_max_filesize = .*/upload_max_filesize = 128M/' /etc/php5/apache2/php.ini
    Post sizes
    cscf-adm@drupal$ sudo sed -i 's/post_max_size = .*/post_max_size = 128M/' /etc/php5/apache2/php.ini
    cscf-adm@drupal$
    Have Drupal's FileField and Upload module show an upload progress bar.
    cscf-adm@drupal$ sudo pecl install uploadprogress
    cscf-adm@drupal$ sudo sed -i '/; extension_dir directive above/ a\ extension=uploadprogress.so' /etc/php5/apache2/php.ini
    Remove Apache's server signature you see under each page generated by Apache (like the directory pages, 404's, ...).
    cscf-adm@drupal$ sudo sed -i 's/ServerSignature On/ServerSignature Off/' /etc/apache2/apache2.conf
    Allow Apache to use Drupals .htaccess file.
    cscf-adm@drupal$ sudo sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/sites-available/default

    Tricks

    Enable APC's opcode caching, at this time must use apc-beta see http://pecl.php.net/bugs/bug.php?id=16078. and http://constantshift.com/installing-apc-for-php-5-3/.
    cscf-adm@drupal$ sudo pecl install apc-beta
    cscf-adm@drupal$ to accept default no answer
    cscf-adm@drupal$ to accept default no answer
    cscf-adm@drupal$ sudo sed -i '/; default extension directory./ a\ \n extension=apc.so \n apc.enabled=1 \n apc.shm_size=30 \n' /etc/php5/apache2/php.ini
    Enable mod_deflate and mod_expires.
      mod_deflate will zip your CSS files etc. and save you some bandwith.
      mod_expires will make the caching on static files work.
    cscf-adm@drupal$ sudo a2enmod deflate
    cscf-adm@drupal$ sudo a2enmod expires
    Configure mod_deflate to compress javascript and css files.
    Drupal does not do this out of the box.
    cscf-adm@drupal$ sudo sed -i 's/DEFLATE text\/html text\/plain text\/xml/DEFLATE text\/html text\/plain text\/xml text\/css text\/javascript application\/x-javascript/' /etc/apache2/mods-available/deflate.conf
    Enabling query caching in MySQL.
    sudo sed -i '/query_cache_limit.*/ a\query_cache_type\t= 1' /etc/mysql/my.cnf

    Restart It

    apache2 is not part of new startup setup.
    sudo /etc/init.d/apache2 force-reload
    mysql is part of new startup setup.
    force-reload mysql