We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How to Install pgAdmin4 on FreeBSD 12

Learn how to – How to Install pgAdmin4 on FreeBSD 12.

pgAdmin is the leading Open Source feature-rich PostgreSQL administration and development platform that runs on Linux, Unix, Mac OS X, and Windows. It provides a powerful GUI which ease your Database management and operations.

pgAdmin allows you to manage PostgreSQL 9.2 and above. As of this writing, the latest release of pgAdmin is v4 which had migration from Bootstrap 3 to Bootstrap 4.

Setup Pre-requisites

As a pre-requisite, you need to have:

  • FreeBSD server
  • PostgreSQL server installed
  • User account with sudo privileges

Step 1: Install PostgreSQL database server

For the installation of PostgreSQL database server, refer to our previous guide:

Step 2: Update FreeBSD system

In my setup, I’m installing pgAdmin on the same server running PostgreSQL. But you have an option of setting it up on a different server.

First update the FreeBSD Repository Database.

freebsd-update fetch
freebsd-update install

Step 3: Install Python pip & Virtualenv

Create Python 3.8 symbolic link to /usr/local/bin/python.

sudo ln -s /usr/local/bin/python3.8 /usr/local/bin/python

pip is required for installing Python packages. Install it on your FreeBSD server by following below guide.

Summarized Python setup:

sudo pkg install py38-pip
sudo pip install --upgrade pip
sudo pkg install py38-virtualenv

Step 4: Install pgAdmin packages

Create a virtual environment for pgAdmin4 by running:

$ sudo virtualenv-3.8 pgadmin4
Using base prefix '/usr/local'
New python executable in /root/pgadmin4/bin/python3.8
Also creating executable in /root/pgadmin4/bin/python
Installing setuptools, pip, wheel...

Activate the Virtual environment created:

source pgadmin4/bin/activate

If it fails, use:

source pgadmin4/bin/activate.csh

Install Python dependencies for pgAdmin:

sudo pip install cryptography==3.1.1 pyopenssl ndg-httpsclient pyasn1 simple-websocket

Then install the standard Python binding to the SQLite3 library. For python 3.8, run:

sudo pkg install py38-sqlite3

For Python 2.7, use:

sudo pkg install py27-sqlite3

Check for the latest release of pgAdmin4 before downloading. Once you get the path to latest release, install it with the pip command.

sudo pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v6.9/pip/pgadmin4-6.9-py3-none-any.whl

This installation may take some time as a number of dependencies are installed, so be patient.

When done create data directories for pgAdmin4

sudo mkdir -p /var/lib/pgadmin /var/log/pgadmin
sudo chmod 770 /var/lib/pgadmin /var/log/pgadmin

Step 5: Configure and run pgAdmin 4

After the installation, configuration file should be created for pgAdmin 4.

cp ./pgadmin4/lib/python3.6/site-packages/pgadmin4/config.py ./pgadmin4/lib/python3.6/site-packages/pgadmin4/config_local.py

For Python 2.7, replace python3.6 with python2.7

Change the default server Listen address on to

vim ./pgadmin4/lib/python3.6/site-packages/pgadmin4/config_local.py

This is around line 138


The default listen port is 5050 but you can change it to your desired port.

The default port on which the app server will listen if not set in the environment by the runtime

Use following command to run pgAdmin.

$ sudo python ./pgadmin4/lib/python3.8/site-packages/pgadmin4/pgAdmin4.py
NOTE: Configuring authentication for SERVER mode.
Enter the email address and password to use for the initial pgAdmin user account:
Email address: admin@example.com
Password: <Enter Password>
Retype password: <Confirm Password>
pgAdmin 4 - Application Initialisation
Starting pgAdmin 4. Please navigate to in your browser.

The first run will ask you to Enter the email address and the password to use for the pgAdmin user account.

Step 6: Access pgAdmin Web Interface

Now that we have pgAdmin4 installed and running, you can access its web dashboard by visiting the URL “http://your_server_ip:5050“.

Login with created user email address and password. After login, you’ll need to connect to your PostgreSQL server.

Enter server connection name and group.

Under “Connection” tab, provide access details – DB host, DB user and Password.

Save the settings to activate your connection.

You can now enjoy using pgAdmin for your PostgreSQL database management tasks.

If you’re a MariaDB user, check:


Your Cart is Empty

Back To Shop