PostgreSQL Install

2025. 2. 21. 00:09·알쓸신잡

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

  1. 아래의 링크 클릭후, 자신의 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

  1. 아래의 명령어를 따라 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
  1. web버전을 선택한 경우, 로컬에서 http://{ip}/pgadmin4 접속하여 위에서 설정한 email과 pw로 로그인
  2. 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
'알쓸신잡' 카테고리의 다른 글
  • ngrok 사용법
  • Docker Install on Ubuntu
  • PostgreSQL 환경설정
  • Obsidian Icloud calendar 동기화
창빵맨
창빵맨
  • 창빵맨
    Let's be Developers
    창빵맨
    로그인/로그아웃
  • 전체
    오늘
    어제
    • 분류 전체보기 (471)
      • 알쓸신잡 (79)
      • ML & DL (85)
        • Computer v.. (22)
        • NLP (22)
        • 파이썬 머신러닝 완.. (3)
        • 개념정리 (38)
      • 리눅스 (21)
      • 프로젝트 (29)
        • 산불 발생 예측 (6)
        • 음성비서 (12)
        • pdf 병합 프로그.. (0)
        • 수위 예측 (5)
        • 가짜 뉴스 분류 (5)
        • 전력사용량 예측 (1)
      • 코딩테스트 (217)
        • 프로그래머스[Pyt.. (17)
        • 프로그래머스[Fai.. (3)
        • 백준[Python] (160)
        • 이것이취업을위한코딩.. (18)
        • 파이썬 알고리즘 (19)
      • 데이터분석실습 (25)
        • 데이터 과학 기반의.. (18)
        • 헬로 데이터 과학 (7)
      • 메모장 (0)
      • 잡담 (4)
  • Personal

    GITHUB
    Instagram
  • 공지사항

  • 인기 글

  • 태그

    백준
    나동빈
    이것이취업을위한코딩테스트다
    이코테
    그리디
    이분탐색
    BFS
    DFS
    파이썬
    dp
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3

HOME

HOME

상단으로

티스토리툴바