Jump toUpdate content
Managing a PostgreSQL Database Instance with pgAdmin 4
pgAdmin is an open-source management tool for PostgreSQL databases. It allows the management of your Scaleway Elements Database Instances and other PostgreSQL databases through an easy-to-use web-interface within your web browser.
Connect to your instance via SSH.
aptsources and the software already installed on the instance:
apt update && apt upgrade -y
Import the PostgreSQL repository key:
sudo apt-get install curl ca-certificates gnupgcurl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
Add the PostgreSQL repository to the APT packet manager, by configuring the file
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
aptsources and install pgAdmin 4 via the
aptpacket-manager. The following command will install the packages
pgadmin4-apache2providing an Apache web server configured for pgAdmin:
apt-get update && apt-get install pgadmin4 pgadmin4-apache2 -y
During the installation, you are prompted to enter the email address of the first user for pgAdmin. Enter your email address and press Enter:
The installation tool asks for a password for the pgAdmin user. Enter it and press Enter:The basic installation of pgAdmin is complete now.
By default, connections to the application are being made using an insecure HTTP connection. It is recommended to configure a HTTPS connection to encrypt the traffic between your instance and your computer. To do so, you should setup an A-Record within your domain name and install Certbot to obtain a free Let’s Encrypt TSL/SSL certificate:
Install Certbot and the Apache web server plugin:
sudo apt-get install certbot python-certbot-apache
Run Certbot to obtain a certificate and configure the Apache web server automatically:
sudo certbot --apache
Once installed, proceed to the configuration of pgAdmin with your Scaleway Database Instance.
Open your web browser and point it to
http://<your_instance_ip>/pgadmin4/, or if installed with HTTPS
https://<your_domain_name>/pgadmin4/. The pgAdmin login page displays:
Enter the username and password configured during the installation and click Login
The pgAdmin dashboard displays, to connect the application with your Scaleway Elements Database Instance, click Add New Server:
Specify the general information of the Database Instance:
- Name: Enter a name of your choice for the Database Instance
- Server group: If you are managing multiple Database Instances, you can create server groups to make the management easier.
- Background: You can configure a background color for the instance
- Foreground: You can set a foreground color for the instance
- Connect now: Tick this box to connect to the instance once the configuration is completed
- Comments: You may add additional comments to the instance
Click the Connection tab of the create server window and enter the connection details of your Database Instance:
- Host name/address: Enter the IP address of your Database Instance, displayed on the database information page of your instance.
- Port: Enter the port of your Database Instance. This information is available from the database information page of your instance.
- Maintenance database: Enter the information of your default database here. With default configuration this value shall be
- Username: Enter the username for your database. You can find this information in the users tab of your Database Instance in the Scaleway console.
- Save Password: Tick this box to save your database password in pgAdmin
Click the SSL panel and upload the SSL certificate available from the database information page of your Scaleway Console. By default pgAdmin will negociate a SSL connection without checking the CA (this is the postgresql behaviour). With this option, we add a layer of security by checking the certificate authority (CA) used to sign the certificate and make sure this is the same as the one on the server.
- SSL mode: Set the SSL mode value to
Verify-CAto use the certificate issued by Scaleway
- Client certificate: Keep this value empty
- Client certificate key: Keep this value empty
- Root certificate: Click
...to upload the SSL certificate available from your Scaleway console.
- SSL mode: Set the SSL mode value to
Once all settings are made, click Save to update the configuration of pgAdmin and to establish a connection to your Database Instance.
The Dashboard displays and your Database Instance is listed in the servers section of pgAdmin:
You can now manage your Database Instance from a visual interface. For more information using pgAdmin, you may follow the official documentation.