Installing LAMP in Ubuntu

A software package called LAMP includes OS on the Linux kernel, the Apache web server, MySQL database and PHP components used for engine site. Next, we will describe the installation and initial configuration of these add-ons, taking as an example the latest version of Ubuntu.

Install a set of programs of LAMP in Ubuntu

Since the format of this article already assumes that you have installed Ubuntu, we’ll skip this step and go directly to other programs, but you can find instructions on that topic, read our other articles at the following links.

Read more:
Install Ubuntu on VirtualBox
Step-by-step guide to install Linux from a flash drive

Step 1: Install Apache

Let’s start with the installation public web server called Apache. It is one of the best option, therefore, is becoming the choice of many users. In Ubuntu it is set via “Terminal”:

  • Open the menu and start the console or press the key combination Ctrl + Alt + T.
  • First, update the system repository to make sure you have all the required components. To do this, write the command sudo apt-get update.
  • All actions using sudo runs with root access, so make sure you quote your password (when you enter it is not displayed).
  • When you finish, type sudo apt-get install apache2 to add Apache to the system.
  • Confirm adding all files by selecting answer D.
  • Let’s test the web server by running sudo apache2ctl configtest.
  • The syntax should be normal, but sometimes there is a warning about the need to add a ServerName.
  • Add this global variable to the configuration file to avoid warnings in the future. Run the file using sudo nano /etc/apache2/apache2.conf.
  • Now start a second console where you run the command ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's//.*$//', to know your IP address or server domain.
  • In the first “Terminal” drop down to the bottom of the opened file and enter ServerName + domain name or IP addressthat you just found out. Save the changes using Ctrl + O and close the configuration file.
  • Spend more time testing to make sure there are no errors, and then restart the web server using sudo systemctl restart apache2.
  • Add Apache to the startup if you want to run with the operating system with the command sudo systemctl enable apache2.
  • You only have to run the web server to verify the stability of its work, use the command sudo systemctl start apache2.
  • Start a browser and navigate to localhost. If you landed on the main Apache page, then everything is functioning correctly, proceed to the next step.
  • Step 2: Install MySQL

    The second action will add MySQL database that is also available through the standard console, using the system commands.

  • Priority in “Terminal” write sudo apt-get install mysql-server and press Enter.
  • Confirm adding new files.
  • Be sure to secure the use of a MySQL environment, so provide protection by using a separate add-on that is installed via sudo mysql_secure_installation.
  • The installation of the plugin settings for password requirements has a single user, because each user starts from its own decisions in terms of validation. If you want to install the requirements enter into the console y when prompted.
  • Next, you need to choose the level of protection. First read the description of each option, and then select the most suitable one.
  • Set a new password to enable root access.
  • Next you will see a different security settings, read them and accept or discard if necessary.
  • Describing a different method of installation I recommend to read in our separate article, which you will find in the following link.

    Step 3: Installing PHP

    The last step to ensure the normal operation of the system is the installation of LAMP components PHP. In implementing this process is not complicated, only need to use one of the available commands, and then configure the add-on.

  • In “the Terminal” mount command sudo apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi, php7.0 libapache2-mod-php7.0 to install the required components in the case, if you need version 7.
  • Sometimes the above command is broken, so use sudo apt install 7.2 php-cli or sudo apt install hhvmto install the latest available version, 7.2.
  • At the end of the procedure, make sure that plumbed the correct Assembly, writing in console php-v.
  • Database management and implementation the web interface is done using the free PHPmyadmin tool, which is also preferably set during configuration of the LAMP. To start, enter the command sudo apt-get install phpmyadmin php-mbstring, php-gettext.
  • Confirm adding new files by selecting the appropriate option.
  • Specify the web server “Apache2” and press “OK”.
  • You will be prompted to configure the database through a dedicated team, if necessary, select a positive answer.
  • Create a password for logging on to the database server, after which it will need to confirm by re-entering.
  • By default you will not be able to login to PHPmyadmin from your user name rooted or using TPC-interfaces, so you need to disable blocking utility. Activate the right Ruth using the command sudo-i.
  • Swipe off, by typing echo "update user set plugin=" where User='root'; flush privileges;" | mysql -u root-p mysql.
  • This is the procedure to install and configure PHP for LAMP can be considered successfully completed.

    Today we touched on the theme installation and basic setup of LAMP components for the operating system Ubuntu. Of course, this is not all the information you can provide on this topic, there are many nuances associated with the use of multiple domains or databases. However, thanks to the instructions above you will be able to prepare your system for the correct functioning of the software.


    (Visited 37 times, 1 visits today)