How to install PostgreSQL and pgAdmin4 on Ubuntu 18.04


1. Install PostgreSQL
$ sudo apt update
$ sudo apt install postgresql postgresql-contrib

2. Update password for postpres user
$ sudo -u postgres psql
postgres=# ALTER USER user_name WITH PASSWORD 'new_password';
postgres=# \q

3. Install Python PIP for Ubuntu
$ sudo apt update
$ sudo apt install python3-pip

4. Get the PgAdmin 4 Python Installer at
https://www.pgadmin.org/download/pgadmin-4-python-wheel

5. Install pgAdmin4
$ pip install ~/Downloads/pgadmin4*.whl

Or for a System wide installation:

$ sudo pip install ~/Downloads/pgadmin4*.whl

6. Locate PgAdmin 4 Script
$ sudo updatedb
$ locate pgAdmin4.py

Copy the path displayed from above command. I call it PATH/pgAdmin4.py from now

7. Create config_local.py file for pgAdmin4 local config, add content and save it
$ vim PATH/config_local.py

import os
SERVER_MODE = False
DATA_DIR = os.path.realpath(os.path.expanduser(u'~/.pgadmin/'))
LOG_FILE = os.path.join(DATA_DIR, 'pgadmin4.log')
SQLITE_PATH = os.path.join(DATA_DIR, 'pgadmin4.db')
SESSION_DB_PATH = os.path.join(DATA_DIR, 'sessions')
STORAGE_DIR = os.path.join(DATA_DIR, 'storage')

8. Run pgAdmin4 via command
python PATH/pgAdmin4.py

9. Set startup command for pgAdmin4 if you want
# vim ~/.bashrc

Append custom command to startup pgAdmin4:
$  python PATH/pgAdmin4.py

10. Visit browser at http://127.0.0.1:5050 to enjoy pgAdmin4


Reference Link :http://khoahtx.blogspot.com/2018/05/how-to-install-postgresql-and-pgadmin4.html

Comments

Popular posts from this blog

Elixir Ecto - My Notes

Phoenix Channels