# PostgreSQL 16 如何安裝到 CentOS 9 ## 前言 > CentOS安裝PostgreSQ非常簡單,主要就是看官方網站,官方網站已提供多個系統安裝的教學,我們按照官方的步驟來執行就好了! ## 安裝 RPM ```shell= sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm ``` ## 關閉系統預設的PostgeSQL module ```shell= sudo dnf -qy module disable postgresql ``` ## 安裝 PostgreSQL 16 ```shell= sudo dnf install -y postgresql16-server ``` ## 初始化 ```shell= sudo /usr/pgsql-16/bin/postgresql-16-setup initdb ``` ## 設置 開機自動啟動與啟動 PostgreSQL ```shell= sudo systemctl enable postgresql-16 sudo systemctl start postgresql-16 ``` ## 如何驗證 PostgreSQL 有正常啟動 ```shell= sudo systemctl status postgresql-16 ``` ## 如何連線到 PostgreSQL ```shell= su - root su - postgres $ psql ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up