Install PostgreSQL (on Linux)
sudo apt install postgresql # postgresql 설치
systemctl enable postgresql
systemctl start postgresql
systemctl status postgresql
sudo -i -u postgres # 마스터계정 postgres로 접속
psql # postgres 명령어 쉘
postgres=#
>> create user {name} password '{pw}' superuser;
>> \du # user와 권환 확인
>> create database {db_name} owner {user};
>> \l # db 리스트 확인
>> \q
>> exit # 접속 종료
psql -U {user} -d {db_name}
Install pgAdmin4
- 아래의 링크 클릭후, 자신의 OS에 맞는 pgAdmin4 클릭
Download
Download pgAdmin is a free software project released under the PostgreSQL licence. The software is available in source and binary format from the PostgreSQL mirror network. Because compiling from source requires technical knowledge, we recommend installing
www.pgadmin.org
- 아래의 명령어를 따라 desktop 버전 혹은 web 버전을 설치
# Setup the repository
# Install the public key for the repository (if not done previously):
curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg
# Create the repository configuration file:
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
# Install pgAdmin(choose 1/2/3)
# 1. Install for both desktop and web modes:
sudo apt install pgadmin4
# 2. Install for desktop mode only:
sudo apt install pgadmin4-desktop
# 3. Install for web mode only:
sudo apt install pgadmin4-web
# Configure the webserver, if you installed pgadmin4-web:
sudo /usr/pgadmin4/bin/setup-web.sh
# set E-mail & Password
- web버전을 선택한 경우, 로컬에서
http://{ip}/pgadmin4접속하여 위에서 설정한 email과 pw로 로그인 - pgAdmin4 웹에 접속하여
Add new Server을 선택하여Host는 localhost로 설정하고 username과 postgreSQL을 설치할 때 사용한 password들을 차례로 입력하고 save한다
728x90
'알쓸신잡' 카테고리의 다른 글
| ngrok 사용법 (0) | 2025.03.07 |
|---|---|
| Docker Install on Ubuntu (0) | 2025.02.21 |
| PostgreSQL 환경설정 (0) | 2025.02.21 |
| Obsidian Icloud calendar 동기화 (0) | 2025.02.20 |
| Cursor + Ollama (0) | 2025.02.07 |