Install LAMP Server on Ubuntu 17.10 Server

Welcome to Ubuntu Tutorial. Today we are going to show you how to install LAMP Server on Ubuntu 17.10. We are using Ubuntu 17.10 Server edition on this tutorial. Please read our previous tutorial if you want to see how to install Ubuntu 17.10 Server. LAMP is a combination between Linux, Apache, MySQL/MariaDB and PHP. These combination provides a powerful web server with database back end and PHP. Install LAMP Server on Ubuntu 17.10 is pretty easy. 

Steps to install LAMP Server on Ubuntu 17.10 Server

  1. Install Apache Web Server
  2. MySQL/MariaDB Installation
  3. PHP Installation
  4. Clean up things

Step 1. Install Apache Web Server

I assume you have a direct connection to the Ubuntu Server. You can also use ssh to connect to your server. On this tutorial, we are installing LAMP on Ubuntu Server with IP address : 10.34.0.218

Connect to the server via ssh

Install Apache web server

Output sample

Afterward, check if the web server is running. Type the server IP address. In my case it would be the following:

http://10.34.0.218

Step 2. Install MySQL/MariaDB

Now, that we have our web server is up and running. Now we continue to install MySQL. MySQL is a well known database system. 

Install MySQL on Ubuntu 17.10

Output sample

During installation, you will need to enter a password for root user. 

Secure MySQL Installation

Now we need to perform a command to secure our MySQL installation. 

Follow on screen wizard to complete this step

Enable and start MySQL service

Step 3. Install PHP

Now we are going to install PHP and some other modules

Output sample:

In most cases, we need to modify the Apache serves files when a directory is requested by users. We are going to modify the apache configuration to look for an index.php first. 

Your current configuration should looks like this

<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml inde$
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

We are going to move index.php in front of the line. Now it looks like this

<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml inde$
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Now restart apache2

Make sure Apache status is active(running) and no errors detected. 

Test PHP on web browser

We are going to create a new file called info.php. We put this file inside the web server directory which is /var/www/html

Paste these lines

<?php
phpinfo();
?>

Close the file and now open web browser and type the server IP address with the following format

http://your-server-ip-address/info.php

You should see something like this

Conclusion

LAMP Server is a great way to build a powerful web application server. With this tool we can turn our Ubuntu 17.10 into a powerful web server. Its not difficult to install LAMP Server on Ubuntu 17.10. With a little efforts we can have this things done in few minutes.

Be the first to comment

Leave a Reply

Your email address will not be published.


*