Note: The two methods listed below are not compatible. The Ubuntu package (from the repositories) installs Drupal6 in different directories from the manual method. Choose one method or the other, but do not attempt to use both. You cannot switch back and forth between the two methods.
Install Drupal package from the Ubuntu repositories
You can choose whether to install Drupal5 or Drupal6 from the repositories. As always, repository version are not the most current versions, but they can be updated easily.
sudo apt-get install drupal6
or
sudo apt-get install drupal5
Manual installation of Drupal
The following instructions are for version 6.15 of the Drupal6 branch, which was the most current version at the time of writing. (A similar method can be used for the most current version of Drupal5). This installation does not install Drupal in directories that are compatible with the respository packages.
wget http://ftp.drupal.org/files/projects/drupal-6.15.tar.gz
tar xvzf drupal-6.15.tar.gz sudo mkdir /var/www/drupal sudo mv drupal-6.15/*
drupal-6.15/.htaccess /var/www/drupal
It is required to create a files subdirectory in your drupal default site installation directory. It will be used for files such as custom logos, user avatars, and other media associated with your new site.
sudo mkdir /var/www/drupal/sites/default/files
sudo chown www-data:www-data /var/www/drupal/sites/default/files
It is also required to create the initial configuration file for the default site.
sudo cp /var/www/drupal/sites/default/default.settings.php /var/www/drupal/sites/default/settings.php
sudo chown www-data:www-data /var/www/drupal/sites/default/settings.php
You need to create a MySQL drupal database and then load the database schema into it. You can do this with PhpMyAdmin or via the command line:
mysqladmin -u root -p create drupal
Where drupal is the name you picked for the mysql database that Drupal will use. You can call it anything you want.
mysql -u root -p mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX,
ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON drupal.* TO 'drupaluser'@'localhost'
IDENTIFIED BY 'drupalpass';
You do not want to have Drupal use the mysql root user to access the database. The above command creates a mysql user (other than the mysql root user) with some priviledges to use the drupal database. You should pick something different than drupaluser and drupalpass. If the command was successful, activate the new permissions:
Quit the mysql prompt:
Miscellaneous adjustments for manual installation
(Mike_B_sixosix 02.05.09) Comment: When I used the manual installation method I had to go back and edit the settings.php page with the drupal db username, password, and db name in order for the database portion of the install.php page to recognize that I had made the changes. After manually updating the file and saving, I refreshed the page and it automatically recognized the changes and moved to the next step.
(Mike_B_sixosix 02.05.09) Comment: I also had to
sudo chown www-data:www-data /var/www/drupal/sites/default/files
directory in order for the install.php page to make file changes.
Manually configure postgreSQL for Drupal
Edit the settings.php file so that drupal can know what user, password and database to use.
$ sudo nano /var/www/drupal/sites/default/settings.php
* Database URL format:
$db_url = 'pgsql://username:password@localhost/databasename';
where username = drupaluser password = drupaluserpass databasename = drupaldb
Save the file (Ctrl + x, y)
Adjust PHP memory limit
You should increase the default PHP memory limit value (the amount of memory dedicated to running scripts), since the default 8 Mb is not sufficient. Use 96 Mb (or even 160M) if you intend to use graphics (although for simple uses 32 Mb may be sufficient).
In newer versions of Drupal6, you can simply edit the settings.php file and add the line:
ini_set('memory_limit', '96M');
In older versions of Drupal5, or if using PHP for many different uses, it is best to increase the amount of PHP memory using this method:
Edit the /etc/php5/apache2/php.ini file and increase the memory_limit value to 96M (or another value of your choice).
If using PostgreSQL, you can also edit the /etc/php5/apache2/php.ini file to accommodate PostgreSQL options by adding the line:
Adjust PHP Error Reporting
An adjustment to the error reporting is required for the install.php page to come up properly. Edit your settings.php file (e.g., /etc/drupal/6/sites/default/settings.php) and add the following ini_set line after the existing ini_set lines:
ini_set('error_reporting', 4096);
This is based upon the recommendations from the drupal.org forms: http://drupal.org/node/514334#comment-1912924
Adjust PHP extensions (Drupal 7 only)
Drupal 7 will only support MySQL 5.0.15 or higher, and requires the PDO database extension for PHP. The PHP extension for connecting to your chosen database must be installed and enabled. Drupal's currently supported database connectors are: mysql (the original MySQL extension), mysqli (an improved connector for newer MySQL installations), and pgsql (for PostgreSQL). Note: PHP 5.x no longer enables the mysql extension by default. Please read the links above for installing and enabling your chosen connector. Additionally, Drupal 6.x does not provide the option to select the mysql connector if mysqli is enabled in your PHP configuration.
sudo apt-get install php5-gd
For more details see http://drupal.org/requirements
Reload Apache2
Reload Apache2.
sudo /etc/init.d/apache2 restart
Complete Drupal Installation through a Browser
Finally, point your browser to http://localhost/drupal/install.php (or perhaps http://localhost/drupal6/install.php if you installed the package from the official repository), create an account, login, and follow the installation instructions to finish loading the database and configuring the site.
If you got a page full of warnings, follow the prompts to resolve the issues (and add the fixes to this wiki page if appropriate).
The first account will automatically become the main administrator account with total control.