[Preparing DBMS Benchmark] Install PostgreSQL 9.6.3 on CentOS 7.2
처음시작은 PostgreSQL로 시작을 해보도록 하자
두근두근... 안친한 친구라서 친하게 지내줄지 모르겠지만 최대한 다가가도록 하겠다
https://www.postgresql.org/download/linux/redhat/
위 링크를 클릭하고 설치에 대한 설명을 아래와 같이 확인하고 설치를 진행하자
yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm yum install postgresql96 yum install postgresql96-server /usr/pgsql-9.6/bin/postgresql96-setup initdb systemctl enable postgresql-9.6 systemctl start postgresql-9.6 |
Step 1. yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm
[root@localhost ~]# yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96 -9.6-3.noarch.rpm Loaded plugins: fastestmirror pgdg-centos96-9.6-3.noarch.rpm | 4.7 kB 00:00:00 Examining /var/tmp/yum-root-F5ZBLY/pgdg-centos96-9.6-3.noarch.rpm: pgdg-centos96-9.6-3.noarch Marking /var/tmp/yum-root-F5ZBLY/pgdg-centos96-9.6-3.noarch.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package pgdg-centos96.noarch 0:9.6-3 will be installed --> Finished Dependency Resolution Dependencies Resolved ==================================================================================================================== Package Arch Version Repository Size ==================================================================================================================== Installing: pgdg-centos96 noarch 9.6-3 /pgdg-centos96-9.6-3.noarch 2.7 k Transaction Summary ==================================================================================================================== Install 1 Package Total size: 2.7 k Installed size: 2.7 k Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : pgdg-centos96-9.6-3.noarch [ ] 1/1 Installing : pgdg-centos96-9.6-3.noarch [## ] 1/1 Installing : pgdg-centos96-9.6-3.noarch [######################################## ] 1/1 Installing : pgdg-centos96-9.6-3.noarch [################################################################ ] 1/1 Installing : pgdg-centos96-9.6-3.noarch 1/1 Verifying : pgdg-centos96-9.6-3.noarch 1/1 Installed: pgdg-centos96.noarch 0:9.6-3 Complete! |
Step 2. yum install postgresql96
[root@localhost ~]# yum install postgresql96 Loaded plugins: fastestmirror base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 pgdg96 | 4.1 kB 00:00:00 updates | 3.4 kB 00:00:00 (2/2): pgdg96/7/x86_64/primary_db 0% [ ] 0.0 B/s | 0 B --:--:-- ETA (1/2): pgdg96/7/x86_64/group_gz | 249 B 00:00:03 (2/2): pgdg96/7/x86_64/primary_db 62% [====================- ] 0.0 B/s | 96 kB --:--:-- ETA (2/2): pgdg96/7/x86_64/primary_db | 154 kB 00:00:04 Loading mirror speeds from cached hostfile * base: mirror.xnet.co.nz * extras: mirror.xnet.co.nz * updates: mirror.xnet.co.nz Resolving Dependencies --> Running transaction check ---> Package postgresql96.x86_64 0:9.6.3-1PGDG.rhel7 will be installed --> Processing Dependency: postgresql96-libs(x86-64) = 9.6.3-1PGDG.rhel7 for package: postgresql96-9.6.3-1PGDG.rhel7.x86_64 --> Processing Dependency: libpq.so.5()(64bit) for package: postgresql96-9.6.3-1PGDG.rhel7.x86_64 --> Running transaction check ---> Package postgresql96-libs.x86_64 0:9.6.3-1PGDG.rhel7 will be installed --> Finished Dependency Resolution Dependencies Resolved ==================================================================================================================== Package Arch Version Repository Size ==================================================================================================================== Installing: postgresql96 x86_64 9.6.3-1PGDG.rhel7 pgdg96 1.3 M Installing for dependencies: postgresql96-libs x86_64 9.6.3-1PGDG.rhel7 pgdg96 310 k Transaction Summary ==================================================================================================================== Install 1 Package (+1 Dependent package) Total download size: 1.6 M Installed size: 8.0 M Is this ok [y/d/N]: y Downloading packages: (2/2): postgresql96-libs-9.6.3-1PGDG.rhel7. 0% [ ] 0.0 B/s | 0 B --:--:-- ETA (2/2): postgresql96-libs-9.6.3-1PGDG.rhel7. 5% [=- ] 0.0 B/s | 96 kB --:--:-- ETA (2/2): postgresql96-libs-9.6.3-1PGDG.rhel7. 15% [===== ] 257 kB/s | 256 kB 00:00:05 ETA (1/2): postgresql96-libs-9.6.3-1PGDG.rhel7.x86_64.rpm | 310 kB 00:00:04 (2/2): postgresql96-9.6.3-1PGDG.rhel7.x86_6 57% [==================- ] 365 kB/s | 966 kB 00:00:01 ETA (2/2): postgresql96-9.6.3-1PGDG.rhel7.x86_64.rpm | 1.3 MB 00:00:05 -------------------------------------------------------------------------------------------------------------------- Total 306 kB/s | 1.6 MB 00:00:05 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : postgresql96-libs-9.6.3-1PGDG.rhel7.x86_64 [################################################## ] 1/2 Installing : postgresql96-libs-9.6.3-1PGDG.rhel7.x86_64 1/2 Installing : postgresql96-9.6.3-1PGDG.rhel7.x86_64 [####################################################### ] 2/2 Installing : postgresql96-9.6.3-1PGDG.rhel7.x86_64 2/2 Verifying : postgresql96-libs-9.6.3-1PGDG.rhel7.x86_64 1/2 Verifying : postgresql96-9.6.3-1PGDG.rhel7.x86_64 2/2 Installed: postgresql96.x86_64 0:9.6.3-1PGDG.rhel7 Dependency Installed: postgresql96-libs.x86_64 0:9.6.3-1PGDG.rhel7 Complete! |
Step 3. yum install postgresql96-server
[root@localhost ~]# yum install postgresql96-server Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.xnet.co.nz * extras: mirror.xnet.co.nz * updates: mirror.xnet.co.nz Resolving Dependencies --> Running transaction check ---> Package postgresql96-server.x86_64 0:9.6.3-1PGDG.rhel7 will be installed --> Finished Dependency Resolution Dependencies Resolved ==================================================================================================================== Package Arch Version Repository Size ==================================================================================================================== Installing: postgresql96-server x86_64 9.6.3-1PGDG.rhel7 pgdg96 4.3 M Transaction Summary ==================================================================================================================== Install 1 Package Total download size: 4.3 M Installed size: 18 M Is this ok [y/d/N]: y Downloading packages: postgresql96-server-9.6.3-1PGDG.rhel7.x86_6 84% [===========================- ] 742 kB/s | 3.6 MB 00:00:00 ETA postgresql96-server-9.6.3-1PGDG.rhel7.x86_64.rpm | 4.3 MB 00:00:06 Running transaction check Running transaction test Transaction test succeeded Running transaction
Installing : postgresql96-server-9.6.3-1PGDG.rhel7.x86_64 [################################################ ] 1/1 Installing : postgresql96-server-9.6.3-1PGDG.rhel7.x86_64 1/1 Verifying : postgresql96-server-9.6.3-1PGDG.rhel7.x86_64 1/1 Installed: postgresql96-server.x86_64 0:9.6.3-1PGDG.rhel7 Complete! |
Step 4. /usr/pgsql-9.6/bin/postgresql96-setup initdb
[root@localhost ~]# /usr/pgsql-9.6/bin/postgresql96-setup initdb Initializing database ... OK [root@localhost ~]# systemctl enable postgresql-9.6 Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-9.6.service to /usr/lib/systemd/system/postgresql-9.6.service. [root@localhost ~]# systemctl start postgresql-9.6 |
설치는 끝..
포트확인 및 구동확인
[root@localhost ~]# ps -ef |grep postgres postgres 2595 1 0 17:42 ? 00:00:00 /usr/pgsql-9.6/bin/postmaster -D /var/lib/pgsql/9.6/data/ postgres 2597 2595 0 17:42 ? 00:00:00 postgres: logger process postgres 2599 2595 0 17:42 ? 00:00:00 postgres: checkpointer process postgres 2600 2595 0 17:42 ? 00:00:00 postgres: writer process postgres 2601 2595 0 17:42 ? 00:00:00 postgres: wal writer process postgres 2602 2595 0 17:42 ? 00:00:00 postgres: autovacuum launcher process postgres 2603 2595 0 17:42 ? 00:00:00 postgres: stats collector process [root@localhost ~]# netstat -an |grep LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp6 0 0 :::22 :::* LISTEN tcp6 0 0 ::1:5432 :::* LISTEN tcp6 0 0 ::1:25 :::* LISTEN |
잘되어있고
[root@localhost ~]# su - postgres -bash-4.2$ psql psql (9.6.3) Type "help" for help. postgres=# select datname from pg_database where datistemplate = false; datname ---------- postgres (1 row) postgres=# |
잘 확인했고
유저만들자
[root@localhost ~]# su - postgres Last login: Thu Aug 3 17:46:05 EDT 2017 on pts/0 -bash-4.2$ psql psql (9.6.3) Type "help" for help. postgres=# \du List of roles Role name | Attributes | Member of -----------+------------------------------------------------------------+----------- postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {} postgres=# CREATE USER test1 WITH postgres-# LOGIN postgres-# SUPERUSER postgres-# CREATEDB postgres-# CREATEROLE postgres-# INHERIT postgres-# NOREPLICATION postgres-# CONNECTION LIMIT -1 postgres-# PASSWORD '********'; CREATE ROLE postgres=# GRANT postgres TO test1; GRANT ROLE postgres=# \du List of roles Role name | Attributes | Member of -----------+------------------------------------------------------------+------------ postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {} test1 | Superuser, Create role, Create DB | {postgres} postgres=# |
끝