Included in this project presentation are:
Guidelines to building a LAMP server and installing a Content Management
System called Drupal onto it.
The system is built on VMware 6.5, hosted on a Windows XP Home Edition
The LAMP server includes:
A base Linux server (CentOS 5.2)
configured with dhcp and ftp.
Apache (a Linux Web Server)
mySQL (a Database system)
PHP (a programming language)
Using yum to install packages onto the server.
Methods for downloading Drupal to the server directly at the server, or indirectly
through the client.
Installing a LAMP Server
A LAMP server is a server configuration that
can host websites, intranets, and Web 2.0
type content management systems.
The acronym LAMP refers to:
Linux (Operating System)
Apache (Web Server)
PHP (A Programming language)
Installing a Base (Linux) Server
Only screen shots of interest are
included for the server installation.
Base Server Installation
Once you see this screen, it is a
matter of selecting configurable items
as the installation progresses.
After pressing the ‘next’ option
above, the installation moves on to a
number of language selection
If installing on a virtual machine, don’t
worry about this warning. Press ‘yes’ and
Again, don’t be alarmed by this message if
installing on a virtual machine. Press
By checking the ‘Active on Boot’ and ‘automatically via
DHCP’ here, the network card of the virtual server, will
adopt the settings of the host system network card.
This is followed by a time zone
Which in turn, is followed by a screen
which sets the root password. The
root password must be at least 6
characters in length.
Up until this point, desktop and server installation are the
same. Scroll through the top pane, un-tick ‘desktop’ and tick
‘server’. Select the ‘Customise now’ radio button and press
The next 2 screens allow you to choose
what type of tools and applications you
want to install. This will vary depending on
your requirements. I chose ‘development’
and ‘development tools’, followed by ‘base
system’ and ‘base’. This is the point you
also select a GUI, if you want to. If you
don’t, you will only have a command
prompt to work with after installation.
And the installation process begins. It
takes approximately 15 minute.
A screen saying ‘Formatting/file
Then a screen saying ‘Starting install
And these are followed by a screen
with a progress bar.
A screen congratulating you appears,
and you select the ‘reboot’ option.
Finally you get this screen. Just exit out of
this and you get the login: prompt.
Basic Server Installation Complete.
At this point, you have a basic server
YUM (Yellow-Dog Unified Modifier.)
Yum is a packet management utility.
It can be used to update the
operating System installation.
It can also be used to install
additional services on the basic server
Updating the OS
This is simply achieved by logging in
as root, and typing the command:
Adding DHCP to the Basic Server
DHCP centralises and manages the
allocation of TCP/IP configuration
information on a DHCP server.
A DHCP server allocates IP addresses to
client system that are configured to use
These IP addresses can be leased for a
specific period and the client can attempt to
renew its lease before it expires.
Again we use yum.
#yum –y install dhcp
This displays a screen that shows the
version of the DHCP download and a
progress bar and percentage
Some basic DHCP configuration.
First you have to give the DHCP server a
static IP address. This is done by typing:
#ifconfig eth0 192.168.0.10 netmask
Eth0 is the interface name. This can vary
depending on what interface you are using
to connect to the network.
Making this address permanent.
This address will be lost after a
reboot, if it is not permanently saved.
To save the IP address, we use the
This opens a utility that allows us to
enter the information.
When DHCP starts, it reads the
This file contains the configuration
information for the DHCP service.
Among its configurable parameters
The network and subnetmask.
The default gateway and its subnet
The domain name.
The DNS Server address.
The range of IP addresses that the
DHCP Server can allocate.
The terms of the lease.
A text editor like vi or nano can be
used to edit the /etc/dhcpd.conf file.
To start the DHCP service, type
#service dhcpd start
To ensure that it starts at boot, type
#chkconfig dhcpd on
DHCP: where to send the IP offers.
The DHCP server must be configured
to know on what interface, to send an
IP address to a client requesting one.
# route add -host 255.255.255.255
This tells the server to broadcast the
address out the eth0 interface.
Testing the DHCP server
Install a CentOS client and set it to
receive its IP address through DHCP.
If using VMware, team the DHCP
server and the client and change their
network card settings to Lan1. To do
this, right click the settings tab in
VMware or the network card itself.
Testing the DHCP server
Ping the server IP address. If you get
replies, the connection is ok.
Get the IP address of the client by
And ping the client from the server.
Adding FTP to the Server
Configure the server to use the Host IP
address again by:
Breaking the VMware team.
Changing the network card from Lan1 to
Which opens the following screen.
FTP Installation commands.
#yum install vsftpd
#chkconfig vsftpd on
This ensures that the FTP service runs
a boot time.
Turn iptables off or else set a rule to
allow FTP. To turn iptable off type:
#service iptables off
Start the FTP service.
#service vsftpd start
and ensure that it starts at boot time.
#chkconfig vsftpd on
This can be done in two ways.
From the server, by typing
or from the client, (after reteaming with the
server in VMware), by typing
#ftp 192.168.0.10 ( the server IP
Use ‘anonymous’ as the username and
‘password’ as the password.
Apache is a linux web server. By installing
it on the base server, the server can be
used to host websites.
To install it on the base server, type:
#yum install httpd
#chkconfig httpd on
This ensures that it starts at boot.
As I didn’t install a GUI on the server
during the base server installation, I
must install a text based browser
called elinks, to test it.
To install elinks, type:
#yum install elinks
and follow elinks instructions
Starting and Stopping Apache
# apachectl stop
# apachectl start
# service httpd start
# service httpd stop
Adding MySQL to the Server
# yum install mysql-server mysql
# service mysqld start
# chkconfig mysqld on
if you want it to start at boot.
Adding PHP to the Server
# yum install php
If installing MySQL and PHP while Apache is
running, you must stop and start Apache.
This completes the installation of the
lamp server. (Linux, Apache, MySQL &
Installing Drupal on a LAMP server.
The basic LAMP server needs some
additional packages installed for
Drupal to install correctly. If using
VMware, change the network card
settings to LAT and remove the static
IP address so that the server uses the
host system IP.
Download Drupal & unzip it.
This creates a zipped directory called
drupal-6.10.tar.gz in the root
# tar –zxvpf drupal-6.10.tar.gz
(If MV doesn’t work, see slide 65)
Unzipping creates a directory called drupal-
6.1 in the root directory, which contains all
the Drupal directories and files (some
Copy the contents of this directory to the
# mv drupal-6.1/* drupal-6.1/.htaccess
The mv command & What it does.
This is actually two commands, the
asterisk, ‘*’ means all files and directories.
However, asterisk, won’t copy the hidden
file .htaccess, so this must also be
(This command is in effect, # mv drupal-
6.1/* /var/www/html and # mv drupal-
Change directory into /html/sites/default
# cd /html/sites/default
Make a copy of the default.settings.php file
and call it settings.php
# cp default.settings.php settings.php
Give permissions to this file.
This is required so that Drupal can
make changes to it during
installation. After installation, most of
these permissions must be removed
# chmod 777 settings.php
The files directory.
Check that the /html/sites/default/files
directory exists. If not, make it .
# mkdir files
# chmod 777 files
Create a database for drupal to use.
Start the mysql service if it isn’t
started automatically at boot.
# service mysqld start
Create a user to administer the database.
I chose root and gave a simple
password of ‘mypassword’.
# mysqladmin – u root – p password
Use this user, root, to create a database.
I called the database ‘cit’.
# mysqldadmin – u root – p create cit
Then log into mysql as root and grant
# mysql – u root – p
This will ask for a password. Enter mypassword, and you will
be presented with the mysql> prompt, from where you can
mysql> GRANT SELECT, INSERT,
UPDATE, CREATE, DROP, INDEX, ALTER
ON cit.* TO ‘root’@’localhost’
Note, there are quotes around root, localhost and
mypassword. Don’t forget the semi-colon, at the end.
Activate these permissions.
mysql> FLUSH PRIVILEGES;
You can check that the database was
created by typing:
mysql> show databases
Exit mysql by typing quit.
Re-team the server and client.
Change the network card settings
back to LAN1, ie team it with the
client in VMware, and give the server
its static IP address again, through
the system-config-network command.
Reboot the server.
Turn iptables off, if you haven’t written specific rules, so
that the client system is allowed to browse to it.
# service iptables stop
An iptables rule to allow traffic to port 80 from hosts on
the server network of 192.168.0.0 255.255.255.0 reads:
-A INPUT -s 192.168.0.0/24 –p tcp –m tcp --dport 80 –j
Save this in the /etc/sysconfig/iptables file on the server
Make sure that mysqld is started, by
# service mysqld start
Boot the client system.
Make sure that httpd is running on the
# service httpd start
Open the firefox browser on the client and
enter the URL,
Browse to http://192.168.0.10 and
it opens the site.
Reduce permissions on settings.php
Log onto the server again and change
directory, into the default, so that
you can remove some of the
permissions on settings.php .
# cd /var/www/html/sites/default
# chmod 555 settings.php
Alternative method of downloading Drupal onto
the server through the client.
Change the network card settings on the client
to NAT, so that it can access the internet
Open the browser and browse to drupal.org.
Click on the Download Drupal 6.10 link. It is
downloaded to the desktop as a zipped folder.
Double click it and extract it.
This creates another folder called drupal-6.1,
which contains all of the installation files. Re-
establish the VMware team .
Extracted files in drupal-6.10 folder on desktop.
Go to Places – Network Servers and double
click SFTP File Transfer on WWW
You are presented with a screen, requesting a password.
Enter the password for the server, and you login to the
server, from where you can view its directories and folders.
Scroll through the folders, and double click the var folder,
then www folder, and finally the html folder. If there are
files in it, delete them, and minimise the screen.
Open the drupal-6.10 folder on the desktop, edit – select all
and DRAG them, don’t paste them, into the html folder.
You can then continue with the installation, by browsing to
http://192.168.0.10/install.php , as outlined earlier, and
proceed with the install.