Install Postgres 10 for vCloud Director 9.5

Here are the steps to install Postgres 10 on CentOS 7

Spec:
OS:          CentOS 7
DB:          Postgres 10.x
RAM:       16GB
vCPU:      4
HDD:       100 GB

 

OS Installation:

Use Guided GUI installation. Select to partition manually so that all data is on /root LVM. 

 

Update OS

yum –y update

 

Disable SELinux

Vi /etc/selinux/config
SELINUX=disabled

 

Install VMware Tools

yum install –y open-vm-tools
systemctl enable vmtoolsd.service
systemctl stop vmtoolsd.service

 

 

Enable firewall rule

firewall-cmd --permanent --add-port=5432/tcp

 

 

 

Add handy tools

yum install –y telnet bind-utils net-tools

 

 

Install NTP

yum install -y ntp​
vi /etc/ntp.conf

 

Remove these lines:

server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
server 4.centos.pool.ntp.org iburst

 

Add these lines (in this case these two are my DCs and an external source)

server 10.0.0.1 iburst
server 10.0.0.2 iburst
server uk.pool.ntp.org iburst
systemctl start ntpd
systemctl enable ntpd

 

Check NTP is working

timedatectl

 

Install Postgres Repository RPM

yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm

 

Install Postgres

yum install postgresql10 –y
yum install postgresql10-server –y

 

 

Change Postgres user password

Passwd postgres

 

 

Enable Postgres startup

/usr/pgsql-10/bin/postgresql-10-setup initdb


systemctl enable postgresql-10

systemctl start postgresql-10

 

 

 

 

Configure Postgres

 

Change to Postgres user

sudo -u postgres –i

 

 

Create vCloud DB and relevant credentials

 

Psql
CREATE USER vclouduser;
ALTER USER vclouduser PASSWORD 'vcloudpass';
ALTER ROLE vclouduser with login;
CREATE DATABASE vcddb lc_collate='en_US.UTF-8' lc_ctype='en_US.UTF-8' TEMPLATE template0;
GRANT ALL PRIVILEGES ON DATABASE vcddb TO vclouduser;
ALTER DATABASE vcddb OWNER TO vcloud;


 

Postgres Tuning

vi /var/lib/pgsql/10/data/postgresql.conf
max_connections = 500
effective_cache_size = 8GB
shared_buffers = 4 GB
autovacuum = on
track_counts = on
autovacuum_max_workers = 3
autovacuum_naptime = 1min
autovacuum_vacuum_cost_limit = 2400

 

 

Allow access from vCloud Cells

vi /var/lib/pgsql/10/data/postgresql.conf
listen_addresses = '*’

 

vi /var/lib/pgsql/10/data/pg_hba.conf
host    vcddb        vclouduser         all                 md5

 

 

Finally

Reboot system – ensure all comes up correctly