The lamp solution is a collection of free and open source software.Contains linux, web server (apache), database server (mysql/mariadb), and php (scripting language). Lamp is the basic platform for those who need to install and build dynamic web applications.Examples include wordpress, joomla, opencart, and drupal.
In this article,I will describe how to install lamp on ubuntu server 16.04 lts. As we all know, ubuntu is a linux based operating system.So it forms the first part of the lamp,In the next operation,I will assume you have installed ubuntu server 16.04 by default.
Ubuntu server 16.04 installation method:
Installation of apache2 web server:
In ubuntu linux, the web server is apache2, we can install it using the following command:
[email protected]:~ $sudo apt update [email protected]:~ $sudo apt install apache2 -y
After installing the apache2 package, apache2-related services are enabled.And run automatically after restart.In some cases,If your apache2 service is not running and enabled automatically,You can use the following commands 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 enable the ubuntu firewall (ufw), then you can use the following command to remove the port (80 and 443) restrictions of the web server
[email protected]:~ $sudo ufw status status:active [email protected]:~ $sudo ufw allow in "apache full" rule added rule added (v6) [email protected]:~ $
Start accessing your web server now:
Open your browser and enter the server's IP address or host name (http://ip_address_or_host_name). In my example, 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. The installation packages of mysql server and mariadb server can be found in the default software source of ubuntu.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 a password for the mysql server root account.
Confirm the password of the root account,And click OK.
The installation of the mysql server is now over. 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 a 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,It can also be used to turn off certain options,For example, turn off the remote login function.
[email protected]:~ $sudo mysql_secure_installation
Installation of the php script language:
php 7 already exists in the ubuntu 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 document root of apache (/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, Enter:"http://<server_ip>/samplepage.php", you can see the following page.
The above page shows us that php is fully installed.
Installation of phpmyadmin:
phpmyadmin allows us to perform all tasks related to database management and other database operations through its web interface,This installation package already exists in the ubuntu 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 choose the target server where phpmyadmin runs.
Select apache2 and click OK.
Click OK to configure the database managed by phpmyadmin.
Specify the password that phpmyadmin uses to register with the database server.
Confirm the password required by phpmyadmin,And click OK.
You can now try 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 during installation.
When we click "go", we will be redirected to the "phpmyadmin" web interface as shown below.
- Detailed installation and configuration of Apache2 under Ubuntu
- How to install Apache Tomcat on Ubuntu 1604
- Ubuntu 1404 tutorial for installing Apache Ant
- Graphic tutorial for installing mysql8011 on Ubuntu1804
- Detailed process of installing PHP 7 under Ubuntu 1604
- A complete tutorial on installing Apache, MySQL, PHP, LAMP on Ubuntu 1804
- cannot access the server because the port does not open
- Raspberry Pi 4b Ubuntu19 server installation docker-ce installation steps
- How to set static IP on Ubuntu 1804 Server
- Ubuntu basic settings: installation and use of openssh-server
- Ubuntu1604 build php56 web server environment
- Detailed configuration of wireless network card under Ubuntu Server
- Graphic explanation of Ubuntu's method of building Ftp server (package successfully)
- Ubuntu 1804 server password is forgotten or tampered with
- Tutorial to install Nginx-RTMP streaming server on Ubuntu 14
- about ssh timeout prevention