

When installing Postgres manually, you will have to specify the version: sudo yum update Update Yum to apply your changes and install PostgreSQL. Install the RPM, as well as the EPEL repositories, which will be used to satisfy dependencies: sudo yum install epel-release Locate the CentOS 7 link for your chosen version and download it to your Linode: wget Select the version you wish to install from the Postgres Yum repositories. This is also the case with systemd units systemctl status postgresql becomes systemctl status postgresql-9.6. For example, /var/lib/pgsql becomes /var/lib/pgsql/9.6. When Postgres is installed using this method, the version number is included in its configuration directories. As of this publication, PostgreSQL 9.6.3 is the most recent version available for CentOS 7, but these steps can be applied to any RPM-based installation. Optional: Configure PostgreSQL to start on boot: sudo systemctl enable postgresqlĪlternatively, you can install the latest version from the Postgres repositories. Initialize your Postgres database and start PostgreSQL: sudo postgresql-setup initdb

To install from the CentOS repositories, simply run: sudo yum install postgresql-server postgresql-contrib Install From the CentOS RepositoriesĪs of this writing, the CentOS 7 repositories ship with PostgreSQL version 9.2.15. Unless otherwise noted, the instructions in subsequent sections of this guide will be compatible with versions installed by either method. If you do not need the latest version, we recommend using the first method to install PostgreSQL from the CentOS repositories. In this section, we’ll cover two different methods for installing PostgreSQL.

If you’re not familiar with the sudo command, visit the Users and Groups guide for more information. Commands that require elevated privileges are prefixed with sudo. This guide is written for a non-root user.
