Skip to main content
This article describes how to create a PostgreSQL installation that you can use for local testing.
ImportantThe following procedures assume that you have already created a virtual machine running AlmaLinux on your local computer. For information about how to do this, please see this article.

Installing PostgreSQL

To install PostgreSQL on your virtual machine, follow these steps:
  1. Start the virtual machine, if you haven’t already.
  2. Log in to the virtual machine as the root user.
  3. At the command prompt, type the following command to install PostgreSQL:
  4. At the Is this ok prompt, type y and then press Enter. The installation process begins.
  5. After installation completes, type the following command to initialize PostgreSQL:
  6. To enable password authentication, type the following command:
  7. In the pg_hba.conf file, locate the following lines:
  8. Replace ident with md5 so the lines look as follows:
  9. Type :wq to save your changes and exit the editor.
  10. Type the following command to start PostgreSQL:
  11. To confirm PostgreSQL is running, type the following command:
    You should see Active: active (running) in the output.
  12. To make PostgreSQL start automatically on system boot, type the following command:
  13. To confirm that the postgres user is active, type the following command:
  14. As the postgres user, type the following command:
    You should see the postgres=# prompt.
    👍 Tip Now that you have installed PostgreSQL, you are ready to configure it. For information about how to set up PostgreSQL databases, users, and more, please see the Related Articles section below.