How to Install LAMP on Ubuntu 15.04 (Part 2)
CHUONG K. NGUYEN – BSc., MCSEx2, MCSAx2, MCP, MCTS, MCITP, CCNA
In this guide I will show you how to install LAMP on an existing Ubuntu 15.04 server. LAMP stands for Linux, Apache, MySQL, and PHP. (Nowaday, many people have moved to MariaDB instead of MySQL.)
After having Ubuntu 15.04 installed, we need to update, upgrade and remove uncessary services. Components will be downloaded and installed on the system. Unecessary software will be removed.
apt-get update && apt-get dist-upgrade && apt-get autoremove
In my case, there is nothing updated, nothing ugraded and nothing removed. This is because I just performed these tasks when I installed the server.
If any component was installed you are probably asked to restart the server.
apt-get install apache2
Start Apache2 service
service apache2 start
At this point the web server is up and operational. Use a browser to test the web site using your web server IP address. You should see the Apache2 Ubuntu Default Page coming up.
Installing PHP as well as Modules
PHP has lots of modules which we can utilize for our web server. Here we will install PHP and a few frequently used modules.
apt-get install php5 php5-mysql php5-curl php5-gd php5-snmp php5-mcrypt php5-tidy php5-xmlrpc libapache2-mod-php5
When prompted, type Y to continue. This installation takes about a minute or two depending on your Internet connection speed.
Create the file phpinfo.php under /var/www/html
Type the following contents
Open the browser and browse to http://192.168.1.5/phpinfo.php. The PHP Version information page should show up. This is indicative that PHP is functioning.
Installing MySQL Server and Client
Install both the server and the client components of MySQL
apt-get install mysql-server mysql-client
When ask to configure the root password, press OK.
Enter a secure password and repeat.
Start the MySQL Service:
systemctl start mysql
MySQL Server Configurations
Enter root password
Press ‘n’ for NO to changing root password.
Remove anonymous user: Y
Disallow root login remotely: Y
Remove test database and access to it: Y
Reload privilege tables now: Y
Restart Apache2 server.
Enable automatic startup for Apache2 and MySQL:
systemctl enable apache2
systemctl enable mysql
Now LAMP has been installed on Ubuntu 15.04. It consists of:
- MySQL 18.104.22.168
To log into mysql, type:
mysql –uroot –p
Then enter the password for the MySQL root account.