Using apt to build lamp environment under Ubuntu 16.04 LTS

Source: Internet
Author: User
Tags php and phpmyadmin
using apt to build lamp environment under Ubuntu 16.04 LTS



Introduction

First of all, this program is not in the other version of Ubuntu 16.04, but the problem should be small, suitable for beginners to build the environment. Through apt download software Please make sure that your source is configured correctly or otherwise prone to problems.



Update Source

Get a list of the most recent packages that contain information about the package, such as whether the package has been updated. Make sure the following command is complete and there are no errors (this is important, and this error follows).
sudo apt update
sudo apt upgrade



Install Apache2

sudo apt install apache2



Start Apache2

Sudo/etc/init.d/apache2 Start (start)
Sudo/etc/init.d/apache2 Restart (reboot)
Sudo/etc/init.d/apache2 Stop (OFF)

Enter http://localhost or http://127.0.0.1 in the browser, if you see it works! That explains the successful installation of Apache2, Apache's default installation of the site root directory in/var/www/html, of course, can be modified via Apache configuration file.



Installing PHP and APACHE2 support

sudo apt install libapache2-mod-php5 php5
sudo apt install php5-gd php5-mysql (other extension)

Restart the Apache service after installation:
Sudo/etc/init.d/apache2 Restart (reboot)
Write a test.php under/var/www/html to test, everyone should be from window, this is not much to say.



installing the MySQL database

sudo apt install mysql-server

You need to set the password for the database root user (two times) during installation.



Installing PHPMYADMIN-MYSQL database management

sudo apt install phpmyadmin

You need to enter the access password for the root user you just set up during the installation process. Then the phpMyAdmin is connected to the Apache2, the default URL root is/var/www/html,phpmyadmin in the/usr/share/phpmyadmin directory, so use the command:

sudo ln-s/usr/share/phpmyadmin/var/www/html

Enter Http://localhost/phpmyadmin or http://127.0.0.1/phpmyadmin in the browser. Well, it's a familiar taste.



set Ubuntu file to perform read and write permissions

sudo chmod 777/var/www/html

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.