Install-Installing Drupal 7 on a fresh Ubuntu 10.10

3 views
Skip to first unread message

hang@gmail

unread,
May 20, 2011, 4:46:16 PM5/20/11
to dev...@googlegroups.com

Installing Drupal 7 on a fresh Ubuntu 10.10 (Maverick Meerkat) box

This is a simple step by step instruction for installing Drupal 7 on a clean Ubuntu server edition slate. Canonical let's you try those out for an hour for free on Amazons cloud.

Configure Server   

After you have logged in via SSH (use Putty on Windows) go ahead and install some stuff:

sudo apt-get install apache2 php5-gd libapache2-mod-php5 mysql-server mysql-client php5-mysql cvs

You will be prompted for the MySQL root password. Type one and remember it, for example supersecretpw, which you can then use to log in to mysql:

mysql -uroot -psupersecretpw

Now it's time to create a database and a user who can access it, what you have to type is highlighted:

mysql> create database d7db;
Query OK, 0 rows affected (0.00 sec)
mysql> create user d7user identified by 'd7password';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on d7db.* to 'd7user'@'localhost' identified by 'd7password';
Query OK, 0 rows affected (0.00 sec)
mysql> exit;
Bye

Alright, the webserver and database server are up and running now. Sweet. You can check the webserver by going to your domain or IP in a browser and you'll see the default apache index.html which we don't need, so we can delete it (replace ubuntu in line 4 with your username from line 2):

whoami
ubuntu
cd /var
sudo chown -R ubuntu:www-data www
rm www/index.html

Install Drupal  

We can get the latest and greatest Drupal version from CVS (Replace DRUPAL-7-0-BETA1 with the version you want):


cd /var
cvs -z6 -d:pserver:anonymous:anon...@cvs.drupal.org:/cvs/drupal co -r DRUPAL-7-0-BETA1 -P -d www/ drupal

Well done! Configure the Drupal settings to use the database we created (also create the server writeable files directory):

cd /var/www/sites/default/
cp default.settings.php settings.php
mkdir files
sudo chown www-data files

Edit settings.php for exmaple with pico or vim:

pico settings.php

replace this line

$databases = array();

with this:

$databases['default']['default'] = array(
   'driver' => 'mysql',
   'database' => 'd7db',
   'username' => 'd7user',
   'password' => 'd7password',
   'host' => 'localhost',
   'prefix' => '',
   'collation' => 'utf8_general_ci',
 );

Save the file. I had to reload apache so it would handle the php files correctly:

sudo apachectl restart 

That's about it. you can now run the drupal install script by going to the ip or domain and opening install.php for example:
http://184.72.188.32/install.php
or

Bonus points - enable clean URLs 

sudo a2enmod rewrite
sudo pico /etc/apache2/sites-available/default 

in this section:
<directory /var/www/>
change  
AllowOverride None
to
AllowOverride All

Restart apache: 

sudo apachectl restart

Now you can enable clean URLs at:

http://example.com/#overlay=admin/config/search/clean-urls 

More bonus points - use APC

sudo apt-get install apache2-threaded-dev php5-dev php-pear make
sudo pecl install apc
sudo echo "extension=apc.so" >> /etc/php5/apache2/php.ini
sudo apachectl restart
Reply all
Reply to author
Forward
0 new messages