LAMP installation from source code ( tarball) on linux
Tested with ubuntu 12.04 LTS with mysql version 5.1.71, php 5.3.25 and apache 2.2.25
bellow packages must be installed on ubuntu
sudo apt-get install zlib1g-dev libncurses5-dev
sudo apt-get install g++
sudo apt-get install libgdbm-dev
sudo apt-get install libxml2-dev
Installing
MySQL 5.1
Download MySQL source tarballs Open a terminal and login Extract the source to some folder(say ‘/usr/src/mysql’).
$ sudo mkdir /usr/src/mysql
$ sudo cp mysql-VERSION.tar.gz /usr/src/mysql
$ cd /usr/src/mysql
$ tar -xvf mysql-VERSION.tar.gz
$ cd mysql-VERSION
For added security we will create a new user called ‘mysql’ and use this user while running MySQL.
$
sudo groupadd mysql
$
sudo useradd -g mysql mysql
Lets
compile
$
./configure --prefix=/usr/local/mysql
$
make
$
make install
configure MySQL
.
$
cp support-files/my-medium.cnf /etc/my.cnf
$
cd /usr/local/mysql
$
sudo mkdir /usr/local/mysql/var
$
bin/mysql_install_db --user=mysql
$
chown -R root.mysql .
$
chown -R mysql lib
Start MySQL
$
bin/mysqld_safe --user=mysql &
For
testing the installation give command
$/usr/local/mysql/bin/mysql
This
will bring mysql prompt mysql>
quit
Installing
Apache 2.2
download
the source extract to /usr/src/httpd.
$
mkdir /usr/src/httpd
$
cp httpd-VERSION.tar.gz /usr/src/httpd
$
cd /usr/src/httpd
$
tar -xvf httpd-VERSION.tar.gz
$
cd httpd-VERSION
Lets
compile it
$
./configure --prefix=/usr/local/apache2 --enable-mime-magic
--enable-expires \
--enable-headers
--enable-ssl --enable-http --enable-info --enable-dir \
--enable-rewrite
–enable-so
$ make
$
make install
Run
apache service
Installing
PHP 5
download PHP 5, extract to /usr/src/php5
.
$
mkdir /usr/src/php5
$
cp php-VERSION.tar.gz /usr/src/php5
$
cd /usr/src/php5
$
tar -xvf php-VERSION.tar.gz
$
cd php-VERSION
Lets
configure
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache/bin/apxs
--with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-mcrypt --with-mhash--with-curl --with-curlwrappers --disable-cgi --enable-mbstring=all --with-gd --enable-gd-native-ttf --with-ttf --with-jpeg-dir=/usr/lib --enable-magic-quotes
cp
php.ini-dist /usr/local/php5/lib
Configuring
Apache for php
By
default the document root folder is /usr/local/apache2/htdocs
you
can change it
open
the configuration file /usr/local/apache2/conf/httpd.conf
change
values
DocumentRoot
"/usr/local/apache2/htdocs"
With
DocumentRoot
"/var/www/htdocs"
AllowOverride
None
to
AllowOverride
All
DirectoryIndex
index.html index.html.var
to
DirectoryIndex
index.php index.html index.html.var
find
a commented line AddHandler type-map var
uncomment
the line and add belloe line bellow to above line
AddHandler
php5-script php
AddType
application/x-httpd-php .php
Start
Apache
/usr/local/apache2/bin/apachectl
start
test
php
create
a new file in document root folder named index.php and insert bellow
lines inside that file
<?php
phpinfo();
?>
save
it. And open browser give url as http://localhost
php
configuration page should be opened
Now
your LAMP installed and configured
Comments
Post a Comment