ubuntu16 build a LAMP environment

Ready to work:

Installation ubuntu16 virtual machine, you can access the Internet

Update for domestic source (faster download)

1. Install apache

sudo apt-get install apache2

Then open our browser and go about 127.0.0.1, if the content of the following occurs, on behalf of the installation is successful

apache common commands

sudo service apache2 status # status
sudo service apache2 start # open
sudo service apache2 stop # Stop
sudo service apache2 restart # restart

 

2. Install MySql

Because MySql is C / S model, the server and client to install

sudo apt-get install mysql-server mysql-clie

 

Installation will let you enter the database password to enter a total of twice, the password must be consistent

Then test database is installed successfully

MySQL - Version Database Version #
MySQL -u root -p # landing database

mysql frequently used commands (as Command and apache)

sudo service mysql status # status
sudo service mysql start # open
sudo service mysql stop # Stop
sudo service mysql restart # restart

 

3. Install php

ubuntu16 install php version 7.0 is the default, if you need to install the low version to use PPA to install, this is no longer here to say, you can own Baidu

sudo apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0

Text.php can create a file in / var / www / html / directory

Then write the following code in test.php:

<?php phpinfo(); ?>

 Then access the files in the browser, if the following occurs, it means that apache can resolve php file

 

Here our LAMP environment to build a good, little friends can go to enjoy the game!

ps: Do not forget to add a snapshot , beginning with linux when the system is very easy to collapse, this time is very useful snapshot

 

Guess you like

Origin www.cnblogs.com/Excellent-person/p/11625769.html