From owner-freebsd-questions@freebsd.org Sat Feb 9 19:03:10 2019 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 986D514C6237 for ; Sat, 9 Feb 2019 19:03:10 +0000 (UTC) (envelope-from markmoellering@psyberation.com) Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 447A576415 for ; Sat, 9 Feb 2019 19:03:09 +0000 (UTC) (envelope-from markmoellering@psyberation.com) Received: by mail-qt1-x841.google.com with SMTP id b8so7838778qtj.1 for ; Sat, 09 Feb 2019 11:03:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=psyberation-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=dVxqXTk2k82+oohn1tZvR+agiDGVqe/T5Ku/P8RkCGs=; b=fEWBoFN/jwuZMoWv+H+DfMBBablU8yUQ9HievFQMWcWkL4h6dCKBBo2Tm/QcNflG1q 7fggcYTRFOwU4OU6Akb7AtjZmpc0lu67+aQT8bmBLso1TrFy4O0bw4gMVxZyShEv/GmS OVi+naMSHXI6ah9PNYH0vOWW9NT12V7mqiuU72i9LEEYM636AXhJDoLHJbusR60At3n6 Ri7YdZajjQg9voXTGec3tVuH9rMS27I98jdJ556NAbH5KgxNmyrdeMM+RcZvZ7+cq+cd Irui/zRwf2joNYFA4i5dCVkaDFY2+rJLsFvxhO3/FSRnMuao6eKKsdROFJZ+Po2MI5+O aaxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=dVxqXTk2k82+oohn1tZvR+agiDGVqe/T5Ku/P8RkCGs=; b=phG33QEO63pzixZQCAkqfByQZIs+HVWnBJaWSYs2lg7omUzVKGW/tJctlE/hIlGkiI imma+S4+koxeEF6YIDY0U8Q9JJFQq+4G9wnJLIh6cruldA19blJWS9xCcKMM2rXhUZHv DIru6fUsPcVnNeoLN4/CYHkriR0bcFpoF7hZsYTi/lQ8GWSwyAUqj6gj645Yz7dt7Xtq 7Y6n8gX5cWXhSk6OfffGNXhJpr5SC3BrbDqc+hzDGfLq/8Cnd1bDdcyctNT+5VPYVpBY xaUU273e1wL79bgoFVrcOBzTg6ySCF6cuog04mniRbtoT0EOVt87IPOm1KQWAPDuPj19 UVfQ== X-Gm-Message-State: AHQUAuYEiBBhqA6QENcnLVKRBrG5Fl4D7Ib6ILXhgx9zDi5kKNqqH3tS 1QUvncewobdI5nn8iVgc3IKvUBLGfa39pNJifez2rGKA5Lw= X-Google-Smtp-Source: AHgI3IZzk4Pyi9eiP9AwRuOnF4KpUB/0HzUWGE74+/VO+LpKf4cK2f+mZkCpjus3x0mHGnPpCpQCbXv19oCOYUzKkrU= X-Received: by 2002:aed:3fd9:: with SMTP id w25mr32104qth.352.1549738987919; Sat, 09 Feb 2019 11:03:07 -0800 (PST) MIME-Version: 1.0 From: Mark Moellering Date: Sat, 9 Feb 2019 14:02:57 -0500 Message-ID: Subject: Installing pgAdmin4 (4.2) on FreeBSD-12 - SOLVED To: freebsd-questions@freebsd.org X-Rspamd-Queue-Id: 447A576415 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=psyberation-com.20150623.gappssmtp.com header.s=20150623 header.b=fEWBoFN/; spf=pass (mx1.freebsd.org: domain of markmoellering@psyberation.com designates 2607:f8b0:4864:20::841 as permitted sender) smtp.mailfrom=markmoellering@psyberation.com X-Spamd-Result: default: False [-0.64 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.76)[-0.756,0]; R_DKIM_ALLOW(-0.20)[psyberation-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-0.997,0]; DMARC_NA(0.00)[psyberation.com]; NEURAL_SPAM_SHORT(0.60)[0.602,0]; DKIM_TRACE(0.00)[psyberation-com.20150623.gappssmtp.com:+]; MX_GOOD(-0.01)[alt1.aspmx.l.google.com,aspmx.l.google.com,aspmx2.googlemail.com,alt2.aspmx.l.google.com,aspmx3.googlemail.com]; RCVD_IN_DNSWL_NONE(0.00)[1.4.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; HTTP_TO_IP(1.00)[]; IP_SCORE(0.02)[ip: (4.59), ipnet: 2607:f8b0::/32(-2.45), asn: 15169(-1.95), country: US(-0.07)]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2019 19:03:10 -0000 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