PostgreSQL installation on macOS
PostgreSQL is an open-source object-relational database. It is a popular database choice when using a relational database. Latest version of PostgreSQL is 10.x and but on some servers we are also using version 9.6.
Steps
Step 1: Download the postgresql package
Click on the following link to download the package and select the postgresql version and your operating system(mac)
https://www.enterprisedb.com/downloads/postgres-postgresql-downloads#macosx
Step 2: Install the postgresql package
Double-click on the package and install it. You need to provide the postgressql user password.
Step 3: Set environment variables for macOS
Open a terminal in your Mac and then open the profile file with any editor and paste the below line in your profile file.
Profile file can be .profile or .bash_profile in your home directory:
export PATH=/Library/PostgreSQL/9.6/bin/:$PATH
Step 4: Create corpus user and database
Then execute the "postgresql-create-user.sql" script to create the "corpus" user, "corpus" database and "type casts" by the following command:
psql -U postgres -f (path to postgresql-create-user.sql)
psql -U corpus -d corpus -f (path to postgresql-create-db.sql)
psql: FATAL: Peer authentication failed for user "corpus"
# "local" is for Unix domain socket connections only local all all trust
For PostgreSQL-10 version:
[root@de-nue-sri ~]# su - postgres
-bash-4.2$ cd /usr/pgsql-10/bin/
-bash-4.2$ ./pg_ctl reload -D /var/lib/pgsql/10/data/
server signaled
-bash-4.2$
For PostgreSQL-9.6 version:
[root@de-nue-sri ~]# su - postgres
-bash-4.2$ cd /usr/pgsql-9.6/bin/
-bash-4.2$ ./pg_ctl reload -D /var/lib/pgsql/9.6/data/
server signaled
-bash-4.2$
Step 5: Configuration change in censhare
After creating the PostgreSQL database, change the config.xml file and provide the information of the PostgreSQL database.
Open censhare-Custom/censhare-Server/app/services/database/config.xml and replace the line as following:
old > ("jdbc:oracle:thin:@localhost:1521:XE")
new > ("jdbc:postgresql://localhost:5432/corpus")