Check this Out!Visit our social network pages for recent updates!

Installing LAMP on Ubuntu 17.04 / 17.10

This brief tutorial is going to show students and new users steps to install LAMP on Ubuntu server 17.04 / 17.10. LAMP is an acronym for Linux, Apache2, MySQL and PHP. It’s a combination of open software that are typically used to host and run dynamic websites and web applications.

After installing LAMP, you should be able run websites powered by WordPress, Joomla or Drupal easily, since these web apps depend on LAMP to function.

When you’re to install LAMP, follow the steps below:

Step 1: Install and Update Ubuntu Server

This post assumes you have a functional Ubuntu server and that you have root access to install packages and make changes.

After installing Ubuntu, run the commands below to update the server

sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove

Reboot the server after running the above commands.

Step 2: Install Apache2 Webserver

Now that Ubuntu server is updated, run the commands below to install Apache2 server.

sudo apt-get install apache2

After installing Apache2, you can stop, start and enable it by running the commands below.

sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

To test if Apache2 is working, open a browser and browse to the server hostname or IP address.

Step 3: Install MySQL Database Server

The commands below install MySQL database server as well as its client.

sudo apt-get install mysql-server mysql-client

During the installation, you’ll be prompted to create and confirm MySQL root user password. This root account is the administrative and will be used to logon and manage the server.

After installing, you can stop, start and enable the server by running the commands below:

sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service

You may also want to run the commands below to secure MySQL server

sudo mysql_secure_installation

You’ll be prompted with series of prompts, follow the guide below to complete.

Enter password for user root: TYPE CURRENT ROOT PASSWOD

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Using existing password for root.

Estimated strength of the password: 50 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n

 ... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done! 

Next, continue below to install PHP.

Step 4: Install PHP

Finally, run the commands below to install PHP. The commands below install PHP and its most basic modules to work with Apache2 and MySQL. There many more modules available, but you may want to install them when they’re needed by the applications running.

sudo apt-get install php7.0 libapache2-mod-php7.0 php7.0-mysql

That’s it! This is how to install LAMP

Summary:

This post shows you how to install the LAMP stack on Ubuntu 17.04 / 17.10. This post can be used as a stepping store to install WordPress, Joomla or Drupal, since they all require LAMP to function.

Enjoy!

You may also like the post below:

Install and Password Protect phpMyAdmin on Ubuntu 17.04 / 17.10