10.3 PostgreSQL on Linux

IMPORTANT:The steps in this section are optimized for installing PostgreSQL on SUSE Linux Enterprise Server (SLES) 12 or 15.

For information regarding the installation of PostgreSQL on other versions of SLES or other flavors of Linux, see the PostgreSQL and the SUSE documentation on the web.

10.3.1 Installing PostgreSQL and Setting the postgres User Password

  1. Ensure you have access to your operating system installation media.

  2. In YaST, click Software > Software Management.

  3. In the Search field, type postgresql, then click Search.

  4. Select the following packages:

    • postgresql10

    • libecpg6

    • postgresql-jdbc (if available)

    • The client packages, if not automatically added with the server packages.

  5. Click Accept.

  6. If needed, click Continue to resolve dependencies.

  7. Click Continue to acknowledge package support status.

    PostgreSQL is then installed from the SLES media.

  8. Click Finish.

  9. In YaST, click System > Services Manager.

  10. Scroll to and select postgresql, then click Enable/Disable > Start/Stop > OK.

  11. After the configuration is updated, close YaST and open a terminal prompt.

  12. Set a password for the database administrator (postgres system user) by entering the following commands:

    su - postgres
    \password postgres


    Under Database Credentials on the Single-server Installation Planning Worksheet, record the postgres administrator password. If you want to use a password other than postgres you must modify the postgresql-create-empty-database.sql file. See the PostgreSQL documentation on the web for help.

  13. Continue with Configuring the Socket Connection Method.

10.3.2 Configuring the Socket Connection Method

  1. As the root user, browse to /var/lib/pgsql/data.

  2. Edit the pg_hba.conf file and change the following local and host lines to specify md5 encryption, as follows:

    local  all   all                  md5
    host   all   all   md5
    host   all   all   ::1/128        md5
    host   all   all      md5

    For more information about the pg_hba.conf file, see the PostgreSQL documentation on the web.

  3. Save the file.

  4. Edit the postgresql.conf file.

  5. Uncomment the listen_addresses line by removing the pound sign (#).

  6. Change ‘localhost’ to ‘*’.

  7. Save and close the file.

  8. In YaST, click System > Services Manager.

  9. Scroll to and select postgresql, then click Start/Stop > OK to stop PostgreSQL.

  10. Repeat from Step 8 to restart PostgreSQL, then close YaST.

  11. Continue with Securing PostgreSQL and Vibe Communications

10.3.3 Learning More about PostgreSQL

If you want to administer PostgreSQL through a GUI interface, you can download tools from:

Community Guide to PostgreSQL GUI Tools

For more information about PostgreSQL, see:

The PostgreSQL Wiki