Date: Sat, 9 Feb 2019 14:02:57 -0500 From: Mark Moellering <markmoellering@psyberation.com> To: freebsd-questions@freebsd.org Subject: Installing pgAdmin4 (4.2) on FreeBSD-12 - SOLVED Message-ID: <CAA0uU3Uo6z61XZFvb6yd_=Kv3yT0huu9c96stOvhs%2B4pCw3JUg@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Having just done this, I wanted to post this here, in case this will help others. This is based off of a Computing For Geeks article by Josphat Mutai, but I felt there were a couple of pieces missing. I installed this on my local development machine, "hal" in the examples, not the postgresql server but I don't think that should change much beyond the connection definitions once pgadmin4 is up and running. (original article) https://computingforgeeks.com/how-to-install-pgadmin4-on-freebsd-12/ pgadmin4 can use python 2.7 or 3.6 As python 2.7 has an end of life of Jan, 1 2020, I opted for python 3.6 Pre-Installation Setup install python36 -- pkg install python36 install python pip package manager -- pkg install py36-pip install python virtualenvironment -- pkg install py36-virtualenv Installing pgAdmin4 As Root, go to /usr/local start a python virtual environment for pgadmin4: root@hal:/usr/local # virtualenv-3.6 pgadmin4 Then run: source pgadmin4/bin/activate This did not work for me, so I had to use: root@hal:/usr/local # source pgadmin4/bin/activate.csh Next, load the python dependancies through pip: [pgadmin4] root@hal:/usr/local #pip install pyopenssl cryptography pyasn1 ndg-httpsclient Then, load sqlite3: [pgadmin4] root@hal:/usr/local #pkg install py36-sqlite3 Finally, install pgAdmin4 using pip. Make sure to check for the latest version and directory: [pgadmin4] root@hal:/usr/local #pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.2/pip/pgadmin4-4.2-py2.py3-none-any.whl (On my 8-core Ryzen, this took less than a minute.) Configuration and running To exit the python virtual environment, run: #deactivate. I exited the virtual environment at this point, but I don't think it is necessary. next, in the directory: root@hal:/usr/local/pgadmin4/lib/python3.6/site-packages/pgadmin4 run: cp config.py to config_local.py - and edit the config_local.py file around line 140, it will have; DEFAULT_SERVER = '127.0.0.1' THIS WILL NOT WORK. You must change it to; DEFAULT_SERVER = '0.0.0.0' (or a static IP, if you have one) To run pgAdmin4, you must be in the python virtual environment, and then run the pgAdmin4.py script; root@hal:/usr/local # virtualenv-3.6 pgadmin4 root@hal:/usr/local # source pgadmin4/bin/activate.csh [pgadmin4] root@hal:/usr/local # python ./pgadmin4/lib/python3.6/site-packages/pgadmin4/pgAdmin4.py It will ask for an email address and password the first time you run it, as displayed below; NOTE: Configuring authentication for SERVER mode. Enter the email address and password to use for the initial pgAdmin user account: Email address: markmoellering@psyberation.com Password: Retype password: pgAdmin 4 - Application Initialisation ====================================== Starting pgAdmin 4. Please navigate to http://0.0.0.0:5050 in your browser. And it should work (it did for me at any rate). I went http://127.0.0.1:5050 and was able to log in and attach to my remote server. When I initially left the DEFAULT_SERVER = '127.0.0.1', I could login but then the web-stie would crash. I changed the setting to 0.0.0.0 and then http://127.0.0.1:5050 worked as expected. I haven't written an rc script for it yet but I may in the future. I hope this helps someone. While the original instructions by Josphat Mutai were quite good, there were just a couple of gotchas that I thought should be explained in more detail -- Mark
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAA0uU3Uo6z61XZFvb6yd_=Kv3yT0huu9c96stOvhs%2B4pCw3JUg>