VMware Cloud

vCloud Director Installation Part 1 – Database

This is part 1 of the vCD 9.0 Installation guide.

In this section we will install the database required for vCD

There are now 3 databases supported for vCD

  • Oracle
  • Microsoft SQL Server
  • PostgreSQL

This guide will focus on setting up a vCD database with PostgreSQL on CentOS 7, but if you need to use another option, refer to the official documentation: https://docs.vmware.com/en/vCloud-Director/9.0/com.vmware.vcloud.install.doc/GUID-A3CDF724-7BFA-4BD0-95C4-55AC7A9F4055.html

NOTE: Only version 9.5 of PostgreSQL is supported at the time of vCD 9.0 release: http://partnerweb.vmware.com/comp_guide2/sim/interop_matrix.php#db&224=2415&database=293

PostgreSQL vCD Database Hardware Requirements

Configure the PostgreSQL Virtual Machine with at least the following specification

This lab will only have one vCD cell:

  • OS: CentOS 7
  • 100GB Disk
  • 16GB Memory
  • 4 vCPUs

Install a supported OS.

In this example I’m using CentOS 7 but any OS that supports PostgreSQL (and vice-versa) will work.

I like to use a minimal CentOS installation to keep things clean and free from unnecessary bugs and performance issue, you don’t need a UI so CentOS minimal works well

  • Download and boot into the latest CentOS 7 installation media located here http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1708.iso

Install the operating system with defaults except:

  • On the Installation Summary page, select Installation Destination and then Done on the top right
  • Also on the Installation Summary page, scroll down to Network and Hostname. Enable each NIC & hit Configure to set the IP address. Also set the hostname at the bottom of the screen.

  • Ensure that both the Timezone & Keyboard language is correct
  • Hit “Begin Installation” once ready
  • Set the root password
  • Reboot when prompted

 

Update the OS and install required components

Connect to the VM with SSH and first update yum:

  • yum update yum

Next, update the remainder of the system:

  • yum update

  • Reboot the guest OS

Install the PostgreSQL 9.5 RPM

  • rpm -ivh http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm

Install core packages and PostgreSQL 9.5

  • yum install net-tools postgresql95 postgresql95-server postgresql95-libs postgresql95-contrib

Change default postgreSQL password

  • passwd postgres

Make PostgreSQL start on boot

  • /usr/pgsql-9.5/bin/postgresql95-setup initdb
  • systemctl start postgresql-9.5.service
  • systemctl enable postgresql-9.5.service

Change to the postgres user

  • sudo -u postgres -i

Create the vCD user and database (Change the password as required)

  • psql
  • create user vcloud;
  • alter user vcloud password ‘VMware1!’;
  • alter role vcloud with login;
  • create database vcloud;
  • grant all privileges on database vcloud to vcloud;

Source: https://docs.vmware.com/en/vCloud-Director/9.0/com.vmware.vcloud.install.doc/GUID-07148F9F-3A69-4E99-93B4-46ED300FB7D1.html

Allow PostgreSQL connections through the default firewall configuration

  • Log in as root
  • firewall-cmd –zone=public –add-service=postgresql

Allow the vcloud user to login externally

  • Add the line below to pg_hba.conf (It means, allow the cloud user to login to the vcloud database from the 10.0.0.0/24 network with encrypted password) You might need to change the username/database name/network accordingly:
  • vi /var/lib/pgsql/9.5/data/pg_hba.conf
    • host    all             all             10.0.0.0/24            md5

Set the postgreSQL listening port and ip

  • vi /var/lib/pgsql/9.5/data/postgres.conf
  • Add these details:
    • listen_address = ‘*’
    • port= 5432

Install NTP to keep the clock in sync:

  • yum install ntp

Configure ntp servers

“You must use a network time service such as NTP to synchronize the clocks of all vCloud Director servers, including the database server. The maximum allowable drift between the clocks of synchronized servers is 2 seconds.”

VMware generally recommends to use at least 4 NTP servers. Using VI, change the lines beginning with server to NTP servers. All components connecting to vCD should share the same NTP servers for accurate timekeeping:

  • vi /etc/ntp.conf

Start the ntpd service

  • systemctl start ntpd
  • systemctl enable ntpd

Ensure ntpd is running:

  • systemctl status ntpd

Check ntpd is syncing to correct ntp servers (If you are using a pool, they might not have the same IP/hostname as the pool)

  • ntpq -p

Ensure that the date is set correctly

  • date -R

Ensure that the DB VM hostname is in DNS as an A record and that you have a PTR set too

“All host names that you specify during installation and configuration must be resolvable by DNS using forward and reverse lookup of the fully qualified domain name or the unqualified hostname”

Verify the above with for example:

  • yum install bind-utils (to install nslookup)
  • nslookup vcloud
  • nslookup vcloud.example.com
  • nslookup 192.168.1.1

For this lab environment, I turn off selinux but leave the firewall enabled:

  • vi /etc/sysconfig/selinux

Change SELINUX=enforcing

to

SELINUX=disabled

NOTE: This is line 6 of the config file, not the last line

Now would be a good time to reboot the server

Next section: vCloud Director Installation Part 2 – vCD Base Operating System

author avatar
Graham
Graham works closely with VMware & Microsoft solutions. He is a VMware Certified Implementation Expert, 8x VMware vExpert & a VMware User Moderator on the official VMware VMTN forums. Feel free to reach out via Twitter @VirtualG.uk or email: contact@virtualg.uk

Leave a Response

This site uses Akismet to reduce spam. Learn how your comment data is processed.