Learn Ansible
上QQ阅读APP看书,第一时间看更新

LAMP stack

The LAMP stack is the term used to describe an all-in-one web and database server. Typically, the components are:

  • Linux: The underlying operating system; in our case, we will be using CentOS 7.
  • Apache: The web server element of the stack.
  • MariaDB: The database component of the stack; typically, it is MySQL-based. As CentOS 7 ships with MariaDB, we will be using that rather than PHP.
  • PHP: The dynamic language used by the web server to generate content.

There is also a common variation of the LAMP stack called LEMP; this replaces Apache with NGINX, which is pronounced engine-x, hence the E rather than N.

We are going to be looking at creating roles to deal with these components; these are:

  • common: This role will prepare our CentOS server, installing any supporting packages and services we need
  • apache: This role will install the Apache web server and also configure a default virtual host
  • mariadb: This role will not only install MariaDB, but it will also secure the installation and create a default database and user
  • php: This role will install PHP, a set of common PHP modules, and also Composer, which is a package manager for PHP

Let's make a start on getting the basics ready by writing the common role.