Install Postgresql and Pgadmin4 in Arch Linux

Ravinder Singh
1 min readAug 17, 2023

--

Step 1 — Install the dependencies

sudo pacman -S postgresql

Step 2 — Setup Postgres service

sudo -u postgres -i # login as postgres
initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data/'
exit
sudo systemctl enable --now postgresql
sudo systemctl status postgresql # to check for any errors

Step 3 — Setup password

psql -U postgres
postgres=# \password # to set password

Install and use pgAdmin4

Step 1: Make the essential directories

sudo mkdir /var/lib/pgadmin

sudo mkdir /var/log/pgadmin

Step 2: Change the owner of the files using the commands provided below.

sudo chown $USER /var/lib/pgadmin

sudo chown $USER /var/log/pgadmin

Step 3: Create the Python-based virtual environment by issuing the command written below.

python3 -m venv pgadmin4

Activate the environment with the help of the command written below.

source pgadmin4/bin/activate

Step 4: Now run the following command to install pgAdmin4

pip install pgadmin4

Step 5: Open pgadmin

pgadmin4

Step 6: Set the email id or password for login the pagadmin4

email:- admin@admin.com
password:- admin@123

Postgreq Server Configurations

Open up PgAdmin4, click on “Add New Server”, and add the following:

Host: localhost
Port: 5432
Maintenance database: postgres
Username: postgres
Password: <your password>

--

--

Ravinder Singh

👨‍💻 Java Full Stack Developer | Software Engineer | Problem Solver