Академический Документы
Профессиональный Документы
Культура Документы
Also Read: How to setup SSH login without password on Linux systems
In this tutorial, we will learn to install PostgreSQL from source. So let’s start the tutorial,
Pre-requisites
We need to install some packages on servers before we can install PostgreSQL from source,
CentOS/RHEL
Ubuntu
The first step would be to download the source package for Postgres. Here we will be installing
PostgreSQL 11.6,
# cd postgresql-11.6
# ./configure –with-systemd
# make
# make install
So these commands will install postgresql from the source. Next step would be to create a user
for the postgres installation,
# useradd postgres
# passwd -d postgres
Next, we will also create a data directory for postgres,
# mkdir /usr/local/pgsql/data
The next step would be to initialize the database. To do that, change the user to postgres &
execute the following command,
# su – postgres
Once this is done, we can start the database but we need to create a service file to start the
database. Revert back to superuser & create a service file,
# vi /etc/systemd/system/postgresql.service
[Unit]
Documentation=man:postgres(1)
[Service]
Type=notify
User=postgres
ExecStart=/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
KillMode=mixed
KillSignal=SIGINT
TimeoutSec=0
[Install]
WantedBy=multi-user.target
EOF
Save the file & exit. Then run the following command to start the database service,
# systemctl daemon-reload
Note: The Same method can be used to install other postgresql versions as well, the only
change would download link for the version you wish to install.
We now end this tutorial on how to install postgresql from source, in our future tutorial we will
discuss some other important Postgresql commands. Please feel free to send in any
questions or queries using the comment box below.
If you think we have helped you or just want to support us, please consider these:-
TheLinuxGURUS.com