ZH cheese: Ubuntu 14.04 installation lamp (linux,apache,mysql,php)

Source: Internet
Author: User

(Linux Operating system,apache Web server,mysql database,php)

0. Introduction of Lamp

Linux+apache+mysql/mariadb+perl/php/python a group of open-source software that is often used to build dynamic Web sites or servers is itself a separate program, but because it is often used together, it has a higher degree of compatibility, Together make up a powerful Web application platform. With the booming of the open source, the three pillars has been developed with the development of Java EE and. NET commercial software, and the software-developed project has a low cost of investment in software and is therefore of concern to the entire IT community. From the website traffic, more than 70% of the traffic is lamp to provide, lamp is the most powerful website solution.

Ubuntu 14.04 has been met with a condition to mention: Linux

1. Step one--installation Apache

We can use the Ubuntu Package Management tool apt to complete this step.

sudo apt-get updatesudoinstall apache2

The sudo command represents the current command that we execute with root privileges. After you enter your password, you start to install it automatically. After the installation is complete, enter the following address in the browser address bar to verify that the installation was successful:

HTTP .//Your IP address

How to view your IP address:

(1) Using the Iproute2 tool:

grep awk ' {print $;} ' sed ' s/\/.*$// '

(2) Third party websites:

Curl http://icanhazip.com

If the installation is successful, you will see the following Web page:

2. Step two--Install MySQL

This step can also be installed using the APT package management tool.

sudo Install mysql-server php5-mysql

During the installation process, you need to set the password of the MySQL "root" user. After installation, we also need to run some additional commands to configure our MySQL environment.

First, tell MySQL to create the database directory structure where it stores the data:

sudo mysql_install_db

Then, run a simple security script to remove some of the dangerous default settings and reduce access to the database:

sudo mysql_secure_installation

During execution, you enter the password of the root user you just set up, and then it asks if you want to change the password, if you don't want to change it, type N, and then enter. After some problems, such as the deletion of sample users and data, prohibit remote root login, MySQL real-time response and other issues, directly hit the right to enter;

Well, now MySQL is ready to install.

3. Step three--Installing PHP

PHP can be used to link to a MySQL database, which can process data for display on a Web page. We use apt tools to install PHP and some useful extensions (Php5-curl,php5-imagick, etc.):

sudo Install php5 libapache2-mod-php5 php5-mcrypt php5-curl php5-imagick php5-cli

If you need additional PHP modules, you can use the command below to see which ones are available:

Apt-cache Search php5-

will see:

Php5-cgi-server-side, html-embedded scripting language (CGI binary) php5 for the php5 scripting Lan GUAGEPHP5 for packages built from the php5 sourcephp5 for php5php5 for PHP5PHP5  for PHP5 Module DEVELOPMENTPHP5  for php5 ...

If you want to see more detailed information about a package:

Apt-cache Show package_name

Currently, if a user accesses a directory on the server, Apache will first find a file named index.html, we modify this setting, let Apache first find a file named index.php, first to root as a text editor to open the Dir.cof file:

sudo nano/etc/apache2/mods-enabled/dir. conf

What we see is something like this:

<ifmodule mod_dir.c>    index.htmlindex.php index.xhtml index.htm</ifmodule >

We just need to put the index.php in front of you:

<ifmodule mod_dir.c>    index.phpindex.html index.cgi index.pl index.xhtml index.htm </IfModule>

When you have finished modifying, press "Ctrl+x" to save.

Then restart Apache Web server:

sudo service apache2 restart
4. Step four--running PHP on the Web server

First we want to create a simple PHP script, for example, called info.php, in order for Apache to find the location of this file correctly, we put it in a directory called "Web root".

In Ubuntu 14.04, "Web root" points to /var/www/html/.

We can create a new script like this:

sudo nano/var/www/html/info. php

In the open blank file, enter:

<? phpphpinfo ();? >

When you are finished, save and close the file.

We enter in the browser address bar:

http:// the IP address of your server /info.php 

Then you see the following page, indicating that the installation was successful:

After the test is successful, it is best to delete the info.php file, because this file will let others see some of your server configuration, enter the following command:

sudo RM /var/www/html/info. php
5. Summary

Now that the lamp has been installed, to develop their own site it!!!

Reference Links:

[1] How to install Linux apache mysql php lamp stack on Ubuntu 14.04, https://www.digitalocean.com/community/tutorials/how-to- install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04

[2] Lamp Baidu Encyclopedia, http://baike.baidu.com/link?url= 4r2ocfvvizjn0ycakznxgdpqbjjyvw8jtzyk3ezls6ma-ozwtoxpgng5adoctcqan8g9sliqofhiwedypjodm_xpm4u17lhusg_hubmkhsw

ZH cheese: Ubuntu 14.04 installation lamp (linux,apache,mysql,php)

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.