Contact Sales Sitemap Customer Login

HOWTO: Install LAMP on Ubuntu 6.06

Contents

System Repository Expansion

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

$ cp /etc/apt/sources.list /etc/apt/sources.list.original
$ vi /etc/apt/sources.list

you'll be in vi on the line

deb http://archive.ubuntulinux.org/ubuntu dapper main

Type two 'd's (that is '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.

## Add comments (##) in front of any line to remove it from being checked.    
## 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

## 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

## 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

## 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

Type esc to exit insert mode.

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

Locales are improperly setup so run:

$ locale-gen en_US
$ locale-gen en_US.UTF-8

Update and upgrade your server.

$ apt-get update
$ apt-get upgrade


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?

apt-get install mysql-server mysql-admin apache2 php5 libapache2-mod-php5 libapache2-mod-auth-mysql php5-mysql phpmyadmin

Type enter or 'y' and enter.

Setup MySQL

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

$ mysqladmin -u root password your-new-password
$ /etc/init.d/mysql restart

Restart Apache

/etc/init.d/apache2 restart

Check the Installation

Make a php file to test the server:

$ vi /var/www/testphp.php

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

<?php 
  phpinfo(); 
?>

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

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

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

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 Postfix

Modified from http://flurdy.com/docs/postfix/

apt-get install shorewall libsasl2-modules-sql libauthen-sasl-cyrus-perl libauthen-sasl-perl libgsasl7 postfix postfix-mysql courier-base courier-authdaemon courier-authmysql courier-imap courier-imap-ssl courier-ssl courier-pop amavisd-new spamassassin spamc clamav-base libclamav1 clamav-daemon clamav-freshclam postgrey squirrelmail squirrelmail-locales

Select no when asked to use the courier web based administration

Select all defaults for Internet Site when installing postfix, we'll edit the configuration later.

Configure Firewall

$ vi /etc/shorewall/zones
#zone display comment 
loc Local Local network 
net Net The internet
$ vi /etc/shorewall/interfaces
net venet0 detect
$ vi /etc/shorewall/hosts
loc venet0:0:64.79.219.182/24
$ vi /etc/shorewall/policy
fw loc ACCEPT fw net ACCEPT 
loc all DROP info
net all DROP info
all all REJECT info
$ vi /etc/shorewall/rules
AllowPing loc fw 
AllowSSH loc fw 
#AllowSMTP loc fw 
#ACCEPT loc fw tcp 465,587 - 
#AllowIMAP loc fw 
#AllowPing net fw 
AllowSSH net fw 
#AllowSMTP net fw 
#ACCEPT net fw tcp 465,587 - 
#AllowIMAP net fw
$ vi /etc/default/shorewall
startup=1

Restart Shorewall

$ /etc/init.d/shorewall restart
Retrieved from "http://wiki.vpslink.com/index.php?title=HOWTO:_Install_LAMP_on_Ubuntu_6.06&oldid=15223"
Recent Changes | RSS RSS Feed