This article describes how to create a PostgreSQL installation that you can use for local testing.
To install PostgreSQL on your virtual machine, follow these steps:
yum install postgresql-server postgresql-contrib
After installation completes, type the following command to initialize PostgreSQL:
To enable password authentication, type the following command:
In the pg_hba.conf file, locate the following lines:
# IPv4 local connections: host all all 127.0.0.1/32 ident # IPv6 local connections: host all all ::1/128 ident
Replace ident with md5 so the lines look as follows:
# IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5
Type the following command to start PostgreSQL:
systemctl start postgresql
To confirm PostgreSQL is running, type the following command:
systemctl status postgresql
You should see Active: active (running) in the output.
To make PostgreSQL start automatically on system boot, type the following command:
systemctl enable postgresql
To confirm that the postgres user is active, type the following command:
su - postgres
As the postgres user, type the following command:
You should see the postgres=# prompt.
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.