This article will go through how to install pgAdmin on FreeBSD 13. PGAdmin is a web and desktop graphical user interface used to manage local and remote administrative tasks for a Postgres database.
Install PostgreSQL on FreeBSD 13
How to Install pgAdmin on FreeBSD 13
- Let’s start by creating Python 3.9 Symbolic link using the command below.
sudo ln -s /usr/local/bin/python3.9 /usr/local/bin/python
- Then install pip package manager using the following command.
sudo pkg install py39-pip
- Upgrade pip command.
sudo pip install --upgrade pip
- Next, Install the package for virtualenv using the command below.
sudo pkg install py39-virtualenv
- After installing, run the following command to create a virtual environment for pgAdmin4.
virtualenv pgadmin4
- Then activate the environment.
source pgadmin4/bin/activate.csh
- Next, Install Python dependencies required by pgAdmin4.
sudo pip install cryptography==3.1.1 pyopenssl ndg-httpsclient pyasn1 simple-websocket
- Run the command below to install Python SQLite3 package.
sudo pkg install py39-sqlite3
- Navigate to the pgAdmin download page and get the latest link then download and install using the pip command below.
sudo pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v6.9/pip/pgadmin4-6.9-py3-none-any.whl
- After the installation, create directories for data and give permissions.
sudo mkdir -pv /var/lib/pgadmin
sudo chmod 770 /var/lib/pgadmin
sudo mkdir -pv /var/log/pgadmin
sudo chmod 770 /var/log/pgadmin
- Edit pgAdmin config by adding server IP, let’s start by copying the pgAdmin configuration file.
sudo cp ./pgadmin4/lib/python3.9/site-packages/pgadmin4/config.py ./pgadmin4/lib/python3.9/site-packages/pgadmin4/config_local.py
- Then open the config file.
sudo nano ./pgadmin4/lib/python3.9/site-packages/pgadmin4/config_local.py
- Edit it by replacing 127.0.0.1 with 0.0.0.0 on DEFAULT_SERVER = ‘127.0.0.1’
DEFAULT_SERVER = '0.0.0.0'
Run pgAdmin4 on FreeBSD 13
- Use the command below to run pgAmin4. You will be prompted to enter the email address and password used to log in.
sudo python pgadmin4/lib/python3.9/site-packages/pgadmin4/pgAdmin4.py
- Next, open your browser and enter your FreeBSD IP followed by port 5050 e.g.
192.168.26.145:5050
to login
- You will be redirected to the dashboard, to connect to your database click on Add New Server as shown below.
- Then name your database server.
- On the connection tab, enter your hostname and database details e.g. username and password.
- You will be able to manage your database after connecting to your database.
- You have made it to the end of our article on how to install pgAdmin on FreeBSD 13.
Read more on pgAdmin Documentation