Dan Stutzman

How to install Drupal on Ubuntu 10.04

Published 2011-03-02

Debian packages make installing software pretty easy, but you still have to know which packages to install, and there is still some configuration to do relating to users and permissions.  I've modified the instructions from another blog post so that you can install Drupal, starting from a vanilla Ubuntu 10.04 VM:

  • First fix an apt-get warning message:
    • sudo apt-get update
    • sudo apt-get install debian-archive-keyring
    • sudo apt-get update
  • Install the Debian packages:
    • sudo apt-get install apache2 php5 libapache2-mod-php5 mysql-server php5-mysql php5-gd
    • (type in the desired mysql root password when prompted)
    • sudo /etc/init.d/apache2 restart
  • Create a mysql database and user for Drupal:
    • mysql -uroot -p
    • (enter your mysql password)
    • create database drupal;
    • grant all on drupal.* to drupaluser@'%' identified by 'drupalpassword';
    • exit
  • Extract the Drupal package to /var/www/drupal
    • Download drupal-7.0.tar.gz from drupal.org
    • cd /var/www
    • sudo mv /home/user/Downloads/drupal-6.20.tar.gz .
    • sudo tar xvzf drupal-7.0.tar.gz
    • sudo mv drupal-7.0 drupal
  • Setup permissions so drupal can install:
    • sudo cp drupal/sites/default/default.settings.php drupal/sites/default/settings.php
    • sudo mkdir drupal/sites/default/files
    • sudo vi fix_permissions.sh
    • #!/bin/bash
                mkdir -p drupal/sites/defaults/files
                chown -R user:www-data drupal
                find drupal -type d -exec chmod u=rwx,g=rx,o= {} \;
                find drupal -type f -exec chmod u=rw,g=r,o= {} \;
                find drupal -type d -name files -exec chmod ug=rwx,o= '{}' \;
    • sudo chmod +x fix_permissions.sh
    • sudo ./fix_permissions.sh
    • sudo chmod u=rw,g=rw drupal/sites/default/settings.php
  • Install Drupal by browsing¬†http://localhost/drupal
    • Save and Continue (Standard)
    • Save and Continue (English)
    • Database settings:
      • Database name: drupal
      • Username: drupaluser
      • Password: drupalpassword
      • Save and Continue
    • Last screen:
      • Fill in email address
      • Username: drupaladmin
      • Password: drupalpassword
      • Confirm password: drupalpassword
      • Fill in default country
      • Fill in default time zone
      • Save and Continue
    • Click Visit your new site link
  • Clean up:
    • sudo rm drupal-7.0.tar.gz
    • sudo ./fix_permissions.sh