PgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL database.
PgAdmin is the leading graphical Open Source management, development and administration tool for PostgreSQL.
In this tutorial, we are going to show you How to install PgAdmin 4 in Server Mode on Ubuntu 16.04 LTS.
If you didn’t yet install PostgreSQL take a look the below links :
- How to Install PostgreSQL on Ubuntu 16.04 LTS
- How To Install PostgreSQL 9.6 on CentOS 7 / RHEL 7
- How To Change PostgreSQL Data Directory Location on Ubuntu 16.04
- How To Enable Network Remote Access To PostgreSQL Database Server
- How to install pgAdmin 4 in desktop mode on Ubuntu 16.04 LTS
- How to install pgAdmin 4 in Server mode as web application on CentOS 7 / RHEL 7
- How to install PgAdmin 4 in Server Mode as a Web Application using WSGI on Ubuntu 18.04 LTS / Ubuntu 16.04 LTS
Step 1. Install Dependencies Packages
# sudo apt-get install build-essential libssl-dev libffi-dev libgmp3-dev virtualenv python-pip libpq-dev python-dev
Step 2. Create the virtual environment
– Create the virtual enviroment:
# virtualenv .pgadmin4
– Activate the virtual enviroment:
# cd .pgadmin4 # source bin/activate
Step 3. Download and install PGAdmin 4
– The only way to install PgAdmin 4 is to download the PgAdmin Python wheel, use the following command to download PgAdmin Python wheel:
# wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v1.6/pip/pgadmin4-1.6-py2.py3-none-any.whl
– Install PgAdmin 4 using the following command:
# pip install pgadmin4-1.6-py2.py3-none-any.whl
Step 4. Configure and Run PGAdmin 4
– Once you finished with the installation, open the Config.py file and change DEFAULT_SERVER parameter from loopback address to 0.0.0.0 to make PgAdmin 4 accessed from everywhere in the network.
# vi lib/python2.7/site-packages/pgadmin4/config.py
[...]
DEFAULT_SERVER = '0.0.0.0'
[...]
– Once you finished the configuration, use the following command to setup PgAdmin 4:
# python lib/python2.7/site-packages/pgadmin4/setup.py . Enter the email address and password to use for the initial pgAdmin user account: Email address: [email protected]
you will prompt it to add an email address and a password to access PGAdmin 4
Step 5. Run PGAdmin 4 as a Service
– Before we start let’s exit the virtual enviroment using the follwoing command:
# deactivate
– To make PgAdmin 4 we need to make some extra modification, Open the pgAdmin4.py file and insert the following line in the begin of the file:
# vi lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
#!/usr/bin/env python
[...]
– Make it executable by doing:
# chmod +x lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
– Now create a /etc/systemd/system/pgadmin4.service service file containing:
# vi /etc/systemd/system/pgadmin4.service [Unit] Description=Pgadmin4 Service After=network.target [Service] User= root Group= root # Point to the virtual environment directory WorkingDirectory=/root/.pgadmin4 # Point to the bin folder of your virtual environment Environment="PATH=/root/.pgadmin4/bin" ExecStart="/root/.pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py" PrivateTmp=true [Install] WantedBy=multi-user.target
– Enable and start PgAdmin Service at system boot:
# sudo systemctl daemon-reload # sudo systemctl enable pgadmin4 # sudo systemctl start pgadmin4 # sudo systemctl status pgadmin4
Step 6. Access PGAdmin 4
– Open http://Server_ip:5050 and logon to the PgAdmin using your credentials.
We hope this tutorial was enough Helpful. If you need more information, or have any questions, just comment below and we will be glad to assist you!
70 comments
Hi Lotfi !
Thanks a lot for your tutorial.
I tried installing on Ubuntu 16.04, I can access pgadmin4 in my browser on 127.0.0.1:5050 or from another computer of LAN with the IP of the server machine, but I was unable to perform the 5th step. When I try to check the status, I get the following error (from last log of start trial I assume) :
_________________________________________________________________________________________________________________________
erik@trano-U:/etc/systemd/system$ sudo systemctl status pgadmin4
● pgadmin4.service – Pgadmin4 Service
Loaded: loaded (/etc/systemd/system/pgadmin4.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since dim. 2017-08-13 00:30:32 RET; 15s ago
Process: 1550 ExecStart=/home/erik/bin/.pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py (code=exited, status=1/FAILURE)
Main PID: 1550 (code=exited, status=1/FAILURE)
août 13 00:30:32 trano-U pgAdmin4.py[1550]: File “/home/erik/bin/.pgadmin4/local/lib/python2.7/site-packages/alembic/runtime/migration.py”, line 330, in run_migrations
août 13 00:30:32 trano-U pgAdmin4.py[1550]: step.migration_fn(**kw)
août 13 00:30:32 trano-U pgAdmin4.py[1550]: File “/home/erik/bin/.pgadmin4/lib/python2.7/site-packages/pgadmin4/migrations/versions/fdc58d9bd449_.py”, line 41, in upgrade
août 13 00:30:32 trano-U pgAdmin4.py[1550]: if get_version() != -1:
août 13 00:30:32 trano-U pgAdmin4.py[1550]: File “/home/erik/bin/.pgadmin4/lib/python2.7/site-packages/pgadmin4/pgadmin/setup/db_version.py”, line 21, in get_version
août 13 00:30:32 trano-U pgAdmin4.py[1550]: if int(version.value) > int(config.SETTINGS_SCHEMA_VERSION):
août 13 00:30:32 trano-U pgAdmin4.py[1550]: AttributeError: ‘NoneType’ object has no attribute ‘value’
août 13 00:30:32 trano-U systemd[1]: pgadmin4.service: Main process exited, code=exited, status=1/FAILURE
août 13 00:30:32 trano-U systemd[1]: pgadmin4.service: Unit entered failed state.
août 13 00:30:32 trano-U systemd[1]: pgadmin4.service: Failed with result ‘exit-code’.
_________________________________________________________________________________________________________________________
I had a look on the python module “db_version.py” where the object “version” is regularly declared as an instance of Version class (imported) to which the attribute “value” actually belongs, and my skills can’t drive me further on…
I noticed that it was a kind of issue frequently reported with pytho programs, but it didn’t help me.
So I was wondering whether you would have any idea of what I could have done wrong, or how to work around this issue ????
Kind regards, Erik.
Hi Erik,
I advice before doing the step number five to check if PGAdmin works properly, try to run the following command after finishing the step number 4 ( don’t forget to activate the virtual enviroment):
# sudo python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
– Open your browser and navigate to ip address of your server with the port 5050
Let us now if eveything works good
Thanks .
When I execute “sudo python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py”, it shows an error like
Traceback (most recent call last):
File “lib/python2.7/site-packages/pgadmin4/pgAdmin4.py”, line 23, in
import config
File “/home/ratna/.pgadmin4/lib/python2.7/site-packages/pgadmin4/config.py”, line 24, in
from pgadmin.utils import env, IS_PY2, IS_WIN, fs_short_path
File “/home/ratna/.pgadmin4/lib/python2.7/site-packages/pgadmin4/pgadmin/__init__.py”, line 17, in
from flask import Flask, abort, request, current_app, session
ImportError: No module named flask
Hi Ratana,
In the tutorial we didn’t execute the pgAdmin4.py.
If you want to executed you should not insert “#!/usr/bin/env python” and obviously don’t deactivate the virtual enviroment like we did in the tutorial .
Hi Lotfi,
thanks for your answer.
As I told you before, yes, “it works !” (not exactly with the command you give because I have to provide Python with the absolute path for pgAdmin.py, but it’s a detail); it’s the road after that checkpoint which remains closed for me ! It’s not so important, but I like to understand why something working fine on a system is going wrong on another one…
Best regards, Erik.
No problem, if you need any helps just contact us .
Good luck.
Dear Lofti,
I have done what is written on this page and
setup gives :
pgAdmin 4 – Application Initialisation
======================================
and does not ask a username/password
And there is no pgadmin4.db.
and when I start on http://0.0.0.0:5050/
I give as user http://0.0.0.0:5050/ and password admin, the app says ‘Specified user does not exist’
Is there a file where I can specify this user and give a password ? Perhaps pgadmin4.db ? But this file is not created by installation nor by setup.py…
Could you send to me this file ?
When you executed this command # python lib/python2.7/site-packages/pgadmin4/setup.py it doesn’t prompted you to insert a Username and Password for pgadmin user ? are you using a super user to execute all the commands?
Really it’s too strange, could you please delete the virtual enviroment and check if there’s a hidden directory called .pgadmin delete it also and retry to follow the procedure .
Thanks for the tutorial!!
I have the same issue — setup.py does not prompt for username and password
If i don’t use superuser, i get permission errors. So that may be relevant.
ahhh — it’s because i used the rc2 instead of 1.6
according to this: https://www.pgadmin.org/docs/pgadmin4/dev/getting_started.html “In a Server Deployment, the pgAdmin application is deployed behind a webserver or with the WSGI interface. If you install pgAdmin in server mode, you will be prompted to provide a role name and pgAdmin password when you initially connect to pgAdmin. ”
although i was never prompted…
Hi Adon, try to execute the command with a superuser, it should be works
Thanks Lotfi,
for 1.6 it works well, but for the rc2 even as super user i am not prompted — and the docs suggest when i first connect i’ll be asked to provide pwd but that never happened (at least not via the web access)
Hi Adon,
You didn’t prompted to set the email and the password because you didn’t delete the /var/lib/pgadmin4 directory that been created after the installation of the PgAdmin 4 V1.6 .
Run the Following commands:
# rm -r/var/lib/pgadmin4 ## Delete the pgadmin local directory
# python lib/python2.7/site-packages/pgadmin4/setup.py ### Install PgAdmin 4 V2.0-rc2
Hope this time you can Install the PgAdmin 4 V2.0-rc2
Thanks Lotfi,
When i originally installed, i started with the 2.0 rc, so there wasn’t any legacy files in place. Although i may have messed a step up somehow.
In any event, i tried again with the 2.0 release and it worked just fine! So i’m in great shape. Much appreciated for the excellent tutorial.
Thanks, it works fine but :
mchl@shemesh:~/.pgadmin$ sudo systemctl status pgadmin4
● pgadmin4.service – Pgadmin4 Service
Loaded: loaded (/etc/systemd/system/pgadmin4.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Son 2017-08-20 05:37:28 CEST; 3s ago
Process: 30302 ExecStart=/home/mchl/.pgadmin/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py (code=exited, status=1/FAILURE)
Main PID: 30302 (code=exited, status=1/FAILURE)
Aug 20 05:37:28 shemesh pgAdmin4.py[30302]: File “/home/mchl/.pgadmin/local/lib/python2.7/site-packages/alembic/runtime/migration.py”, line 330, in run_migrations
Aug 20 05:37:28 shemesh pgAdmin4.py[30302]: step.migration_fn(**kw)
Aug 20 05:37:28 shemesh pgAdmin4.py[30302]: File “/home/mchl/.pgadmin/lib/python2.7/site-packages/pgadmin4/migrations/versions/fdc58d9bd449_.py”, line 41, in upgrade
Aug 20 05:37:28 shemesh pgAdmin4.py[30302]: if get_version() != -1:
Aug 20 05:37:28 shemesh pgAdmin4.py[30302]: File “/home/mchl/.pgadmin/lib/python2.7/site-packages/pgadmin4/pgadmin/setup/db_version.py”, line 21, in get_version
Aug 20 05:37:28 shemesh pgAdmin4.py[30302]: if int(version.value) > int(config.SETTINGS_SCHEMA_VERSION):
Aug 20 05:37:28 shemesh pgAdmin4.py[30302]: AttributeError: ‘NoneType’ object has no attribute ‘value’
Aug 20 05:37:28 shemesh systemd[1]: pgadmin4.service: Main process exited, code=exited, status=1/FAILURE
Aug 20 05:37:28 shemesh systemd[1]: pgadmin4.service: Unit entered failed state.
Aug 20 05:37:28 shemesh systemd[1]: pgadmin4.service: Failed with result ‘exit-code’.
What is wrong with :
[Unit]
Description=Pgadmin4 Service
After=network.target
[Service]
# Point to the virtual environment directory
WorkingDirectory=/home/mchl/.pgadmin
# Point to the bin folder of your virtual environment
Environment=”PATH=/home/mchl/.pgadmin/bin”
ExecStart=”/home/mchl/.pgadmin/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py”
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Hi,
Before doing the step number 5, Did you check if the pgAdmin4 works ?
Try to add the user and the group of the user that u executed all the commands immagine it’s ” mchl”
[Unit]
Description=Pgadmin4 Service
After=network.target
[Service]
User= mchl
Group= mchl
# Point to the virtual environment directory
WorkingDirectory=/home/mchl/.pgadmin
# Point to the bin folder of your virtual environment
Environment=”PATH=/home/mchl/.pgadmin/bin”
ExecStart=”/home/mchl/.pgadmin/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py”
PrivateTmp=true
[Install]
WantedBy=multi-user.target
or you can create a bash script to run with cron at boot of the machine:
#!/bin/bash
source /home/mchl/.pgadmin/bin/activate
python /home/mchl/.pgadmin/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
Hope it will work for you. Good Luck 1
Thank you very much ! It works !
I added
[Service]
User= mchl
Group= mchl
You are very kind.
Please accept a bit music as gratitude :
https://www.youtube.com/watch?v=SQBXYsCeL-M
https://www.youtube.com/watch?v=7oUHONVAarQ
https://www.youtube.com/watch?v=iqpo–lu8yQ
Have a nice day !
Hi Michel,
You’re welcome anytime, we are happy that u find our articles useful for you. Please subscribe to our channel to keep up to date with all of our tutorials .
Good Luck!
Frustrated. It seems like your process should work with Ubuntu 16.04 running in a Vagrant VM on my MacBook Pro Sierra. http://127.0.0.1:5050 loads nothing. I’ve checked and Postgres 9.5 is running. In Step 4 I do enter the email and pw so all seems fine to there. This is the last installation line I see: I don’t want to do the next steps.
pgAdmin 4 – Application Initialisation
======================================
My Vagrantfile is mapped and this works fine for other ports. Also, no port conflicts on Ubuntu or my Mac.
config.vm.network “forwarded_port”, host: 5050, guest: 5050
This is the script file I’m running in the home directory:
******
sudo apt-get install virtualenv python-pip libpq-dev python-dev
virtualenv .pgadmin4
cd .pgadmin4
source bin/activate
wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v1.6/pip/pgadmin4-1.6-py2.py3-none-any.whl
pip install pgadmin4-1.6-py2.py3-none-any.whl
python lib/python2.7/site-packages/pgadmin4/setup.py
cd ..
rm -r .pgadmin
# Access at http://127.0.0.1:5050
*******
Any idea what could be wrong?
Hi Jim,
Did u run the command “rm -r .pgadmin” if you run that command you gonna delete the virtual environment directory created in the second step. Without the virtual environment directory pgadmin will not work . If you want to access it through the network without using forward port just change the loopback address from 127.0.0.1 to 0.0.0.0
Hope you got the steps .
I tried setup without rm “-r .pgadmin” and with it, per a recommendation in the comments. Neither worked.
I destroyed the vagrant box and started new (again…).
I changed the server default to 0.0.0.0 and ran “pip install pgadmin4-1.6-py2.py3-none-any.whl inside .pgadmin4” and it seemed to setup well except it never asked for the email and pw.
Then I started running the system reset and enable commands both inside .pgadmin4 and in the root for that, the Linux home directory, and for “sudo systemctl enable pgadmin4” I get a “Failed to execute operation: No such file or directory”. I gave up at this point.
Recommendations on the Web say to setup pgAdmin4 on my Mac and then SSH into the Postgres DB. Probably easier but I’m frustrated I couldn’t figure out how to make your approach work. I like to solve problems, not walk away from them.
Hi jim,
We are here to assist you, we hope that can help to resolve the problem.
First create a new vagrant box and redo all the indicated steps from the first step to the step number 4 using a superuser to execute all the commands
Finally run this command always under the virtual environment directory
# python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
And check the process if it started correctly and using netstat to check the ports
Hope this time you can resolve the problem .
Success! Now to figure out how to use pgAdmin and Postgres with the DreamFactory middleware on Ubuntu 16.04 in a Vagrant box for Angular development.
Thanks!!! I have no idea what I did wrong the first few times. I didn’t have to use sudo with this last install though. Maybe locating .pgadmin4 in the home directory helped. It was in the /vagrant directory before which is shared with my Mac. Maybe confused it..
Hi Jim Preston,
We are happy that finaly you successed with the installation, we invite you to subscribe to our Youtube channel to keep updated https://goo.gl/6v2OuO .
Thanks.
Dear Lofti,
Thanks a lot for your tutorial!
Can you explain how to upgrade to the latest version
https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v2.0/pip/pgadmin4-2.0-py2.py3-none-any.whl
Thank you in advance.
Torben
Hi Torben,
According to pgadmin official website there’s no a procedure of upgrade from an old version to a new one. Obviously because the installation procedure done by creating virtual environment. The only thing is to create a new virtual environment and setup the new version of pgadmin you can do that using the same steps mentioned in this tutorial. If you need help we are happy to assist you.
Hi Lofti,
thanks for your answer. Too bad there are no possibilities.
Can you make a How-To Install pgAdmin4 Server Mode in a windows environment?
I can’t get it to work.
Regards
Hi Lotfi,
I just installed version 2.1 of pgadmin4, and like many other people I got the error “ImportError: No module named flask”, and no prompt for user address / password. In my case, I had to run the command (either `python lib/python2.7/site-packages/pgadmin4/setup.py` or `lib/python2.7/site-packages/pgadmin4/pgAdmin4.py`) without sudo, after having changed the permissions of /var/lib/pgadmin and /var/log/pgadmin to 777 (a+wrx) ( not sure if it has to be so much opened). For information, the service file is still not working, I have to make a launcher.
Best regards,
Erik
Hi Erik,
Could you please send as the output error after the execution of the file pgAdmin4.py .
Could you please check the PYTHONPATH in the pgAdmin4.py file.
might be the space before “root” in the service file
Hi LOTFI WADERNI,
pgAdmin 4 – Application Initialisation
======================================
Starting pgAdmin 4. Please navigate to http://172.104.178.34:5050 in your browser.
Attribute Error :’Babel’ object has no attribute ‘load_locale’.
Thanks in Advance
Hi shahank,
I think it’s a problem of the psycopg2 package . Did you tried to install the PgAdmin4 v2 ? I guess it’s more stable
Dear all
I have this missing
pgadmin4.service – Pgadmin4 Service
Loaded: loaded (/etc/systemd/system/pgadmin4.service; enabled; vendor preset:
Active: failed (Result: exit-code) since Thu 2018-08-23 12:28:17 CEST; 9s ago
Process: 11103 ExecStart=/root/.pgadmin4/lib/python2.7/site-packages/pgadmin4/
Main PID: 11103 (code=exited, status=203/EXEC)
Aug 23 12:28:17 vps567311 systemd[1]: Started Pgadmin4 Service.
Aug 23 12:28:17 vps567311 systemd[1]: pgadmin4.service: Main process exited, cod
Aug 23 12:28:17 vps567311 systemd[1]: pgadmin4.service: Unit entered failed stat
Aug 23 12:28:17 vps567311 systemd[1]: pgadmin4.service: Failed with result ‘exit
Hi Thierno,
Checking the error I guess u forgot to put all the path of the parameter ExexStart that should be /root/.pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
pgadmin4.service – Pgadmin4 Service
Loaded: loaded (/etc/systemd/system/pgadmin4.service; enabled; vendor preset:
Active: failed (Result: exit-code) since Thu 2018-08-23 12:40:10 CEST; 12s ag
Process: 11430 ExecStart=/odoo/.pgadmin4/lib/python2.7/site-packages/pgadmin4/
Main PID: 11430 (code=exited, status=200/CHDIR)
Aug 23 12:40:10 vps567311 systemd[1]: Started Pgadmin4 Service.
Aug 23 12:40:10 vps567311 systemd[1]: pgadmin4.service: Main process exited, cod
Aug 23 12:40:10 vps567311 systemd[1]: pgadmin4.service: Unit entered failed stat
Aug 23 12:40:10 vps567311 systemd[1]: pgadmin4.service: Failed with result ‘exit
lines 1-10/10 (END)
ola, fiz o procedimento e apresentou esse erro.
uso instancia google cloud
pgadmin4.service – Pgadmin4 Service
Loaded: loaded (/etc/systemd/system/pgadmin4.service; enabled; vendor preset: en
Active: failed (Result: exit-code) since Sun 2018-09-09 04:14:04 UTC; 13min ago
Process: 10769 ExecStart=/root/.pgadmin4/lib/python2.7/site-packages/pgadmin4/pgA
Main PID: 10769 (code=exited, status=200/CHDIR)
Sep 09 04:14:04 postgresql-traccar systemd[1]: Started Pgadmin4 Service.
Sep 09 04:14:04 postgresql-traccar systemd[10769]: pgadmin4.service: Failed at step
Sep 09 04:14:04 postgresql-traccar systemd[1]: pgadmin4.service: Main process exite
Sep 09 04:14:04 postgresql-traccar systemd[1]: pgadmin4.service: Unit entered faile
Sep 09 04:14:04 postgresql-traccar systemd[1]: pgadmin4.service: Failed with result
Can you try to run manualy the command
/root/.pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
it’s works without any issue?
Hi Lotfi,
I followed this tutorial and it forked like a charm, I can connect to the database server on the same machine and on other computers on the network.
The issue I am running into now is when I go to Create a new database server (basically following the steps in your other tutorial http://yallalabs.com/linux/how-to-connect-to-a-postgresql-database-using-pgadmin4/) I can create a new server if I assign the port to 5050 then the new server gets created but cannot be connected to (connection error:
If I try to create a new server with the default “localhost’ port: 5432 I get a password error regardless of what username/password I put in including the full email and password that works for accessing pgadmin in the step 6 above.
Thanks in advance for any advice
Hi Kevin,
Before adding a server on pgadmin web panel make sure to allow the remote connection to your postgresql server by modifying the file pg_hba.conf
You can check this link to guide you how to enable the remote connection to your postgresql database server
http://yallalabs.com/linux/how-to-enable-network-remote-access-to-postgresql-database-server/
Hi, I am trying to install pgadmin4 on a server, but I am stuck at the last step
# sudo systemctl daemon-reload
# sudo systemctl enable pgadmin4
# sudo systemctl start pgadmin4
# sudo systemctl status pgadmin4
It says “sudo: systemctl: command not found”
Please help
Use instead ” service pgadmin4 status” after open http://Server_ip:5050 in your browser
Lotfi, after doing that, there’s an error:”pgadmin4: unrecognized service”. What could be the issue here?
Did you created the /etc/systemd/system/pgadmin4.service file ?
Given below are the contents of my pgadmin4.service file
[Unit]
Description=Pgadmin4 Service
After=network.target
[Service]
User= root
Group= root
# Point to the virtual environment directory
WorkingDirectory=/root/.pgadmin4
# Point to the bin folder of your virtual environment
Environment=”PATH=/root/.pgadmin4/bin”
ExecStart=”/root/.pgadmin4/lib/python3.4/site-packages/pgadmin4/pgAdmin4.py”
PrivateTmp=true
[Install]
WantedBy=multi-user.target
The path given above is correct. But when I check the python version its saying “Python 2.7.6”. And I have Python3.4 folder in .pgadmin4 folder itself.
Is there any issue here?
Hi,
You already using the Python 3.4 instead of the Python 2.7, you need to do the below steps
1./ Modify “#!/usr/bin/env python ” with ” #!/usr/bin/env python3 ” in the lib/pythonxxxx/site packages/pgadmin4/pgAdmin4.py
2./ Enable and start PgAdmin Service at system boot:
# sudo systemctl daemon-reload
# sudo systemctl enable pgadmin4
# sudo systemctl start pgadmin4
When I run the pip installation in step 3 I get one error “testtools 2.3.0 has requirement extras>=1.0.0, but you’ll have extras 0.0.3 which is incompatible.” at the end of intallation process. Is this a seriusly problem or don´t have importace?
Hi marco,
I don’t think it’s a problem . You can even use pip to update the required package
Thank you.
It seems that it does not matter. But once installed and when executing the command “sudo systemctl status pgadmin4” I get the following error:
● pgadmin4.service – Pgadmin4 Service
Loaded: loaded (/etc/systemd/system/pgadmin4.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since mié 2019-02-13 13:25:53 CET; 1min 4s ago
Process: 10020 ExecStart=/home/spsoftware/.pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py (code=exited, status=1/FAILURE)
Main PID: 10020 (code=exited, status=1/FAILURE)
feb 13 13:25:52 ubt16-srv-db pgAdmin4.py[10020]: File “/home/spsoftware/.pgadmin4/local/lib/python2.7/site-packages/alembic/runtime/migration.py”, line 361, in run_migrations
feb 13 13:25:52 ubt16-srv-db pgAdmin4.py[10020]: step.migration_fn(**kw)
feb 13 13:25:52 ubt16-srv-db pgAdmin4.py[10020]: File “/home/spsoftware/.pgadmin4/lib/python2.7/site-packages/pgadmin4/migrations/versions/fdc58d9bd449_.py”, line 113, in upgrade
feb 13 13:25:52 ubt16-srv-db pgAdmin4.py[10020]: email, password = user_info()
feb 13 13:25:52 ubt16-srv-db pgAdmin4.py[10020]: File “/home/spsoftware/.pgadmin4/lib/python2.7/site-packages/pgadmin4/pgadmin/setup/user_info.py”, line 55, in user_info
feb 13 13:25:52 ubt16-srv-db pgAdmin4.py[10020]: email = input(“Email address: “)
feb 13 13:25:52 ubt16-srv-db pgAdmin4.py[10020]: EOFError: EOF when reading a line
feb 13 13:25:53 ubt16-srv-db systemd[1]: pgadmin4.service: Main process exited, code=exited, status=1/FAILURE
feb 13 13:25:53 ubt16-srv-db systemd[1]: pgadmin4.service: Unit entered failed state.
feb 13 13:25:53 ubt16-srv-db systemd[1]: pgadmin4.service: Failed with result ‘exit-code’.
● pgadmin4.service – Pgadmin4 Service
Loaded: loaded (/etc/systemd/system/pgadmin4.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since mié 2019-02-13 13:25:53 CET; 1min 4s ago
Any idea??
Hi Marco,
Could u please try to run this command python /home/spsoftware/.pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py and tell us if it works ?
After installation end I get this executing “sudo systemctl status pgadmin4”
● pgadmin4.service – Pgadmin4 Service
Loaded: loaded (/etc/systemd/system/pgadmin4.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since mié 2019-02-13 13:25:53 CET; 1min 4s ago
Process: 10020 ExecStart=/home/spsoftware/.pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py (code=exited, status=1/FAILURE)
Main PID: 10020 (code=exited, status=1/FAILURE)
feb 13 13:25:52 ubt16-srv-db pgAdmin4.py[10020]: File “/home/spsoftware/.pgadmin4/local/lib/python2.7/site-packages/alembic/runtime/migration.py”, line 361, in run_migrations
feb 13 13:25:52 ubt16-srv-db pgAdmin4.py[10020]: step.migration_fn(**kw)
feb 13 13:25:52 ubt16-srv-db pgAdmin4.py[10020]: File “/home/spsoftware/.pgadmin4/lib/python2.7/site-packages/pgadmin4/migrations/versions/fdc58d9bd449_.py”, line 113, in upgrade
feb 13 13:25:52 ubt16-srv-db pgAdmin4.py[10020]: email, password = user_info()
feb 13 13:25:52 ubt16-srv-db pgAdmin4.py[10020]: File “/home/spsoftware/.pgadmin4/lib/python2.7/site-packages/pgadmin4/pgadmin/setup/user_info.py”, line 55, in user_info
feb 13 13:25:52 ubt16-srv-db pgAdmin4.py[10020]: email = input(“Email address: “)
feb 13 13:25:52 ubt16-srv-db pgAdmin4.py[10020]: EOFError: EOF when reading a line
feb 13 13:25:53 ubt16-srv-db systemd[1]: pgadmin4.service: Main process exited, code=exited, status=1/FAILURE
feb 13 13:25:53 ubt16-srv-db systemd[1]: pgadmin4.service: Unit entered failed state.
feb 13 13:25:53 ubt16-srv-db systemd[1]: pgadmin4.service: Failed with result ‘exit-code’.
Any idea??
python execution of pgAdmin4.py works but the service is throwing invalid arguments error.
Could u please show the error?
pgadmin4.service – Pgadmin4 Service
Loaded: loaded (/etc/systemd/system/pgadmin4.service; enabled)
Active: failed (Result: exit-code) since Mon 2019-02-18 18:10:28 IST; 5s ago
Process: 16840 ExecStart=/bin/bash /home/musigma/.pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py (code=exited, status=2)
I am using ubuntu 14.04 so is there any issue ?
pgadmin4.service – Pgadmin4 Service
Loaded: loaded (/etc/systemd/system/pgadmin4.service; enabled)
Active: failed (Result: exit-code) since Mon 2019-02-18 18:10:28 IST; 5s ago
Process: 16840 ExecStart=/bin/bash /home/musigma/.pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py (code=exited, status=2)
Hi Rijwan khan,
If your system is Ubuntu 14.04 then you can’t use the systemd you should use instead the upstart by creating a upstart config file under the directory /etc/init/ .
try something like this :
And Finally run :
Did what you said but here’s what i got
start: Unknown job: pgadmin4
Honestly … i don’t know how to help you i guess it’s a problem with Upstart. maybe you can create a shell script to run automatically using cron at system boot something like this
Thanks a lot buddy.
If you resolved the problem using the script and cron could you please keep us updated with a feedback. Thanks
Hi,
I want to move my users to another server, where is the file with users configuration?
Hi,
If you installed the PgAdmin4 as server, the db files and directories where pgadmin uses to save the users, and sessions should be the following:
SQLITE_PATH = ‘/var/lib/pgadmin4/pgadmin4.db’
SESSION_DB_PATH = ‘/var/lib/pgadmin4/sessions’
STORAGE_DIR = ‘/var/lib/pgadmin4/storage’
Hey,
thanks for your great tutorial. Everything runs fine. However I have a question:
Currently my login is at http://Server_ip:5050
If I want to change that to e. g. http://Server_ip/some_site/
what do I have to do/change?
Jonathan
Hi Jonathan,
Check out this tutorial http://yallalabs.com/linux/how-to-install-pgadmin-4-in-server-mode-as-a-web-application-using-wsgi-on-ubuntu-18-04-lts-ubuntu-16-04-lts/ . You need just to change WSGIScriptAlias from “/” to “/somedir”
@LOFTI
Yeah, this is the solution! I changed it to /some_site and it works fine. 🙂
Thanks a lot.
You are welcome any time, we are so glad to hear that our tutorial are helpful .
I went step by step with this tutorial, but cannot reach pgadmin on browser. Error: This site does not exist
Hi,
check the status of the service pgadmin and make sure that your firewall does’nt blocking the port 5050
I get an error when I type this command
pip install pgadmin4-3.4-py2.py3-none-any.whl
Would you help me
Hi,
you can follow this guide How to install PgAdmin 4 on Ubuntu should works