This task installs PostgreSQL for Linux Servers
Procedure :
- Log in as root user:
sudo su
- Download the PostgreSQL source:
wget https://ftp.postgresql.org/pub/source/v9.5.13/postgresql-9.5.13.tar.gz
- Install PostgreSQL using the following commands:
tar -zxvf postgresql-9.5.13.tar.gz
cd postgresql-9.5.13/
yum -y install readline-devel
./configure --prefix=/usr/local/postgresql
make
make install
- Create the postgres user and change the owner of the postgres directory :
useradd postgres
chown -R postgres:postgres /usr/local/postgresql/
- Log in as the postgres user:
su postgres
- Configure the system path for postgres:
vi ~/.bashrc
PGHOME=/usr/local/postgresql
export PGHOME
PGDATA=/usr/local/postgresql/data
export PGDATA
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$PGHOME/bin
export PATH
- Reload the configuration using the source command:
source ~/.bashrc
- Initialize the PostgreSQL database:
initdb
- Configure the database. Open postgresql.conf in vi:
vi /usr/local/postgresql/data/postgresql.conf
Replace:
#listen_address='localhost'
#port = 5432
about :
listen_address='*'
port = 5432
- Open the pg_hba.conf file in vi:
vi /usr/local/postgresql/data/pg_hba.conf
Add the following line to the file:
host all all 0.0.0.0/0 trust
- Restart postgresql:
pg_ctl -D /usr/local/postgresql/data -l logfile restart
- Change the password for the postgres user in the PostgreSQL database: If the postgresql service is not started, run the following commands:
Add /usr/local/pgsql/bin/
to the file: Run the following command:
psql
ALTER USER postgres WITH PASSWORD 'mot_de_passe';
\q
su postgres
vi ~/.bashrc
export PATH=/usr/local/cuda-8.0/bin:$PATH:/usr/local/pgsql/bin/
source ~/.bashrc
- Create the database schema in PostgreSQL. Run the following command on the psql console:
create database edge with owner postgres encoding='UTF-8' lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
In the database, create the following tables:
CREATE TABLE vi_titulaire_inspectionresult(id text, info jsonb);
CREATE TABLE vi_titulaire_notification(id text, info jsonb);
CREATE TABLE vi_titulaire_defectsummary(id text, info jsonb);
CREATE TABLE vi_titulaire_uploaddataset(id text, info jsonb);
CREATE TABLE vi_titulaire_syncprocess(id text, info jsonb);
CREATE TABLE vi_titulaire_model(id text, info jsonb);
CREATE TABLE vi_titulaire_datagroup(id text, info jsonb);
Top comments (0)