Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Configuring PostgreSQL on CentOS

PostgreSQL is the world's most advanced open source database. Its stability, functionality, and extensibility make it a primary choice for an RDBMS solution. In this hands-on lab scenario you are the DBA for Awesome Company. You have been tasked with building a PostgreSQL database backend to facilitate the development of a new web application. You have already installed the database software and are now ready to configure it to your company's standards. Performing the configuration tasks of this lab will help you become acquainted with administering permissions via roles, enabling remote connections, and setting server-level options.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 30m
Published
Clock icon Mar 20, 2020

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Administer Permissions via Roles

    1. Change to the postgres user and launch psql.
    2. Give the postgres role a password (enter and confirm).
    3. Create a database for the web application.
    4. Connect to the new database.
    5. Create a role for the web application.
    6. Give the acwebapp role a password (enter and confirm).
  2. Challenge

    Enable Remote Connections

    1. Exit back to cloud_user, and edit postgresql.conf to listen on any address.
    2. Search for listen_addresses, uncomment it, and set it to *. Save and quit.
    3. Edit pg_hba.conf file.
    4. Append a line to the bottom of the file that will enable remote connections.
    5. Save and exit.
    6. Restart the PostgreSQL service.
  3. Challenge

    Set Server-Level Options

    1. Edit the postgresql.conf file.
    2. Find the port setting under CONNECTIONS AND AUTHENTICATION, uncomment it, and change the value to 1433.
    3. Below that, change max_connections to 500.
    4. Find the shared_buffers setting under - Memory - and change the value to 256MB.
    5. Save and exit, then restart the PostgreSQL service.
  4. Challenge

    Test Changes

    1. Using an external client of your choosing, connect to the acweb database as acwebapp. (For the purposes of this example we will use pgAdmin, found at https://www.pgadmin.org.)
    2. Right-click Servers, go to Create, and click on Server.
    3. Provide a name for the server connection.
    4. On the Connection tab, enter the following information:
      • Hostname/address: The public IP address of your lab server
      • Port: 1433
      • Username: acwebapp
      • Password: The password you set for acwebapp earlier
    5. Click Save.
    6. If it connects, you have successfully enabled remote connections and provisioned a role for the web application.
    7. Right-click on a database and click Query Tool. Verify values for all the settings that were changed.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans