Monday, 29 May 2017

[PostgreSQL] Install PostgreSQL


1.Install Server & Libraries

#> yum -y install postgresql-server postgresql-contrib





2. Initialize database

#> postgresql-setup initdb



3. Edit configuration

#> su - postgres
$> cd data
$> vi pg_hba.conf

TYPE    DATABASE  USER    ADDRESS         METHOD
host    all       all     127.0.0.1/32    md5
host    all       all     192.168.0.0/24  md5
host    all       all     0.0.0.0/0       md5






$> vi postgresql.conf




4. Start server

#> systemctl start postgresql
#> systemctl status postgresql




5. Create DB

#> su - postgres
$> createdb [DB_NAME]




6. Create user and grant privilege

$> psql -s [DB_NAME]
$> create user [USER_NAME] password '[PASSWORD]';
$> GRANT ALL PRIVILEGES ON DATABASE [DB_NAME] TO [USER_NAME];




No comments:

Post a Comment