Installing LAMP on Ubuntu Server 16.04 LTS

Source: Internet
Author: User
Tags install php phpmyadmin

Installing LAMP on Ubuntu Server 16.04 LTS


The LAMP solution is a collection of free and open source software that contains Linux , Web server (Apache) , Database server (mysql/mariadb), and PHP (scripting language).


lamp is the basic platform for installing and building dynamic Web applications such as WordPress, Joomla, OpenCart and Drupal, and I'll describe how to install LAMP on Ubuntu Server 16.04 LTS, known as Ubuntu is part of a Linux-based tutorial , so it makes up the LAMP's operating system, and in the next operation, I will default you have installed Ubuntu Server 16.04.


Apache2 installation of the Web server:

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

[Email protected]:~$ sudo apt update

[Email protected]:~$ sudo apt install apache2-y

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

[Email protected]:~$ sudo systemctl start apache2.service

[Email protected]:~$ sudo systemctl enable Apache2.service

[Email protected]:~$ sudo systemctl status apache2.service

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

[Email protected]:~$ sudo ufw status

Status:active

[Email protected]:~$ sudo ufw allow in ' Apache full '

Rule added

Rule added (V6)

[Email protected]:~$

Now start to access your Web server:

Open the browser and enter the server's IP address or hostname, in my example my server IP is ' 192.168.1.13 '

Installation of the database server (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.

[Email protected]:~$ sudo apt install mysql-server mysql-client

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

Confirm the password for the root account and click OK.

The MySQL server installation has ended, and the MySQL service is automatically started and enabled. We can verify the status of the MySQL service with the following command.

[Email protected]:~$ sudo systemctl status mysql.service

Installation of MariaDB server:

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

[Email protected]:~$ sudo apt install mariadb-server

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

[Email protected]:~$ sudo mysql_secure_installation

Welcome to Brother Lian Linux Tutorials .

Installation of the PHP scripting language:

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

[Email protected]:~$ 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)

[Email protected]:~$ VI samplepage.php

<?php

Phpinfo ();

?>

After editing in VI, save and exit the file.

[Email protected]:~$ sudo mv samplepage.php/var/www/html/

Now you can access this page from your Web browser and enter:

"Http://<Server_IP>/samplepage.php", you can see the success page. The page shows us that PHP has been completely installed successfully.

Installation of PhpMyAdmin:

Brother Lian Linux Tutorials method, PhpMyAdmin allows us to perform all tasks related to database management and other database operations through its web interface, which already exists in Ubuntu's software source.

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

[Email protected]:~$ sudo apt install php-mbstring php7.0-mbstring php-gettext

[Email protected]:~$ sudo systemctl restart Apache2.service

[Email protected]:~$ sudo apt install phpmyadmin

During the following installation, it will prompt 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 that PhpMyAdmin uses to register with the database server.

Confirm the required password for phpMyAdmin and click Confirm.

Now you can start trying to access phpMyAdmin, open your 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.

By now, the LAMP solution has been successfully installed and can be used, welcome to share, thank you very much for watching this Linux tutorial.

receive more Brother Lian Original Linux Tutorials please visit: www.itxdl.cn directly contact Customer service to collect.


Installing LAMP on Ubuntu Server 16.04 LTS

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.