Installing LAMP server on Ubuntu

Print

Ubuntu version that was used: 8.04

To begin, install some packages that may be required later on:

sudo apt-get install binutils cpp fetchmail flex gcc libarchive-zip-perl libc6-dev libcompress-zlib-perl libdb4.3-dev libpcre3 libpopt-dev lynx m4 make ncftp nmap openssl perl perl-modules unzip zip zlib1g-dev autoconf automake1.9 libtool bison autotools-dev g++ build-essential

Then, install MySQL:

apt-get install mysql-server mysql-client libmysqlclient15-dev

We want MySQL to listen on all interfaces, not just localhost, therefore we edit /etc/mysql/my.cnf and comment out the line bind-address = 127.0.0.1

Apache/PHP5/Ruby

Install Apache:

apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert

Next, install PHP5 and Ruby (both as Apache modules):

apt-get install libapache2-mod-php5 libapache2-mod-ruby php5 php5-common php5-curl php5-dev php5-gd php5-idn php-pear php5-imagick php5-imap php5-json php5-mcrypt php5-memcache php5-mhash php5-ming php5-mysql php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

Next we edit /etc/apache2/mods-available/dir.conf:

vi /etc/apache2/mods-available/dir.conf


and change the DirectoryIndex line:


<IfModule mod_dir.c>
#DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml
</IfModule>


Now we have to enable some Apache modules (SSL, rewrite, suexec, and include):

a2enmod ssl
a2enmod rewrite
a2enmod suexec
a2enmod include

Reload the Apache configuration:

/etc/init.d/apache2 force-reload

and we are done.

To manage MySQL, you should also install phpmyadmin:

apt-get install phpmyadmin

 

Linux
Comments (2)
re: php5 not working
2 Sunday, 07 August 2011 10:11
Ant
The php module is most likely not enabled.

Try:
user@server:/# sudo a2enmod php5
user@server:/# /etc/init.d/apache2 force-reload

and it should work
php5 not working
1 Sunday, 07 August 2011 07:51
ybr
I have done everything given above. Yet php5 is not working. Upto the point of https://127.0.0.1 the html is working. php commands are not working. They are being ignored.
yvComment v.1.24.0