skip to Main Content

I have installed pgadmin4 from repo :

yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

following the below tutorial:

https://www.tecmint.com/install-pgadmin4-in-centos-7/

I get the ‘Application Initialization’ fine, however when I run http://localhost/pgadmin4 I get a ‘500 Internal Server Error’ in firefox.

My httpd error log gives:

[Tue Dec 31 11:32:59.214572 2019] [:error] [pid 6424] [remote ::1:80] mod_wsgi (pid=6424): Target WSGI script '/usr/lib/python2.7/site-packages/pgadmin4-web/pgAdmin4.wsgi' cannot be loaded as Python module.
[Tue Dec 31 11:32:59.214593 2019] [:error] [pid 6424] [remote ::1:80] mod_wsgi (pid=6424): Exception occurred processing WSGI script '/usr/lib/python2.7/site-packages/pgadmin4-web/pgAdmin4.wsgi'.
[Tue Dec 31 11:32:59.214609 2019] [:error] [pid 6424] [remote ::1:80] Traceback (most recent call last):
[Tue Dec 31 11:32:59.214625 2019] [:error] [pid 6424] [remote ::1:80]   File "/usr/lib/python2.7/site-packages/pgadmin4-web/pgAdmin4.wsgi", line 36, in <module>
[Tue Dec 31 11:32:59.214660 2019] [:error] [pid 6424] [remote ::1:80]     from pgAdmin4 import app as application
[Tue Dec 31 11:32:59.214681 2019] [:error] [pid 6424] [remote ::1:80]   File "/usr/lib/python2.7/site-packages/pgadmin4-web/pgAdmin4.py", line 109, in <module>
[Tue Dec 31 11:32:59.214695 2019] [:error] [pid 6424] [remote ::1:80]     app = create_app()
[Tue Dec 31 11:32:59.214711 2019] [:error] [pid 6424] [remote ::1:80]   File "/usr/lib/python2.7/site-packages/pgadmin4-web/pgadmin/__init__.py", line 244, in create_app
[Tue Dec 31 11:32:59.214723 2019] [:error] [pid 6424] [remote ::1:80]     create_app_data_directory(config)
[Tue Dec 31 11:32:59.214729 2019] [:error] [pid 6424] [remote ::1:80]   File "/usr/lib/python2.7/site-packages/pgadmin4-web/pgadmin/setup/data_directory.py", line 42, in create_app_data_directory
[Tue Dec 31 11:32:59.214740 2019] [:error] [pid 6424] [remote ::1:80]     os.chmod(config.SESSION_DB_PATH, 0o700)
[Tue Dec 31 11:32:59.214755 2019] [:error] [pid 6424] [remote ::1:80] OSError: [Errno 1] Operation not permitted: '/var/lib/pgadmin4/sessions'

I’ve tried ‘chmod’ on my log and lib directories, and I’ve tried to disable SELinux, but I can’t get it work !

Would you please be able to help me ?
Thanks

2

Answers


  1. I followed the same tutorial and faced the same problem.
    This is how you can fix it:

    chown -R apache:apache /var/lib/pgadmin4/*
    chown -R apache:apache /var/log/pgadmin4/*
    

    If you face any other problem from here, ask a new question and send me the link of the question, I will reply. I faced some other problems after installing pgAdmin4 and solved all of those.

    Login or Signup to reply.
  2. I followed same step and after successfully install & setup; got the 500 internal server error then I restart httpd, apache and postgres.service. This doesn’t help me after that I run two commands:

    sudo chcon -t httpd_sys_rw_content_t /var/log/pgadmin4 -R
    sudo chcon -t httpd_sys_rw_content_t /var/lib/pgadmin4 -R
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search