HugeServer Knowledgebase

How to install LAPP Stack (Apache 2.4, PostgreSQL 9.2, PHP 7.0) on CentOS 7

Introduction

LAPP is short for Apache, PostgreSQL, and PHP, it’s a software stack that powered many servers these days. it’s pretty much like LAMP stack but in LAPP we are using PostgreSQL as the database which is a powerful, open source object-relational database system. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability, and data integrity. It has full support for foreign keys, joins, views, and triggers. PostgreSQL also supports storage of large objects, including pictures, sounds, or video.

Apache PHP PostgreSQL

We are assuming that you have root permission, otherwise, you may start commands with “sudo”.

Install Apache

You can easily install Apache from the official repository with the command below:

yum install httpd

After installation execute the following commands to start your Apache service and make it run at startup:

systemctl start httpd

systemctl enable httpd

Install PHP 7

PHP 7 is not provided by the official repository, but you can install it from “Webtatic”.

For adding “Webtatic” repo you need to install “EPEL” first:

yum install epel-release

Then you can execute the following command to add the Webtatic repository as well:

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Now you can install PHP 7 and the PostgreSQL extension with the following command:

yum install php70w php70w-pgsql

Install PostgreSQL

You can easily install PostgreSQL from the base repository with the following command:

yum install postgresql-server postgresql-contrib

After the installation process is finished, you have to initialize the PostgreSQL with the command below:

postgresql-setup initdb

Now you can go ahead and start PostgreSQL service and make it run at startup:

systemctl start postgresql

systemctl enable postgresql

PostgreSQL initial configurations

PostgreSQL has its own command line shell that you can use it by logging into the “postgres” user.

The “postgres” user is not password protected by default, it’s highly recommended to set a strong password so you can restrict the open access to it.

issue the following command will prompt you to set and verify a password for the “postgres” user:

passwd postgres

Now you have to login to postgres user with the following command: (If you didn’t prompt for password it’s ok because you probably using root user for login)

su - postgres

Now you are in a new environment with a $ at the end like below:

-bash-4.2$

issue the following command to enter the PostgreSQL command line immediately:

$ psql

If you are not familiar with the configuring commands you can execute the following command to see the help:

\h

After you have configured your Database you can back to the main shell with the following command:

\q

That’s it you have successfully installed and configured a LAPP Stack.
&nbps;
For more information and news you can visit PosgreSQL official website!

Was this tutorial helpful?

Thank you for your vote.Thank you for your vote.

Similar Posts

One thought on “How to install LAPP Stack (Apache 2.4, PostgreSQL 9.2, PHP 7.0) on CentOS 7”

Leave a Reply

Your email address will not be published. Required fields are marked *

*