Installation

1. Introduction

The installation methods for IvorySQL include the following four:

This chapter will provide detailed instructions on the installation, execution, and uninstallation processes for each method. For a quicker access to IvorySQL, please refer to Quick installation.

2. Yum installation

  • Run yum install commands

$ sudo yum install -y https://yum.highgo.ca/dists/ivorysql-rpms/repo/ivorysql-release-3.0-1.noarch.rpm

$ sudo yum install -y ivorysql3 ivorysql3-server ivorysql3-contrib ivorysql3-test

IvorySQL then will be installed in the /usr/local/ivorysql directory.

Yum configuration file /etc/yum.repos.d/ivorysql.repo will be created after the successful installation.

  • Checking installation results

yum search ivorysql

Details:

id

Package name

Description

1

ivorysql3.x86_64

IvorySQL client programs and lib files

2

ivorysql3-contrib.x86_64

Contributed source code and binary files released with IvorySQL

3

Ivorysql3-devel.x86_64

IvorySQL development header files and libraries

4

Ivorysql3-docs.x86_64

Additional docs for IvorySQL

5

ivorysql3-libs.x86_64

Shared libraries required by all IvorySQL clients

6

Ivorysql3-llvmjit.x86_64

Instant compilation support for IvorySQL

7

Ivorysql3-plperl.x86_64

Perl, a procedural language for IvorySQL

8

Ivorysql3-plpython3.x86_64

Python3, a procedural language for IvorySQL

9

Ivorysql3-pltcl.x86_64

Tcl, a procedural language for IvorySQL

10

ivorysql3-server.x86_64

The programs required to create and run an IvorySQL server

11

Ivorysql3-test.x86_64

Test suite released with IvorySQL

12

ivorysql-release.noarch

Yum Source Configuration RPM Package of HighGo

3. Docker installation

  • Get IvorySQL image from Docker Hub

$ docker pull ivorysql/ivorysql:3.1-ubi8
  • Run IvorySQL

$ docker run --name ivorysql -p 5434:5432 -e IVORYSQL_PASSWORD=your_password -d ivorysql/ivorysql:3.1-ubi8

-e Parameter Explanation

Parameter Name

Required

Description

IVORYSQL_USER

No

Database user, default is ivorysql

IVORYSQL_PASSWORD

yes

Database password

IVORYSQL_DB

no

Database name,default is ivorysql

POSTGRES_HOST_AUTH_METHOD

no

Modify host authentication method,reference value:md5

POSTGRES_INITDB_ARGS

no

Add additional parameters to initdb,reference value:"--data-checksums"

PGDATA

no

Define the data directory to be located in another path or folder (e.g., subdirectory), defaulting to /var/lib/ivorysql/data

POSTGRES_INITDB_WALDIR

no

Define the IvorySQL transaction folder path, which defaults to a subdirectory within the data directory (PGDATA)

  1. It is not recommended to set the POSTGRES_HOST_AUTH_METHOD parameter to trust, as this will make the IVORYSQL_PASSWORD setting ineffective.

  2. If the POSTGRES_HOST_AUTH_METHOD parameter is set to scram-sha-256, it is also necessary to set POSTGRES_INITDB_ARGS to --auth-host=scram-sha-256 to ensure proper initialization of the database.

4. rpm installation

  • Installing dependencies

$ sudo yum install -y libicu libxslt python3
$ sudo yum --disablerepo=* localinstall *.rpm
  • Getting rpms

$ sudo wget https://github.com/IvorySQL/IvorySQL/releases/download/IvorySQL_3.1/ivorysql3-libs-3.1-1.rhel7.x86_64.rpm

$ sudo wget
https://github.com/IvorySQL/IvorySQL/releases/download/IvorySQL_3.1/ivorysql3-3.1-1.rhel7.x86_64.rpm

$ sudo wget https://github.com/IvorySQL/IvorySQL/releases/download/IvorySQL_3.1/ivorysql3-contrib-3.1-1.rhel7.x86_64.rpm

$ sudo wget
https://github.com/IvorySQL/IvorySQL/releases/download/IvorySQL_3.1/ivorysql3-server-3.1-1.rhel7.x86_64.rpm
  • Installing rpms

    Install the rpms in the following order, since the latters depend on the formers:

$ sudo rpm -ivh ivorysql3-libs-3.1-1.rhel7.x86_64.rpm
$ sudo rpm -ivh ivorysql3-3.1-1.rhel7.x86_64.rpm
$ sudo rpm -ivh ivorysql3-server-3.1-1.rhel7.x86_64.rpm --nodeps
$ sudo rpm -ivh ivorysql3-contrib-3.1-1.rhel7.x86_64.rpm

IvorySQL then will be installed in the /usr/local/ivorysql directory.

5. Source code installation

  • Installing dependencies

$ sudo yum install -y bison-devel readline-devel zlib-devel openssl-devel
$ sudo yum groupinstall -y 'Development Tools'
  • Getting source code

$ git clone https://github.com/IvorySQL/IvorySQL.git
  • Configuring

    In the IvorySQL directory run the following command with --prefix to specify the directory where you want the database to be installed:

$ ./configure --prefix=/usr/local/ivorysql/ivorysql-3
  • Compiling

    Run the following command to compile the source code:

$ make
  • Installing

    Run the following command to install the database system, IvorySQL then will be installed in the directory specified by --prefix:

$ sudo make install

When the compilation is completed, you can test the result with 'make check' or 'make all-check-world' before your installation

6. Start Database

Users following the instructions in Yum installation, rpm installation, and Source code installation need to manually start the database.

Execute the following command to grant permissions to the installation user. The example user is ivorysql, and the installation directory is /usr/local/ivorysql.:

$ sudo chown -R ivorysql:ivorysql /usr/local/ivorysql
  • Setting environment variables

    Add below contents in ~/.bash_profile file and source to make it effective:

PATH=/usr/local/ivorysql/ivorysql-3/bin:$PATH
export PATH
LD_LIBRARY_PATH=/usr/local/ivorysql/ivorysql-3/lib
export LD_LIBRARY_PATH
PGDATA=/usr/local/ivorysql/ivorysql-3/data
export PGDATA
$ source ~/.bash_profile
  • Initializing database

$ initdb -D /usr/local/ivorysql/ivorysql-3/data
  The -D option specifies the directory where the database cluster should be stored. This is the only information required by initdb, but you can avoid writing it by setting the PGDATA environment variable, which can be convenient since the database server can find the database directory later by the same variable.

  For more options, refer to initdb --help.
  • Starting IvorySQL service

$ pg_ctl -D /usr/local/ivorysql/ivorysql-3/data -l ivory.log start

The -D option specifies the file system location of the database configuration files. If this option is omitted, the environment variable PGDATA in [setting-environment-variables] is used. -l option appends the server log output to filename. If the file does not exist, it is created.

For more options, refer to pg_ctl --help.

Confirm it’s successfully started:

$ ps -ef | grep postgres
ivorysql  3214     1  0 20:35 ?        00:00:00 /usr/local/ivorysql/ivorysql-3/bin/postgres -D /usr/local/ivorysql/ivorysql-3/data
ivorysql  3215  3214  0 20:35 ?        00:00:00 postgres: checkpointer
ivorysql  3216  3214  0 20:35 ?        00:00:00 postgres: background writer
ivorysql  3218  3214  0 20:35 ?        00:00:00 postgres: walwriter
ivorysql  3219  3214  0 20:35 ?        00:00:00 postgres: autovacuum launcher
ivorysql  3220  3214  0 20:35 ?        00:00:00 postgres: logical replication launcher
ivorysql  3238  1551  0 20:35 pts/0    00:00:00 grep --color=auto postgres

7. Connecting to IvorySQL

Connect to IovrySQL via psql:

$ psql -d <database>
psql (16.1)
Type "help" for help.

ivorysql=#
  The -d option specifies the name of the database to connect to. ivorysql is the default database of IvorySQL. However,IvorySQL of lower versions need the users themselves to connect to postgres database at the first connection and then create the ivorysql database.The latest IvorySQL can do all these for users.

  For more options, refer to psql --help.
When running IvorySQL in Docker, additional parameters need to be added, like: psql -d ivorysql -U ivorysql -h 127.0.0.1 -p 5434

8. Uninstallation

No matter which method is used for the uninstallation, make sure the service has been stopped cleanly and your data has been backed up safely.

8.1. Uninstallation for yum installation

Run the following commands in turn and clean the residual folders:

$ sudo yum remove -y ivorysql3 ivorysql3-server ivorysql3-contrib ivorysql3-test
$ sudo rpm -e ivorysql-release-3.0-1.noarch
$ sudo rm -rf /usr/local/ivorysql

8.2. Uninstallation for docker installation

Stop IvorySQL container and remove IvorySQL image:

$ docker stop ivorysql
$ docker rm ivorysql
$ docker rmi ivorysql/ivorysql:3.1-ubi8

8.3. Uninstallation for rpm installation

Query the rpms installed and uninstall them in turn, then clear the residual folders:

$ rpm -qa | grep ivorysql
$ sudo rpm -e ivorysql3-contrib-3.1-1.rhel7.x86_64
$ sudo rpm -e ivorysql3-server-3.1-1.rhel7.x86_64
$ sudo rpm -e ivorysql3-3.1-1.rhel7.x86_64
$ sudo rpm -e ivorysql3-libs-3.1-1.rhel7.x86_64
$ sudo rm -rf /usr/local/ivorysql

8.4. Uninstallation for source code installation

Uninstall the database system, then clear the residual folders:

sudo make uninstall
make clean
sudo rm -rf /usr/local/ivorysql