Wednesday, 1 July 2015

How To Install LAMP Stack On Ubuntu 15.04

How To Install LAMP Stack On Ubuntu 15.04

1. Install Apache
To install Apache…
#apt-get install apache2

Test Apache:
Open your web browser and navigate to http://localhost/ or http://server-ip-address/.

2. Install MySQL
#apt-get install mysql-server mysql-client
During installation, you’ll be asked to setup the MySQL “root” user password. Enter the password and click Ok.
MySQL is installed now.

You can verify the MySQL server status using command:

On Ubuntu 15.04:
#ssystemctl status mysql

On Ubuntu 14.10 and previous versions:
#service mysql status

Mysql initial setting…
#service mysql status
3. Install PHP
PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely used open-source general purpose scripting language that is especially suited for web development and can be embedded into HTML.

Install PHP with following command:
#apt-get install php5 php5-mysql libapache2-mod-php5

To test PHP, create a sample “test.php” file in Apache document root folder.

#vim /var/www/html/testphp.php
Add the following lines.

Restart apache2 service.

On Ubuntu 15.04:
#systemctl restart apache2

On Ubuntu 14.10 and lower versions:
#service apache2 restart

Navigate to http://server-ip-address/test.php. It will display all the details about php such as version, build date and commands etc.

4. Install phpMyAdmin
phpMyAdmin is a free open-source web interface tool used to manage your MySQL databases. It is available in the Official Debian repositories. So install it with command:

#apt-get install phpmyadmin
Select the Web server that should be automatically configured to run phpMyAdmin. In my case, it is apache2.

Enter password of the database’s administrative user.
Enter MySQL application password phpmyadmin.
Re-enter the password.
Success! phpMyAdmin installation is installed.

Additional Note: if you followed all steps carefully, phpMyAdmin should work just fine. In case phpMyAdmin is not working, please do the following steps.
Open terminal, and type:
#vim /etc/apache2/apache2.conf
Add the following line at the end.

Include /etc/phpmyadmin/apache.conf
Save and Exit.

Restart apache service:

On Ubuntu 15.04:
#systemctl restart apache2

On Ubuntu 14.10 and lower versions:
#/etc/init.d/apache2 restart


No comments:

Post a Comment