Install lamp illustration tutorials on Ubuntu Server 16.04 LTS _linux

Source: Internet
Author: User
Tags install php phpmyadmin

The LAMP scheme is a collection of free and open source software, including Linux, Web Server (Apache), database Server (MYSQL/MARIADB), and PHP (scripting language). LAMP is the foundation platform that needs to install and build dynamic Web applications, such as WordPress, Joomla, OpenCart and Drupal.

In this article, I will describe how to install lamp on the Ubuntu Server 16.04 LTS, as we all know that Ubuntu is a linux-based operating system, so it makes up the first part of LAMP, and in the next operation, I will default you have installed the Ubunt U Server 16.04.

Ubuntu Server 16.04 Installation method:

Ubuntu 16.04 Server Edition installation Tutorials in English

Ubuntu 16.04 Chinese Version Installation Basics Tutorial (text)

Apache2 Web Server Installation:

In Ubuntu Linux, the Web server is Apache2, and we can install it using the following command:

linuxtechi@ubuntu:~$ sudo apt update
linuxtechi@ubuntu:~$ sudo apt install apache2-y

After the APACHE2 package is installed, the APACHE2 related services are enabled and run automatically after reboot. In some cases, if your Apache2 service is not automatically run and enabled, you can use the following command to start and enable it.

linuxtechi@ubuntu:~$ sudo systemctl start apache2.service
linuxtechi@ubuntu:~$ sudo systemctl enable Apache2.service
linuxtechi@ubuntu:~$ sudo systemctl status apache2.service

If you open the Ubuntu Firewall (UFW), you can use the following command to unlock the Web server's ports (80 and 443)

linuxtechi@ubuntu:~$ sudo ufw status
status:active
linuxtechi@ubuntu:~$ sudo ufw allow in ' Apache full '
Rule added Rule
added (V6)
linuxtechi@ubuntu:~$

Now start to visit your Web server:

Open the browser and enter the server's IP address or host name (Http://IP_Address_OR_Host_Name), in my case my server IP is ' 192.168.1.13 '

Database Server installation (MySQL server 5.7):

Both MySQL and MARIADB are database servers in Ubuntu 16.04. Both MySQL server and MARIADB Server installation packages can be found in Ubuntu's default software source, and we can choose one of them to install. Use the following command to install the MySQL server in the terminal.

linuxtechi@ubuntu:~$ sudo apt install mysql-server mysql-client

During the installation process, it will require you to set the MySQL server root account password.

Confirm the password for the root account and click OK.

This is the end of the MySQL server installation, and the MySQL service is automatically started and enabled. We can verify the status of the MySQL service by using the following command.

linuxtechi@ubuntu:~$ sudo systemctl status mysql.service

Installation of MARIADB server:

Use the following command in the terminal to install the MARIADB 10.0 server.

linuxtechi@ubuntu:~$ sudo apt install mariadb-server

Run the following command to set the password for the MARIADB root account and to turn off certain options, such as turning off Telnet.

linuxtechi@ubuntu:~$ sudo mysql_secure_installation

Installation of the PHP scripting language:

PHP 7 already exists in the Ubuntu software source, executing the following command in the terminal to install PHP 7:

linuxtechi@ubuntu:~$ sudo apt install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0

Create a simple PHP page and move it to the Apache document root directory (/var/www/html)

linuxtechi@ubuntu:~$ vi samplepage.php
<?php
phpinfo ();
? >

After editing in VI, save and exit the file.

linuxtechi@ubuntu:~$ sudo mv samplepage.php/var/www/html/

Now you can access this page from a Web browser, enter: "http://<Server_IP>/samplepage.php", you can see the following page.

The above page shows us that PHP has been completely installed successfully.

Installation of phpMyAdmin:

phpMyAdmin allows us to perform all the tasks associated with database management and other database operations through its web interface, which already exists in the Ubuntu software source.

Use the following command to install phpMyAdmin in the Ubuntu server 16.04 LTS.

linuxtechi@ubuntu:~$ sudo apt install php-mbstring php7.0-mbstring php-gettext linuxtechi@ubuntu:~$
sudo systemctl Restart Apache2.service
linuxtechi@ubuntu:~$ sudo apt install phpmyadmin

During the following installation process, it prompts us to select the target server to run phpMyAdmin.

Select Apache2 and click OK.

Click OK to configure the phpMyAdmin managed database.

Specifies the password to use when phpMyAdmin registers with the database server.

Confirm the password required by phpMyAdmin and click Confirm.

Now you can start trying to access phpMyAdmin, open the browser and enter: "Http://Server_IP_OR_Host_Name/phpmyadmin"

Use the root account and password that we set up when we installed it.

When we click "Go", we will redirect to the ' phpMyAdmin ' web interface as shown below.

By now, the LAMP scheme has been successfully installed and ready to use, and you are welcome to share your feedback and comments.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.