UbuntuServer14.04 install LAMP

Source: Internet
Author: User
For many PHP beginners, building a LAMP environment that can be used for production is a must. This article uses javastuserver14.04 as an example to provide a tutorial for building a LAMP environment for your reference. LAMP in this Article refers to: LAMP (Linux + Apache + MySQL + PHP ), that is, using Linux as the operating system, Apache as the Web server, and M

For many PHP beginners, setting up a LAMP environment for production is a must. This document uses Ubuntu Server 14.04 as an example to provide a tutorial for building a LAMP environment, for your reference.

LAMP in this Article refers to: Linux + Apache + MySQL + PHP

Currently, LAMP (Linux + Apache + MySQL + PHP) is the most popular enterprise website construction method in the world. It uses Linux as the operating system, Apache as the Web server, and MySQL as the database, PHP serves as the server-side script interpreter. These four software are open source software that follows GPL. They are secure, stable, fast, and powerful. They can be used to build a fast, stable, and free website system.

1. Update the software source

Sudo apt-get update

2. install Apache

Sudo apt-get install apache2

3. Check whether Apache is successfully installed.

Apache2-v

As shown in the following figure.

4. access the server IP address through a browser. If the Apache welcome page appears, the installation is successful, as shown below:

5. Install PHP5

Sudo apt-get install php5

6. view the PHP5 version.

Php5-v

Indicates that PHP5 has been installed successfully.

7. Check whether the libphp5.so module has been loaded by apache. This module is used by Apache to command the PHP parser to execute PHP code.

Cat/etc/apache2/mod-enabled/php5.load

Indicates that the module has been loaded.

8. install mysql. During the installation process, enter the root user password of the database. after entering the password twice, the installation will continue. Note that this password is not the password of the system root account, instead, the default root password of the database you installed

Sudo apt-get install mysql-server

9. check whether mysql is loaded. so extension. PHP uses this extension link to connect mysql to perform the CURD operation. If no such file or directory is prompted, it indicates that PHP does not install the extension of this database by default. You need to install it on your own.

Cat/etc/php5/mod-available/mysql. ini,

10. If the previous step fails, execute this step to install mysql extension for PHP.

Sudo apt-get install php5-mysql

11. Check whether the extension is successfully installed. Different versions may be stored in different locations.

Cat/etc/php5/mod-available/mysql. ini

The mysql. so extension has been installed successfully.

12. Restart mysql and Apache

Sudo service mysql restart

Sudo service apache2 restart

13. Create a PHP file to test whether the environment has been installed successfully,

Cd/var/www/html

Vim info. php

PHP file content:

Echo mysql_connect ('localhost', 'root', '123 ')? "Success": "fail ";

Echo phpinfo ();

Note that the localhost address must be used as the connection address of the test database. So far, we have not enabled the account service for MySQL remote connection.

14. access the file IP Address/info. php to check whether the connection is successful.

This indicates that the connection is successful. So far, the installation and configuration of PHP, mysql, and Apache have been completed and can work properly.

15. Install common extensions for php

Sudo apt-get install php5-gd curl libcurl3 libcurl3-dev php5-curl

The installation process takes a long time. Please wait;

16. Restart Apache after the installation is complete.

Sudo service apache2 restart

17. Go back to the browser's info. php refresh and check whether the expansion just installed has been loaded. Search for gd, curl, etc. If the installation is successful, you should be able to display the loaded content in phpinfo;

18. If you need to upload or operate files, you need to use the root account for SSH Login. You need to modify the Ubuntu system to allow root users to log on via SSH,

Cd/etc/ssh/

Sudo vim sshd_config

: Set nu

28G

Change PermitRootLogin to yes to save and exit. Restart the SSH service to log in with the root account.

Sudo service ssh restart

19. Install phpmyadmin (it is best to install phpmyadmin to facilitate operations and set the remote Logon account later)

Sudo apt-get install phpmyadmin

During the installation process, you will be prompted to enter the password and so on. After the installation is complete, it will be placed in the/usr/share/phpmyadmin directory by default. To enable web access, you need to establish a soft connection to connect it to the default directory of Apache.

Sudo ln-s/usr/share/phpmyadmin/var/www/html/pma

Here we have established a pma soft connection pointing to the actual PHPmyadmin directory.

20. Access PHPmyadmin directly in the browser and enter the IP address/pma, as shown below:

Enter the user name and password to log on.

21. Enable the mysql remote access permission,

Sudo vim/etc/mysql/my. cnf

Find bind-address, comment it out, save and exit, then log on to phpmyadmin, and create a new user in the permission, as shown below:

Restart the mysql service.

Sudo service mysql restart

This means you can connect to mysql through a remote connection tool such as navicat. So far, a simple LAMP environment has been established successfully.

------------------------------------ Split line ------------------------------------

CentOS 6.5 system installation configuration LAMP (Apache + PHP5 + MySQL) server environment http://www.linuxidc.com/Linux/2014-12/111030.htm

Ubuntu 14.04 configure LAMP + phpMyAdmin PHP (5.5.9) Development Environment http://www.linuxidc.com/Linux/2014-10/107924.htm

Windows 7 hard drive installation Ubuntu 14.10 graphic tutorial http://www.linuxidc.com/Linux/2014-10/108430.htm

Ubuntu 14.10 http://www.linuxidc.com/Linux/2014-10/108402.htm U disk installation

Ubuntu 14.10 official release download http://www.linuxidc.com/Linux/2014-10/108363.htm

How to upgrade Ubuntu 14.04 LTS to Ubuntu 14.10 http://www.linuxidc.com/Linux/2014-10/108381.htm

Ubuntu 14.10 install LAMP service graphic details http://www.linuxidc.com/Linux/2014-12/110082.htm

------------------------------------ Split line ------------------------------------

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-03/115136.htm

Related Article

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.