Install PostgreSQL

In this section you will learn how to install PostgreSQL.

It is recommended to perform the installation using the default values and options. Also, when prompted for a Windows admin password, you can use your Windows password.

  1. Open a command prompt in admin mode.
  2. Launch the installer (postgresql-10.1-2-windows-x64.exe or later version) from the command prompt.
    Note: You should launch the installer from the command prompt only. This will auto-resolve the path to Windows native utilities needed for PostgreSQL to install and work correctly.
  3. Launch the pgAdmin 4 tool (included with the installation), and add one user with full rights:
    1. Expand the Servers node until you have exposed the Login/Group Roles node, as in the following image.


      Figure 1.
    2. Right-click on Login/Group Roles and select Create > Login/Group Role... from the context menu.
      The Login Role dialog box is displayed.
    3. On the General tab in the Name field, type hweuser.
    4. Click on the Definition tab, and in the Password field, type hwe_123.
    5. Click on the Privileges tab and set all fields to Yes.


      Figure 2.
    6. Click the Save button.
      Note: The connection limit should be set at 30.
  4. Using Windows Explorer, locate the pg_hba.conf file and move it to the <PostGres_INSTALLATION_DIR>/data folder to replace the file already there.
  5. Open the Windows Task Manager, Services tab, and locate the postgresql-x64 service.
  6. Restart the postgresql-x64 service by right-clicking on the service name and selecting Restart from the context menu.


    Figure 3.
    Note: This allows all users to connect without authentication.
  7. Reconnect to the server by clicking on the username, hweuser, and selecting Yes when prompted to reconnect.
  8. Optional: If you need to locate the port number for the server connection, click on the name of the server and then click the Properties tab.


    Figure 4.
    The Port number is listed under Connection, as displayed in the image above. Knowing the Port number allows you to share the connection with other users.