PostgreSQL Installation Instructions

Before you start
  • Provision the necessary hardware to support your implementation plan.
  • Select one of the recommended operating systems from the options listed on the server recommendations page. You will need to know which operating system you are using before you begin the installation.
  • The server, either directly or indirectly, must be able to access the internet on ports 80 and/or 443 (preferably both)
  • Ensure that the machine and the data directory location of the PostgreSQL installation have sufficient disk space by running the df -h command. Requirements and recommendations for disk layout can be seen here: PostgreSQL.
  • Ensure that SELinux is disabled.
  • Ensure that firewalld  is disabled.
  • All commands, unless otherwise noted, must be run as root.

Note: It is recommended to copy and paste the code provided in these instructions.

1. IFI CLAIMS will create a single tar.gz file that includes several bash scripts that are used during implementation and a subdirectory of tar.gz files for each of the tables in the PostgreSQL data warehouse. This file will be placed into an S3 bucket and we will provide you with a link for you to access and download the file.

2. Extract the tar.gz file into your local environment. The receiving drive will require approximately 3TB of free space to download and extract the file.

3. Use yum to install PostgreSQL.

yum -y install \
    perl-devel \
    postgresql postgresql-contrib \
    postgresql-odbc postgresql-plperl \
    postgresql-server

4. If you are using CentOS 7, add the epel repository.

yum -y install epel-release

If you are using RHEL 7, use the following code to add the epel repository. Otherwise, continue to step 5.

yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E '%{rhel}').noarch.rpm

5. Install the appropriate repository for your operating system using the command listed in the Repository column below. If necessary, adjust the code to reflect the version you are using.

6. After installing the repository, run a yum update to pull in the patched version of libxml2 from the IFI CLAIMS repository.

yum update

Note: Reboot if kernel was upgraded.

7. CLAIMS Direct requires a working PostgreSQL cluster. If you do not have an initialized cluster, the following commands will initialize the cluster and give you rudimentary authentication and access levels needed to run CLAIMS Direct. Note that the initdb command has to be run by the user who owns PostgreSQL (user postgres). Enter:

su - postgres

followed by:

initdb -A trust \
       -D /var/lib/pgsql/data \
       -E utf8

8. Using a text editor, modify the IP addresses in the following configuration files.

Note: If you are installing the client tools on a separate machine, other hosts will be required. Be sure to remove the hash (#) at the start of the ‘other hosts’ entry if you need to enable access for other hosts or subnets.

/var/lib/pgsql/data/pg_hba.conf

# Allow trusted local access

local   all             all                                     trust
 
# IPv4 local connections
host    all             all             127.0.0.1/32            trust
 
# Other hosts on subnets that may require access, for example
# host    all             all             xxx.xxx.xxx.xxx/xx         trust

/var/lib/pgsql/data/postgresql.conf

listen_addresses = '*'                  # what IP address(es) to listen on;

Note: If you already have an initialized cluster, please be certain that local access is enabled for stand-alone installation. In either distributed install, if a separate services machine is created, its IP address needs access. This is imperative for the client update procedures.

9. Enable and restart the PostgreSQL cluster.

systemctl enable postgresql.service ; systemctl restart postgresql.service

10. Create the role alexandria and load the SQL via psql into the instance.

echo "create role alexandria with superuser login;" \
  | psql -Upostgres postgres
 
yum -y install alexandria-schema-tools
gunzip -c /usr/share/alexandria-schema-tools/alexandria-dbs-10.x.gz \
  | psql -Ualexandria -h <POSTGRESQL-HOST> postgres
 
# There's also support for 9.x,
# gunzip -c /usr/share/alexandria-schema-tools/alexandria-dbs-9.x.gz \
#  | psql -Ualexandria -h <POSTGRESQL-HOST> postgres

11. To ensure that the database has been created, run:

psql -U alexandria --list

The results should show the alexandria database.

                 List of databases      
Name       |  Owner    | Encoding |   Collate  |    Ctype    |  Access privileges
-----------------+------------+----------+-------------+-------------+-----------------------
alexandria |alexandria | UTF8     | en_US.UTF-8| en_US.UTF-8 |                                		                                                                                                 
postgres   |postgres   | UTF8     | en_US.UTF-8| en_US.UTF-8 |  
template0  |postgres   | UTF8     | en_US.UTF-8| en_US.UTF-8 |=c/postgres          +      
 		   |           |          |            |             | postgres=CTc/postgres
template1  |postgres   | UTF8     | en_US.UTF-8| en_US.UTF-8 |=c/postgres          +       
           |           |          |            |             | postgres=CTc/postgres

12. Run pgtuneNote that this requires Python. You can also use the online tool https://pgtune.leopard.in.ua/#/ and fill in the required values as well as those that correspond to your system. Add or change the appropriate settings and restart PostgreSQL.

yum -y install pgtune
  pgtune -i postgresql.conf  -T DW -c 500
  [ paste added configuration options at end of postgres.conf ]

13. Run the pre-flight check script to confirm that your system is properly configured to load the data.

cd-pre-flight-check.sh

The sample output of a properly configured system would look like this:

# Testing localhost/alexandria ...
#   OK    : procedual language sql
#   OK    : procedual language plpgsql
#   OK    : procedual language plperl
#   OK    : procedual language plperlu
#   OK    : XML capability (test 1/libxml):
#   OK    : XML capability (test 2/libxml):

Resolve any recognized errors. For unfamiliar errors, please contact support@ificlaims.com.

14. Use the load script to load the CLAIMS Direct data into PostgreSQL tables. Since the loading process will take 1-2 days, we recommend that you use the nohup command to detach the script from the terminal and allow it to run in the background.

nohup cd-load.sh

15. Use the ps command periodically to check whether the loading process has completed.

Note: If you want to check on the process while it is running, use the following command to show the progress of the tables which are being copied:

ps -eaf |grep COPY

16. Once the loading process is complete, you can run the cd-count.sh script, a simple QA of table counts, to ensure that the tables have loaded correctly. Modify the IP address to reflect the PostgreSQL server. This may take an hour or more to run.

cd-count.sh

The results should show that 39 xml tables and 4 cdws tables have loaded. The following tables will show a count of 0:

cdws.t_class_hierarchies
xml.t_revision_history
xml.t_rule_47_flag
xml.t_technical_data 
xml.t_us_sir_flag

The following tables will be populated if you have a Premium Plus subscription. For Basic and Premium subscriptions, they will show a count of 0:

xml.t_keywords
xml.t_statistical_information

More information about the tables can be seen in Data Warehouse Design.

17. Optional: you may want to run a simple SQL query as an additional test to confirm that the data is present.

echo "select * from xml.t_patent_document_values where ucid = 'US-5551212-A'" | psql -U alexandria
Next Steps

Once the data has been loaded, proceed to Client Tools Installation.