Applicable to:
- Plesk for Linux
Question
Is it possible to install PostgreSQL 10.x or higher with Plesk?
Answer
Yes, Plesk supports PostgreSQL up to version 15.
Use the following steps to install PostgreSQL 10.x or higher with Plesk:
-
Connect to the server via SSH
-
Get the PostgreSQL repository from https://www.postgresql.org/download/linux/redhat/
-
Install the PostgreSQL repository (replace link with the one obtained in previous step):
# dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
-
Disable the built-in PostgreSQL module:
# dnf -qy module disable postgresql
-
Install PostgreSQL (replace XX with the desired version):
# dnf install -y postgresqlXX-server
-
Initialize the database:
# /usr/pgsql-XX/bin/postgresql-XX-setup initdb
-
Set PostgreSQL to start on boot:
# systemctl enable postgresql-XX
-
Start PostgreSQL:
# systemctl start postgresql-XX
-
Create a symlink between installed version and postgresql service:
# ln -s /usr/lib/systemd/system/postgresql-XX.service /usr/lib/systemd/system/postgresql.service
-
Switch to user postgres:
# su - postgres
-
Set a password for the user:
# psql -c "ALTER USER postgres WITH PASSWORD 'YourSecurePassword';"
-
Go to Tools & Settings > Database Servers
-
Press Add Database Server
-
Add PostgreSQL as a remote database server with the following values:
- Database server type: PostgreSQL
- Host name or IP address: 127.0.0.1
- Check the box Use this server as default for PostgreSQL
- Username: postgres
- Password: password from step 11
-
Press OK
-
Connect to the server via SSH
-
Install necessary packages:
# apt install curl ca-certificates postgresql-common
-
Install the PostgreSQL repository:
# /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
-
Update repository data:
# apt update
-
Install PostgreSQL (replace XX with the desired version):
# apt install postgresql-XX
-
Set PostgreSQL to start on boot:
# systemctl enable postgresql
-
Start PostgreSQL:
# systemctl start postgresql
-
Switch to user postgres:
# su - postgres
-
Set a password for the user:
# psql -c "ALTER USER postgres WITH PASSWORD 'YourSecurePassword';"
-
Go to Tools & Settings > Database Servers
-
Press Add Database Server
-
Add PostgreSQL as a remote database server with the following values:
- Database server type: PostgreSQL
- Host name or IP address: 127.0.0.1
- Check the box Use this server as default for PostgreSQL
- Username: postgres
- Password: password from step 9
-
Press OK
Comments
0 comments
Please sign in to leave a comment.