要在 CentOS 上安裝 PGAdmin,請按照以下步驟操作:
sudo yum update
sudo yum install -y wget
wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.26/linux-x86_64/pgadmin4-4.26-linux-x86_64.tar.gz
請注意,上述鏈接和版本可能會隨著時間的推移而發生變化。請確保下載適用于您的系統的最新版本。
sudo tar -xvf pgadmin4-4.26-linux-x86_64.tar.gz
/opt:sudo mv pgadmin4 /opt
pgadmin 的系統用戶和組:sudo groupadd pgadmin
sudo useradd -M -r -g pgadmin pgadmin
sudo chown -R pgadmin:pgadmin /opt/pgadmin4
pgadmin.conf 的配置文件:sudo nano /etc/sysconfig/pgadmin4
在文件中添加以下內容:
# Path to the PostgreSQL server
PGADMIN_SERVER_HOST=localhost
# Port number of the PostgreSQL server
PGADMIN_SERVER_PORT=5432
# Name of the database to connect to
PGADMIN_DATABASE=postgres
# Username and password for the PostgreSQL server
PGADMIN_USERNAME=postgres
PGADMIN_PASSWORD=your_password
將 your_password 替換為您的 PostgreSQL 用戶密碼。
sudo systemctl restart pgadmin4
sudo systemctl enable pgadmin4
http://your_server_ip:80,其中 your_server_ip 是您的 CentOS 服務器的 IP 地址。使用您在步驟 7 中設置的 PostgreSQL 憑據登錄。現在,您已經在 CentOS 上成功安裝了 PGAdmin 并可以開始管理您的 PostgreSQL 數據庫了。