728x90
1. PostgreSQL RPM 다운로드
yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
2. PostgreSQL12 설치
yum -y install postgresql12-server
3. 전용 user 생성
useradd postgres
4. 환경변수 설정
vi ./.bash_profile
PGHOME='/usr/pgsql-12'
PGDATA='/home/postgres/pgdata'
PATH=$PATH:$HOME/.local/bin:$HOME/bin:/usr/pgsql-12/bin
export PATH
source ./.bash_profile
5. PGDATA 디렉토리 생성
cd /home/postgres
mkdir pgdata
6. Cluster 생성
[postgres@localhost ~]$ initdb -D $PGDATA
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /home/postgres/pgdata ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Asia/Seoul
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
pg_ctl -D /home/postgres/pgdata -l logfile start
7. Postgresql DB start
[postgres@localhost ~]$ pg_ctl start -D $PGDATA
waiting for server to start....2022-05-02 10:27:43.366 KST [2533] LOG: starting PostgreSQL 12.10 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
2022-05-02 10:27:43.369 KST [2533] LOG: listening on IPv6 address "::1", port 5432
2022-05-02 10:27:43.369 KST [2533] LOG: listening on IPv4 address "127.0.0.1", port 5432
2022-05-02 10:27:43.376 KST [2533] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2022-05-02 10:27:43.385 KST [2533] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2022-05-02 10:27:43.403 KST [2533] LOG: redirecting log output to logging collector process
2022-05-02 10:27:43.403 KST [2533] HINT: Future log output will appear in directory "log".
done
server started
8. Login
[postgres@localhost ~]$ psql -U postgres
psql (12.10)
Type "help" for help.
postgres=#
728x90
반응형
'PostgreSQL > Admin' 카테고리의 다른 글
[PostgreSql] 기본 모니터링 방법(2) (0) | 2024.06.20 |
---|---|
[PostgreSQL] 기본 모니터링 방법(1) (0) | 2024.06.20 |
[PostgreSQL] 성능 관련 Parameter Tunning(1) (0) | 2023.03.17 |
[PostgreSQL] PostgreSQL 기본 Architecture (0) | 2022.11.04 |
[PostgreSQL]테이블 사이즈 확인 (0) | 2022.04.22 |