2.4.4. Preparing a PostgreSQL Database for Use with Red Hat Enterprise Virtualization Manager

Summary

You can manually configure a database server to host the database used by the Red Hat Enterprise Virtualization Manager. The database can be hosted either locally on the machine on which the Red Hat Enterprise Virtualization Manager is installed, or remotely on another machine.

Important

The database must be prepared prior to running the engine-setup command.

Procedure 2.5. Preparing a PostgreSQL Database for use with Red Hat Enterprise Virtualization Manager

  1. Run the following commands to initialize the PostgreSQL database, start the postgresql service and ensure this service starts on boot:
    # service postgresql initdb
    # service postgresql start
    # chkconfig postgresql on
  2. Create a user for the Red Hat Enterprise Virtualization Manager to use when it writes to and reads from the database, and a database in which to store data about the Red Hat Enterprise Virtualization environment. You must perform this step on both local and remote databases. Use the psql terminal as the postgres user.
    # su - postgres
    $ psql              
    postgres=# create role [user name] with login encrypted password '[password]';
    postgres=# create database [database name] owner [user name] template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
  3. Run the following commands to connect to the new database and add the plpgsql language:
    postgres=# \c [database name]
    CREATE LANGUAGE plpgsql;
  4. Ensure the database can be accessed remotely by enabling client authentication. Edit the /var/lib/pgsql/data/pg_hba.conf file, and add the following in accordance with the location of the database:
    • For local databases, add the two following lines immediately underneath the line starting with Local at the bottom of the file:
      host    [database name]    [user name]    0.0.0.0/0  md5
      host    [database name]    [user name]    ::0/0      md5
    • For remote databases, add the following line immediately underneath the line starting with Local at the bottom of the file, replacing X.X.X.X with the IP address of the Manager:
      host    [database name]    [user name]    X.X.X.X/32   md5
  5. Allow TCP/IP connections to the database. You must perform this step for remote databases. Edit the /var/lib/pgsql/data/postgresql.conf file and add the following line:
    listen_addresses='*'
    This example configures the postgresql service to listen for connections on all interfaces. You can specify an interface by giving its IP address.
  6. Restart the postgresql service. This step is required on both local and remote manually configured database servers.
    # service postgresql restart
Result

You have manually configured a PostgreSQL database to use with the Red Hat Enterprise Virtualization Manager.