Infra/Linux
CentOS 7 버전 linux에 postgresql 13버전 설치
김오성
2024. 7. 15. 17:26
postgresql 13버전 설치
yum update -y
cd > [to workspace]
yum install -y pgdg-redhat-repo-latest.noarch.rpm
sudo yum install -y postgresql13 postgresql13-server
sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
sudo systemctl start postgresql-13
sudo systemctl enable postgresql-13
postgresql 계정 설정
sudo -i -u postgres
psql
CREATE USER testuser WITH PASSWORD 'test2020@' ;
ALTER USER testuser WITH SUPERUSER ;
\du
database 생성
CREATE DATABASE test OWNER testuser ;
GRANT ALL PRIVILEGES ON DATABASE test TO testuser ;
\l
접속 권한 설정
sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /var/lib/pgsql/13/data/postgresql.conf
echo "host all all 0.0.0.0/0 md5" | sudo tee -a /var/lib/pgsql/13/data/pg_hba.conf
postgresql 설정 적용 재실행
sudo systemctl restart postgresql-13
sudo systemctl status postgresql-13
Dbeaver 등 tool을 이용 접속 확인
