Installation and configuration environment Ubuntu16.04 LAMP

Installation and configuration environment Ubuntu16.04 LAMP

Recent experiments will need to be a shooting range Ubuntu environment, we introduce LAMP installation and configuration under Ubuntu environment here, did not talk much, we gkd!

1.Apache2 installation

First make sure the machine has been carried out sudo apt-get update && sudo apt-get upgrade, if slow, please change the source, I use here is the Tsinghua source.

  1. sudo apt-get install apache2, Installation information is omitted, apache will automatically open after the end of the installation in general.

  2. systemctl status apache2Check the status at this time, as shown below, there may be an error:

  3. The wrong solution is to modify /etc/apache2/apache2.confthe file, add the final one file ServerName localhost:80(80 is the port number can be modified)
    and then restart Apache,systemctl restart apache2

  4. Now and then check the status of apache, it should be like this

  5. Enter the local browser localhostor outside the network to access the IP address of the machine, should appear the following interface, which means that the installation was successful it! ! ! !

2.Mysql installation

  1. sudo apt-get install mysql-server, Installation information is omitted, usually after the installation is complete mysql will automatically open.

  2. It will prompt you to enter the root password, where you normally enter your password on ok

  3. systemctl status mysqlTo view the current status of mysql, mysql This means that the installation was successful friends, you can mysql -u root -penter a look.

3.php installation

  1. sudo apt-get install php, Installation information is omitted.

  2. php -vView the current version of php, if the results are shown below appears, indicating the correct installation

4. Finally

Until now, the configuration of the success of the LAMP environment, but there are some other operation, if you want Apache php interface is now available, that is, change its default home page, etc. operations, note that there is a problem
if a similar input localhost/index.phpfound output are blank, no error log, also proved php installed and running properly, you can try entering the following command
sudo apt-get install libapache2-mod-php, and then restart the apache2, so php can be a normal show.

Guess you like

Origin www.cnblogs.com/wangyanzhong123/p/12571792.html