Personal Development Ourmedia

This guide will take you all the way through the instalation of Apache, MySQL, PHP, and CVS for the creation of a personal development portal built on CVS Drupal Most users will probably be satisfied just with a LAMP system, so just quit reading when you get there :)

= System Repository Expansion =

From the first SSH into a fresh Ubuntu 6.06 install (as root user!).

<pre>$ cp /etc/apt/sources.list /etc/apt/sources.list.original
$ vi /etc/apt/sources.list</pre>

you'll be in vi on the line

<pre>deb http://archive.ubuntulinux.org/ubuntu dapper main</pre>

Type two 'd's (that's 'dd'). That will delete the only line in the file.

Type 'i' to enter insert mode.

Copy the following text, and paste (shift-ctrl-v) it into the terminal so you'll be using a standard server configuration with the universe, multiverse, and restricted repositories activated.

<pre>## Add comments (##) in front of any line to remove it from being checked.

  1. Use the following sources.list at your own risk.

deb http://archive.ubuntu.com/ubuntu dapper main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu dapper main restricted universe multiverse

  1. MAJOR BUG FIX UPDATES produced after the final release

deb http://archive.ubuntu.com/ubuntu dapper-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu dapper-updates main restricted universe multiverse

  1. UBUNTU SECURITY UPDATES

deb http://security.ubuntu.com/ubuntu dapper-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu dapper-security main restricted universe multiverse

  1. BACKPORTS REPOSITORY (Unsupported. May contain illegal packages. Use at own risk.)

deb http://archive.ubuntu.com/ubuntu dapper-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu dapper-backports main restricted universe multiverse</pre>

Type esc to exit insert mode.

Type ':wq' to write the file and quit.

Locales are improperly setup so run:

<pre>$ locale-gen en_US
$ locale-gen en_US.UTF-8</pre>

Update and upgrade your server.

<pre>$ apt-get update
$ apt-get upgrade</pre>

The repository indexes will be downloaded, and if you're asked if you want to install packages just hit enter or type 'y' and hit enter. Your system is now up to date (and slightly less secure, but hey, security's just a practice).

= LAMP Installation =

Install the Software

Paste this into your terminal as one line. You may not want phpMyAdmin, and you certainly don't need it, but isn't it handy.

<pre>apt-get install mysql-server mysql-admin apache2 php5 libapache2-mod-php5 libapache2-mod-auth-mysql php5-mysql phpmyadmin</pre>

Type enter or 'y' and enter.

Setup MySQL

Only allow connections from localhost, especially for the root user.

<pre>$ mysqladmin -u root password your-new-password
$ sudo /etc/init.d/mysql restart</pre>

Restart Apache

<pre>/etc/init.d/apache2 restart</pre>

Check the Installation

Make a php file to test the server:

<pre>$ vi /var/www/testphp.php</pre>

Type 'i' to enter insert mode and then paste (shift-ctrl-v) the folowing text.

<pre><div class="codeblock"><?php

  phpinfo
();
?>
</div></pre>

Type esc and then ':wq' to save the file.

Go to http://example.com/ You should see

<pre>Index of /

Icon Name Last modified Size Description[DIR] apache2-default/ 26-Jul-2006 17:50 -
[DIR] phpmyadmin/ 08-May-2006 11:57 -
[ ] testphp.php 18-Aug-2006 13:03 24

Apache/2.0.55 (Ubuntu) PHP/5.1.2 Server at example.com Port 80</pre>

Go to testphp.php . You should see a whole slew of information about your PHP settings.

Go to http://example.com/phpmyadmin/

Log into phpMyAdmin as the root user!

If everything is working...it's working.

= Installing Drupal =

Installing CVS

apt-get install subversion cvs

Installing from Drupal CVS

Checkout the Sources

<pre>$ cd /var/www/
$ cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout drupal
[...]
$ ls
apache2-default drupal phpmyadmin testphp.php</pre>

I'm migrating my personal portal so I'm also going to be checking out some modules.

<pre>$ cd /var/www/drupal/modules
$ cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d contributions/<module_name> contributions/modules/<module_name></pre>

Repeat that command as needed.

Install a theme other than one of the default themes.

<pre>$ cd /var/www/drupal/themes
$ cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d <theme_name>/ contributions/themes/<theme_name></pre>

Setup the Drupal Database

Remember back in the day when you set the root password for your MySQL server, you're going to need that password right now to create another MySQL user.

<pre> First, you must create a new database for your Drupal site
(here, 'databasename' is the name of the new database):

mysqladmin -u root -p create databasename

MySQL will prompt for the 'dba_user' database password and then create
the initial database files. Next you must login and set the access
database rights:

mysql -u root -p

Again, you will be asked for the 'dba_user' database password.
At the MySQL prompt, enter following command:

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX,
ALTER, CREATE TEMPORARY TABLES, LOCK TABLES
ON databasename.*
TO 'username'@'localhost' IDENTIFIED BY 'password';

where

'databasename' is the name of your database
'username@localhost' is the username of your MySQL account
'password' is the password required for that username

Note: Unless your database user has all of the privileges listed
above, you will not be able to run Drupal.

If successful, MySQL will reply with:

Query OK, 0 rows affected

To activate the new permissions, enter the following command:

FLUSH PRIVILEGES;</pre>

<cite>Drupal CVS: INSTALL.mysql.txt</cite>

This guide will take you all the way through the instalation of Apache, MySQL, PHP, and CVS for the creation of a personal development portal built on CVS Drupal Most users will probably be satisfied just with a LAMP system, so just quit reading when you get there :)

= System Repository Expansion =

From the first SSH into a fresh Ubuntu 6.06 install (as root user!).

<pre>$ cp /etc/apt/sources.list /etc/apt/sources.list.original
$ vi /etc/apt/sources.list</pre>

you'll be in vi on the line

<pre>deb http://archive.ubuntulinux.org/ubuntu dapper main</pre>

Type two 'd's (that's 'dd'). That will delete the only line in the file.

Type 'i' to enter insert mode.

Copy the following text, and paste (shift-ctrl-v) it into the terminal so you'll be using a standard server configuration with the universe, multiverse, and restricted repositories activated.

<pre>## Add comments (##) in front of any line to remove it from being checked.

  1. Use the following sources.list at your own risk.

deb http://archive.ubuntu.com/ubuntu dapper main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu dapper main restricted universe multiverse

  1. MAJOR BUG FIX UPDATES produced after the final release

deb http://archive.ubuntu.com/ubuntu dapper-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu dapper-updates main restricted universe multiverse

  1. UBUNTU SECURITY UPDATES

deb http://security.ubuntu.com/ubuntu dapper-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu dapper-security main restricted universe multiverse

  1. BACKPORTS REPOSITORY (Unsupported. May contain illegal packages. Use at own risk.)

deb http://archive.ubuntu.com/ubuntu dapper-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu dapper-backports main restricted universe multiverse</pre>

Type esc to exit insert mode.

Type ':wq' to write the file and quit.

Locales are improperly setup so run:

<pre>$ locale-gen en_US
$ locale-gen en_US.UTF-8</pre>

Update and upgrade your server.

<pre>$ apt-get update
$ apt-get upgrade</pre>

The repository indexes will be downloaded, and if you're asked if you want to install packages just hit enter or type 'y' and hit enter. Your system is now up to date (and slightly less secure, but hey, security's just a practice).

= LAMP Installation =

Install the Software

Paste this into your terminal as one line. You may not want phpMyAdmin, and you certainly don't need it, but isn't it handy.

<pre>apt-get install mysql-server mysql-admin apache2 php5 libapache2-mod-php5 libapache2-mod-auth-mysql php5-mysql phpmyadmin</pre>

Type enter or 'y' and enter.

Setup MySQL

Only allow connections from localhost, especially for the root user.

<pre>$ mysqladmin -u root password your-new-password
$ sudo /etc/init.d/mysql restart</pre>

Restart Apache

<pre>/etc/init.d/apache2 restart</pre>

Check the Installation

Make a php file to test the server:

<pre>$ vi /var/www/testphp.php</pre>

Type 'i' to enter insert mode and then paste (shift-ctrl-v) the folowing text.

<pre><div class="codeblock"><?php

  phpinfo
();
?>
</div></pre>

Type esc and then ':wq' to save the file.

Go to http://example.com/ You should see

<pre>Index of /

Icon Name Last modified Size Description[DIR] apache2-default/ 26-Jul-2006 17:50 -
[DIR] phpmyadmin/ 08-May-2006 11:57 -
[ ] testphp.php 18-Aug-2006 13:03 24

Apache/2.0.55 (Ubuntu) PHP/5.1.2 Server at example.com Port 80</pre>

Go to testphp.php . You should see a whole slew of information about your PHP settings.

Go to http://example.com/phpmyadmin/

Log into phpMyAdmin as the root user!

If everything is working...it's working.

= Installing Drupal =

Installing CVS

apt-get install subversion cvs

Installing from Drupal CVS

Checkout the Sources

<pre>$ cd /var/www/
$ cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout drupal
[...]
$ ls
apache2-default drupal phpmyadmin testphp.php</pre>

I'm migrating my personal portal so I'm also going to be checking out some modules.

<pre>$ cd /var/www/drupal/modules
$ cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d contributions/<module_name> contributions/modules/<module_name></pre>

Repeat that command as needed.

Install a theme other than one of the default themes.

<pre>$ cd /var/www/drupal/themes
$ cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d <theme_name>/ contributions/themes/<theme_name></pre>

Setup the Drupal Database

Remember back in the day when you set the root password for your MySQL server, you're going to need that password right now to create another MySQL user.

<pre> First, you must create a new database for your Drupal site
(here, 'databasename' is the name of the new database):

mysqladmin -u root -p create databasename

MySQL will prompt for the 'dba_user' database password and then create
the initial database files. Next you must login and set the access
database rights:

mysql -u root -p

Again, you will be asked for the 'dba_user' database password.
At the MySQL prompt, enter following command:

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX,
ALTER, CREATE TEMPORARY TABLES, LOCK TABLES
ON databasename.*
TO 'username'@'localhost' IDENTIFIED BY 'password';

where

'databasename' is the name of your database
'username@localhost' is the username of your MySQL account
'password' is the password required for that username

Note: Unless your database user has all of the privileges listed
above, you will not be able to run Drupal.

If successful, MySQL will reply with:

Query OK, 0 rows affected

To activate the new permissions, enter the following command:

FLUSH PRIVILEGES;</pre>

To exit the MySQL Monitor, type

<pre>mysql> quit</pre>

I backed up my personal database using mysqldump and uploaded the resulting file to my server.

<pre>$ mysqldump -u [user_name] -p --opt [database_name] > /tmp/[dump_file]</pre>

Enter your password.

Transfer the backup file to the /tmp directory of your server.

<pre>$ scp /tmp/[dump_file] root@example.com:/tmp/[dump_file]</pre>

Load the Drupal database

<pre> From the command line, use (again, replacing 'username' and
'databasename' with your MySQL username and database name):

mysql -u username -p databasename < /tmp/[dump_file]</pre>

Modify your settings.php file to point to your database usign vi

<pre>$ vi /var/www/drupal/sites/default/settings.php</pre>

This quote from Drupal's INSTALL.txt file explains which line to change in settings.php. Once you've found this line type 'i' to enter insert mode, 'ESC' to exit insert mode, and ':qw' to write the file and quit vi.

<pre> The default configuration can be found in the
'sites/default/settings.php' file within your Drupal installation.
Before you can run Drupal, you must set the database URL. Open the
configuration file and edit the $db_url line to match the database
defined in the previous step:

$db_url = "mysql://username:password@localhost/databasename";</pre>

<cite>Drupal CVS: INSTALL.txt</cite>

= Apache Setup =

<em>To Be Continued...</em></pre>

Links:

Comments and discussion: