embeded/raspberry pi2024. 7. 29. 11:41

검색을 해보니 대부분 python을 통해서 설치하는걸로 나온다.

아래는 설치 + 실행, 빨간건 재기동 이후 실행시 입력할 내용이다.

$ python3 -m venv pgadmin4

$ cd ~/pgadmin4
$ mkdir var
$ mkdir var/storage
$ mkdir var/sessions

source bin/activate

$ 
pip install pgadmin4
$ pip uninstall pyopenssl
$ pip uninstall cryptography
$ pip install pyopenssl
$ pip install cryptography

$ vi ~/pgadmin4/lib/python3.11/site-packages/config_local.py
import os

PGADMIN_DEFAULT_EMAIL      = '<YOUR_EMAIL>'
PGADMIN_DEFAULT_PASSWORD   = '<YOUR_PASSWORD>'
LOG_FILE                   = '/home/pi/pgadmin4/var/log'
SQLITE_PATH                = '/home/pi/pgadmin4/var/pgadmin4.db'
SESSION_DB_PATH            = '/home/pi/pgadmin4/var/sessions'
STORAGE_DIR                = '/home/pi/pgadmin4/var/storage'
DATA_DIR                   = os.path.realpath(os.path.expanduser(u'~/.pgadmin/'))
AZURE_CREDENTIAL_CACHE_DIR = os.path.join(DATA_DIR, 'azurecredentialcache')
DEFAULT_SERVER             = '0.0.0.0'


$ mkdir ~/.pgadmin
$ mkdir ~/.pgadmin/azurecredentialcache

$ pgadmin4

 

~/pgadmin4/lib/python3.11/site-packages/config_local.py 파일이 없으면 생기는 에러

$ pgadmin4
ERROR  : Failed to create the directory /var/lib/pgadmin:
           [Errno 13] Permission denied: '/var/lib/pgadmin'
HINT :   Create the directory /var/lib/pgadmin, ensure it is writeable by
         'pi', and try again, or, create a config_local.py file
         and override the SQLITE_PATH setting per
         https://www.pgadmin.org/docs/pgadmin4/6.21/config_py.html

 

AZURE_CREDENTIAL_CACHE_DIR 이 없을 경우 발생(혹은 디렉토리가 없을 경우)

$ pgadmin4
Traceback (most recent call last):
  File "/home/pi/pgadmin4/bin/pgadmin4", line 5, in <module>
    from pgadmin4.pgAdmin4 import main
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/pgadmin4/pgAdmin4.py", line 93, in <module>
    app = create_app()
          ^^^^^^^^^^^^
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/pgadmin4/pgadmin/__init__.py", line 267, in create_app
    create_app_data_directory(config)
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/pgadmin4/pgadmin/setup/data_directory.py", line 118, in create_app_data_directory
    _create_directory_if_not_exists(config.AZURE_CREDENTIAL_CACHE_DIR)
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/pgadmin4/pgadmin/setup/data_directory.py", line 21, in _create_directory_if_not_exists
    os.mkdir(_path)
FileNotFoundError: [Errno 2] No such file or directory: '/home/pi/.pgadmin/azurecredentialcache'

 

python openssl 모듈 버전 문제일 경우 발생

$ pgadmin4
NOTE: Configuring authentication for SERVER mode.

Enter the email address and password to use for the initial pgAdmin user account:

Email address: "환경파일에 기재된 이메일"
Password: "환경파일에 기재된 암호"
Retype password: "환경파일에 기재된 암호"
Traceback (most recent call last):
  File "/home/pi/pgadmin4/bin/pgadmin4", line 5, in <module>
    from pgadmin4.pgAdmin4 import main
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/pgadmin4/pgAdmin4.py", line 93, in <module>
    app = create_app()
          ^^^^^^^^^^^^
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/pgadmin4/pgadmin/__init__.py", line 553, in create_app
    driver.init_app(app)
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/pgadmin4/pgadmin/utils/driver/__init__.py", line 27, in init_app
    DriverRegistry.load_modules(app)
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/pgadmin4/pgadmin/utils/driver/registry.py", line 18, in load_modules
    from . import psycopg2 as module
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/pgadmin4/pgadmin/utils/driver/psycopg2/__init__.py", line 30, in <module>
    from .server_manager import ServerManager
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/pgadmin4/pgadmin/utils/driver/psycopg2/server_manager.py", line 35, in <module>
    from sshtunnel import SSHTunnelForwarder, BaseSSHTunnelForwarderError
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/sshtunnel.py", line 25, in <module>
    import paramiko
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/paramiko/__init__.py", line 22, in <module>
    from paramiko.transport import (
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/paramiko/transport.py", line 138, in <module>
    class Transport(threading.Thread, ClosingContextManager):
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/paramiko/transport.py", line 212, in Transport
    if KexCurve25519.is_available():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/paramiko/kex_curve25519.py", line 30, in is_available
    X25519PrivateKey.generate()
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/cryptography/hazmat/primitives/asymmetric/x25519.py", line 39, in generate
    from cryptography.hazmat.backends.openssl.backend import backend
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/__init__.py", line 6, in <module>
    from cryptography.hazmat.backends.openssl.backend import backend
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 113, in <module>
    from cryptography.hazmat.bindings.openssl import binding
  File "/home/pi/pgadmin4/lib/python3.11/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 14, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /home/pi/pgadmin4/lib/python3.11/site-packages/cryptography/hazmat/bindings/_openssl.abi3.so: undefined symbol: FIPS_mode

 

openssl 패키지 갈아봤자 의미없고, pip를 통해서 업데이트 해주어야 한다.

pip uninstall pyopenssl
pip uninstall cryptography
pip install pyopenssl
pip install cryptography

[링크 : https://stackoverflow.com/questions/32518458/importerror-no-module-named-cryptography-hazmat-bindings-openssl]

 

원격으로 해서 포트 돌리고

$ ssh pi@my.domain.try -p 22 -X -C -L 5050:localhost:5050

 

로컬에서 접속하니 로그인은 떴다!!

 

엄청 오랫만에 보는 느낌이네..

그나저나 이거 다시 켜려면 venv 해서 또 해야하려나?

 

[링크 : https://medium.com/@jaimemartinagui/pgadmin-on-raspberry-pi-857872e6f3b2] << 요거 주로 참고

[링크 : https://www.alcher.me/databases-ru-en/postgresql/install-pgadmin-4-on-debian-buster/]

[링크 : https://medium.com/@mglaving/how-to-install-pgadmin4-on-raspberry-pi-4-raspbian-10-buster-howto-guide-495dab15199d]

[링크 : https://forums.raspberrypi.com/viewtopic.php?t=337180]

'embeded > raspberry pi' 카테고리의 다른 글

라즈베리 파이 gui 자동실행  (0) 2024.09.19
라즈베리 파이에 파이썬 스크립트를 서비스로 등록하기  (0) 2024.08.27
pgadmin3 안되잖아?!  (0) 2024.07.26
rpi pico ADC 범위  (0) 2024.07.16
rpi pico / micropython  (0) 2024.07.15
Posted by 구차니