-
Notifications
You must be signed in to change notification settings - Fork 0
Setting Up PostgreSQL
Anton Shcherbyna edited this page Feb 3, 2018
·
1 revision
PostgreSQL can be installed using YUM.
Get list available packages:
yum list postgresql*Install PostgreSQL 9.6 server:
yum install postgresql96-serverAfter installing the packages, a database needs to be initialized and configured. In the commands below, the value of will vary depending on the version of PostgreSQL used. For PostgreSQL version 9.0 and above, the includes the major.minor version of PostgreSQL, e.g., postgresql-9.4
The PostgreSQL data directory contains all of the data files for the database. The variable PGDATA is used to reference this directory.
The default data directory is:
/var/lib/pgsql/<name>/dataFor example:
/var/lib/pgsql/9.6/dataThe command (only needed once) is to initialize the database in PGDATA.
/usr/pgsql-9.6/bin/postgresql96-setup initdb
```
##### Startup
If you want PostgreSQL to start automatically when the OS starts, do the following:
````javascript
systemctl enable postgresql-9.6.serviceTo control the database service, use:
systemctl enable postgresql-9.6.service
systemctl start postgresql-9.6.serviceTo remove everything:
yum erase postgresql96*