Friday, December 29, 2017

Quick Notes : Installing PgAdmin4 on ubuntu 17.04 as Service

On Ubuntu 17.04 Linux Terminal

Switch to Home Directory of non-super user
    cd $HOME

Install dependencies for python virtual environment

    sudo apt-get install virtualenv python-pip libpq-dev python-dev

Create Virtual environment
    virtualenv pgadmin4

Switch to base folder of virtual environment
    cd pgadmin4

Activate Virtual environment   
    source bin/activate

Download wheel for pgAdmin4

Install Wheel
    pip install pgadmin4-2.0-py2.py3-none-any.wh

Location of executable is bit confusing,its in /usr/local/lib/python2.7/dist-packages/pgadmin4

running in Desktop Mode (optional):

    locate server setting section inside it there will be text as follows

        if builtins.SERVER_MODE is None:
            SERVER_MODE = True
            SERVER_MODE = builtins.SERVER_MODE

     just below it set
        SERVER_MODE = False

Now run pgAdmin4 as follows
    python /usr/local/lib/python2.7/dist-packages/pgadmin4/

    it will ask for creating pgadmin4 username & password.

PgAdmin4 run on http://localhost:5050 where you can login using just provided login details.
Add your postgres server by right clicking on server new.

Creating service for PgAdmin4

create a file at /etc/systemd/system/pgadmin4.service

add following content into it,Here
/home/sangram/pgAdmin4/pgAdmin4 is path to my python virtual environment.

Description=Pgadmin4 Service




Now start newly created service as

        sudo systemctl start pgadmin4 

to make service autostart 

         sudo systemctl enable pgadmin4

you can check service status by 

         sudo systemctl status pgadmin4

Now we can check if localhost:5050/ for pgAdmin4.


No comments:

Post a Comment