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.
-
sudo apt-get install apache2
, Installation information is omitted, apache will automatically open after the end of the installation in general. -
systemctl status apache2
Check the status at this time, as shown below, there may be an error:
-
The wrong solution is to modify
/etc/apache2/apache2.conf
the file, add the final one fileServerName localhost:80
(80 is the port number can be modified)
and then restart Apache,systemctl restart apache2
-
Now and then check the status of apache, it should be like this
-
Enter the local browser
localhost
or 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
-
sudo apt-get install mysql-server
, Installation information is omitted, usually after the installation is complete mysql will automatically open. -
It will prompt you to enter the root password, where you normally enter your password on ok
-
systemctl status mysql
To view the current status of mysql, mysql This means that the installation was successful friends, you canmysql -u root -p
enter a look.
3.php installation
-
sudo apt-get install php
, Installation information is omitted. -
php -v
View 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.php
found 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.