Plesk for Linux
kb: how-to
ABT: Group A
Applicable to:
- Plesk for Linux
Question
How to install and enable PostgreSQL database server in Plesk?
Answer
Note: PostgreSQL management is only available in Web Pro and Web Host licenses. To manage PostgreSQL via Plesk with Web Admin license it is required to purchase Power Pack / Developer Pack add-on.
-
Install PostgreSQL database server using Plesk Installer according to this KB article.
-
Go to Tools & Settings > Database Servers and click localhost next to PostgreSQL.
-
Specify username and password which will be administrative for PostgreSQL and click OK to initialize PostgreSQL:
Comments
33 comments
This procedure has installed PostgreSQL 9.2 on Plesk onyx with centOS 7.3
How to install PostgreSQL 9.5 or 9.6?
@Vivo, PostgreSQL is installed from the repositories enabled on the server. You can enable any other repository which provides the required version of PostgreSQL and install it the same way.
@Vivo, you should enable a corresponding repo for it. Check their list at https://yum.postgresql.org/
Can someone please tell me how to add PostgreSQL 9.5 repo so i get 9.5 when i install in Plesk GUI?
@Peter
Hello!
Use the following instructions: for Debian, for CentOS.
In case of any issues regarding setting the PostreSQL, contact support.
This file doesn't exist:
/opt/psa/admin/bin/pg_manage
or /opt/psa directory in first place.
@Ashkan
As it is written in the article, /opt/psa/admin/bin/pg_manage is a symbolic link to /usr/local/psa/admin/sbin/wrapper. It may be recreated using the command:
ln -s /usr/local/psa/admin/sbin/wrapper /opt/psa/admin/bin/pg_manage
Have you tried this command?
What version of Plesk is installed?
We have already ran the ln command but since the file didn't exist we got error. here is the result:
ln: failed to create symbolic link ‘/opt/psa/admin/bin/pg_manage’: No such file or directory
We have latest plesk onyx version. It's a fresh installation of plesk.
@Ashkan, I've made some corrections to the article. Please check. The path was Ubuntu specific, now it is for all OSes.
It took me 3 days to research and find all these information, so here it's in case you are pulling your hairs.
How to successfully install PostgreSQL 11 on Plesk (CentOS 7 version):
1- install PostgreSQL new REPO via SSH:
rpm -Uvh https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
2- Enable PostgreSQL from Plesk > Tools & Settings > Updates and Upgrades > Add/Remove components:
3- Install version 11:
yum install postgresql11-server postgresql11 postgresql11-libs postgresql11-devel
4- make a symbolic link from 11 to no version:
ln -s /lib/systemd/system/postgresql-11.service /lib/systemd/system/postgresql.service
5- Copy ver 11 over 9.2:
cd /usr/pgsql-11/bin/
for f in *; do echo $f; [ -e /usr/bin/$f ] && mv /usr/bin/$f /usr/bin/$f.old92; ln -s $(pwd)/$f /usr/bin/$f; done
6- Setup the Database Server:
/usr/pgsql-11/bin/postgresql-11-setup initdb
7- Move old data directory and Symbolic Link New Ones:
cd /var/lib/pgsql
mv data data.old92
mv backups backups.old92
ln -s 11/backups; ln -s 11/data
8- Start the server:
systemctl start postgresql.service
9- Link to Plesk Management:
rm /usr/local/psa/admin/bin/pg_manage
ln -s /usr/local/psa/admin/sbin/wrapper /usr/local/psa/admin/bin/pg_manage
10- Go to Plesk: Tools & Settings > Database Servers
11- Add a PostgreSQL database server and enter user and password as described above.
12- You should see a Green checkmark near PostgreSQL name on Tools & Settings > Database Servers.
Cheers!
@Plesk User
As per our documentation here https://docs.plesk.com/release-notes/onyx/software-requirements/ , Plesk now supports PostgreSQL 8.4–9.5.
So please notice that your manual (thank you for sharing it!) should be used on own will and risk, and if any issues occur, it would be an unsupported case.
@Alisa Kasyanova
I run Plesk Onyx Version 17.8.11 on Debian 9.9 and i got PostgreSQL 9.6.12 by default when adding as described in docs.
Does this mean that my PostgreSQL 9.6.12 is not supported?
Hello @Peter.
Thank you for bringing our attention to this matter.
Indeed according to the Plesk release notes PostgreSQL 9.6 is not supported and exactly this version is installed on Plesk 17.8 with underlying Debian 9.9.
I have passed this question to our development team for further clarifications.
I will update you as soon as I get a word from them.
Where to start:
postgresql-setup initdb does not exist when you follow the installment in Plesk.
But this can be solved by going to the install directory and run initdb from there.
After that it runs and you see that when you do a service status.
But when you go to Plesk Database Servers>Add Database Server you can not select PostgreSQL as database only MySQL exist.
So i am unable to run PostgreSQL at this time because this How to is no good at all.
Hello @Weare Borg,
Please, let me know Plesk and OS versions. So, we could check the behavior on a test server.
Plesk 17.8.x OS Ubuntu LTS 18.04
Hello @Weare Borg,
Thank you for the specified information. I've checked how to do this on Ubuntu 18.04, here's the instruction:
Steps 1 and 2 are the same =)
After that:
I've entered as Posgres user:
# su - postgres
Created cluster with the command:
# /usr//lib/postgresql/10/bin/initdb -D /usr/local/pgsql/data
Create an additional superuser to use it in Plesk:
# createuser -s -E -P -l plesk_pgadmin
pg_hba.conf on my installation was at /etc/postgresql/10/main/pg_hba.conf
After that I've successfully connected this server to Plesk:
The article will be updated with these details.
Any tip on doing this on:
Debian 9.11 Stretch
Plesk Onyx Version 17.8.11
Very important that all DB functions like backup/restore still works.
Hello @Peter,
The article was recently updated with instructions for Ubuntu/Debian.
Try these steps. In case of additional questions, feel free to ask.
This article is so mixed with old and new stuff i can't figure it out.
Also i get the question for user postgres password and i don't know this.
Can you please make a new tutorial with all steps. In step 1 you refer to an KB article that dos nothing for me or i'm just plain stupid :)
Getting a bit frustrated.
The main reason i bought Plesk it because i'm not skilled enough to do stuff in terminal.
So my question now is when and how will i be able to run Postgres 10 just by doing stuff in Plesk GUI and NOT in the terminal?
Hello @Peter,
Thank you for the feedback and sorry for the late response.
Let me address your questions:
> Also i get the question for user postgres password and i don't know this.
On a test server I've had postgres user had no password set, which should be the default behavior. You may use this instruction to reset the password: https://www.tldp.org/LDP/lame/LAME/linux-admin-made-easy/changing-user-passwords.html
The instruction from Step 1 described the ways any of Pleks components, including Postgres may be installed.
> So my question now is when and how will i be able to run Postgres 10 just by doing stuff in Plesk GUI and NOT in the terminal?
Plesk development team s doing its best to make the experience with Plesk easy and smooth. However, currently, Postgres initialization is to be done on customer's side.
When getting stuck at some of our instruction, you're always welcome to create a request to Plesk Support for assistance.
Hello, Ivan Postnikov i know that instructions you gave is for ubuntu 18, my config is:
Ubuntu 16.04; Plesk Obsidian. When i ran :
I solved it:
sudo pg_dropcluster 9.5 main
// delete the cluster initialy installed with plesksudo pg_createcluster 9.5 main --start
// recreate itsudo service postgresql restart
// restart PostgreSQL servicethis has been found here: https://askubuntu.com/questions/830346/postgresql-server-doesnt-start
OHOUO YVES DANIEL
Thank you for letting us know. Glad to hear it's resolved.
Hello,
This doesn't work on Plesk Obsidian 18.0.26. I have installed postgres using plesk gui.
Postgresql service is greyed out and cannot be started in the gui
However in the command line, postgresl is runnning:
Only MariaDB is available in postgresql servers
Can you please let me know what happens and update the tutorial?
Thank you
@Ivan Postnikov @Kuzma Ivanov @Alisa Kasyanova
Hello adri
Additional investigation is required to understand what's went wrong.
Could you submit a request to Plesk support or one of our partner depending on where Plesk license was purchased?
This does not work for me. It sais: "A Server with this host / port combination already exists" But no postgsql server is in the list....
Plesk Obsidian Version 18.0.27
Ubuntu 18.04.4
Update: also no postgsql running in ps aux
Update: Issue is resolved, Postgresql was not activate in the server components section
Hello guys! I use plesk in my dedicated server at Server4You, but even following all the steps above the postgres database server doesnst appear on the list.
In service list:
In database server list:
anyonde already face this issue?
Victor Hugo your license likely does not include PostgreSQL, please check under Tools & Settings > License Management whenever PostgreSQL support is "off" or "on". If off you might need to upgrade license.
Please sign in to leave a comment.