pgAdmin 4 v1.0 released on 2016-09-29.
As I was asked about how to install that it can be easily launched like other programs from Ubuntu launcher,I decided to share this with you.
pgAdmin 4 runs with Python 2.
So make sure that you have Python 2 installed on your system. Also we will use pip and virtualenv and for package management and isolating the python environment required to run pgAdmin 4. Run the commands below to install the requirements.
#requirements_install.sh sudo apt-get install python2.7-dev virtualenv python-pip libpq-dev
Create a directory to init our isolated python environment there.
Let's pick up ~/apps/pgadmin4/ for instance.
#virtualenv_activation.sh mkdir -p ~/apps/pgadmin4/ cd ~/apps/pgadmin4 virtualenv venv -p /usr/bin/python2.7 source ./venv/bin/activate
Now that you have cloned the environment,you should download and install the wheel package of pgAdmin 4 from here .
#pgadmin4_install.sh wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v2.0/pip/pgadmin4-2.0-py2.py3-none-any.whl pip install pgadmin4-1.4-py2.py3-none-any.whl
pgAdmin4 needs config_local.py to run.
This file can be cloned from the existing config.py from current installation path.
#clone_config.sh cp ./venv/lib/python2.7/site-packages/pgadmin4/config.py \ ./venv/lib/python2.7/site-packages/pgadmin4/config_local.py
You can change the initial values for SECRET_KEY,Security_PASSWORD_SALT and CSRF_SESSION_KEY manually in this file.
Test your installation by running:
#test_installation.sh python ./venv/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
You may be prompted to enter email and password for new user registeration.
Once you have provided the needed information,you can access the app by browsing http://127.0.0.1:5050/
Now that we are sure about the success in running pgAdmin 4 by calling the prevIoUs command,let's create an Ubuntu launcher for this application.
Create pgAdmin4.sh and pgAdmin4.desktop files:
#create_launcher.sh touch pgAdmin4.sh pgAdmin4.desktop chmod +x pgAdmin4.sh pgAdmin4.desktop
Put the contents below in pgAdmin4.sh:
pgAdmin4.sh #! /bin/bash source ~/apps/pgadmin4/venv/bin/activate python ~/apps/pgadmin4/venv/local/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py &
sleep 5; sensible-browser http://127.0.0.1:5050
Put the contents below in pgAdmin4.desktop:
#pgAdmin4.desktop [Desktop Entry] Name=pgAdmin 4 Exec=/home/user/apps/pgadmin4/pgAdmin4.sh Icon=/home/user/apps/pgadmin4/pgadmin.svg Type=Application Categories=Database; Terminal=false
Link pgAdmin4.desktop to ~/.local/share/applications/ that Ubuntu can autoload the launcher.
#link_launcher.sh ln -s ~/apps/pgadmin4/pgAdmin4.desktop ~/.local/share/applications/
Download pgAdmin icon . and save it to ~/apps/pagadmin4/ as pgadmin.svg.
You can also use the command below:
#download_svg_icon.sh wget http://kiahosseini.github.io/assets/image/pgadmin4_install/pgadmin.svg
That's all.
It should Now open your browser[tab] loading http://127.0.0.1:5050.
You may see an error in loading the page. Try to refresh the page in this case. It may take longer to launch the server. Be patient!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。