溫馨提示×

CentOS 上如何安裝 PGAdmin

小樊
120
2025-02-09 04:03:24
欄目: 智能運維

要在 CentOS 上安裝 PGAdmin,請按照以下步驟操作:

  1. 首先,確保系統已更新并安裝了必要的依賴項。打開終端并運行以下命令:
sudo yum update
sudo yum install -y wget
  1. 下載 PGAdmin 安裝包。訪問 PGAdmin 官方網站(https://www.pgadmin.org/download/ )以獲取最新版本的下載鏈接。在本示例中,我們將下載 PGAdmin 4 的 RPM 包。使用 wget 命令下載:
wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.26/linux-x86_64/pgadmin4-4.26-linux-x86_64.tar.gz

請注意,上述鏈接和版本可能會隨著時間的推移而發生變化。請確保下載適用于您的系統的最新版本。

  1. 解壓下載的安裝包:
sudo tar -xvf pgadmin4-4.26-linux-x86_64.tar.gz
  1. 將解壓后的 pgAdmin 目錄移動到合適的路徑,例如 /opt
sudo mv pgadmin4 /opt
  1. 創建一個名為 pgadmin 的系統用戶和組:
sudo groupadd pgadmin
sudo useradd -M -r -g pgadmin pgadmin
  1. 更改 pgAdmin 目錄的所有權:
sudo chown -R pgadmin:pgadmin /opt/pgadmin4
  1. 創建一個名為 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 用戶密碼。

  1. 重啟 pgAdmin 服務:
sudo systemctl restart pgadmin4
  1. 設置開機啟動:
sudo systemctl enable pgadmin4
  1. 打開瀏覽器并訪問 http://your_server_ip:80,其中 your_server_ip 是您的 CentOS 服務器的 IP 地址。使用您在步驟 7 中設置的 PostgreSQL 憑據登錄。

現在,您已經在 CentOS 上成功安裝了 PGAdmin 并可以開始管理您的 PostgreSQL 數據庫了。

0
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女