Install Lemp stack (linux+nginx+mysql+php) with Apt-get in Ubuntu

Source: Internet
Author: User
Tags fpm install php percona percona server

Install lamp on Ubuntu Everyone should be familiar with, but for the current very popular lemp stack how to install with Apt-get, so the article is not much to introduce. Below I use Ubuntu 12.04 LTS As an example to explain how to apt-get install these.

Why use Apt-get to install without compiling

With package management In addition to the convenience of a unified management software, he can help you get started scripts, Automatic Updates and so a lot of trouble problems. In fact, most people use the compiler installation, is also used by default compilation parameters, most of the customized things can be done through the configuration file. If you are more customized to build, you can even make a private source to put your own compiled packages.

Preparatory work

Ubuntu installation and some routine preparations, I won't repeat

Update your PHP source

Ubuntu 12.04 default source inside the PHP version is older, my impression seems to be 5.3.9, now 5.6 is fast release, many new features are actually very useful, so I suggest you upgrade to 5.5 of the latest version. We need to add a private source to install the latest PHP, execute the following command

sudo add-apt-repository ppa:ondrej/php5

If you are prompted not to find the add-apt-repository command, you need to perform the following command to install

sudo apt-get install python-software-properties

After the installation, execute the above command again to add this source, do not forget to add

sudo apt-get update
Add Percona Source

Percona is a very well-known branch of MySQL, and since MySQL is now controlled by Oracle, many of the very useful features are intentionally not added, so there are a lot of MySQL-based branches. Where Percona server is the most famous one, many large companies are in use, very stable, and it is fully compatible with the MySQL protocol

First add aapt-key


Then edit your /etc/apt/sources.list file, add the two sources at the end (Percise is the Ubuntu 12.04 code name, you can modify according to your own needs)

deb precise maindeb-src precise main

Don't forget when you're done adding.

sudo apt-get update

Well, in fact you have to do all the preparation work is so much, with the apt-get installation is so convenient.

Start installation

The following installation procedures are not ordered

Install PHP
sudo apt-get install php5-fpm php5-cli php5-dev php5-mysql php5-curl php5-imagick

Besides php5-fpm php5-cli php5-dev , the other modules are matched according to my needs, and you can revise them according to your own needs.

Installing MySQL (Percona Server)

If you want to install MySQL, you can do it.

sudo apt-get install mysql-server

But I generally recommend the installation of Percona Server, the use of no different

sudo apt-get install percona-server-server-5.6
Installing Nginx
sudo apt-get install nginx
Installation Complete

Now that all the software has been installed, you can find the configuration files of these software in the '/etc ' directory for unified configuration. And it can be used sudo apt-get upgrade to update it.

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: 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.