Sunday, May 25

Install LAMP (Linux Apache Mysql PHP) in ubuntu


Step 1 : Install Apache2

sudo apt-get update
sudo apt-get install apache2
To check the installation,try the following address in the browser

Step 2 : Install Mysql

sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
Enter the mysql root password,when promted during installation To do simple auto configuration of mysql follow these commands

sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation
Then enter the mysql root password entered earlier
press 'n' to not change the current password

Remove anonymous users? [Y/n] y 
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] n
Reload privilege tables now? [Y/n] y
For Production machines, press 'y' for option 'Remove test database and access to it?'

Step 3 : Install PHP

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
Then after installation, open below file and edit with sudo privelege.
<IfModule mod_dir.c>

          DirectoryIndex index.php index.html index.cgi index.xhtml index.htm

To install other php modules or extension, first find it
apt-cache search php5-
Then install that required module
sudo apt-get install <module_name>
The default server public folder is in the below path

Step 4 : Restart Apache Web Server

sudo service apache2 restart 

No comments:

Post a Comment