페이지 트리

버전 비교

  • 이 줄이 추가되었습니다.
  • 이 줄이 삭제되었습니다.
  • 서식이 변경되었습니다.

자동 설치 본으로 설치 시 PostgreSQL의 Tomcat의 보안 취약점으로 인한 버전 업그레이드가 필요할 경우 아래의 순서로 작업하여주시길 바랍니다.

PostgreSQL v10.7 → PostgreSQL v16.3(작성 당시 최신 버전으로의 업그레이드를 고려하고 작성된 문서입니다.)


1. 500버전 (Tomcat 9.0.84.0 → 9.0.106.0)

코드 블럭
languagebash
titlePostgreSQL 업그레이드 쉘
## AUD 자동 설치본을 기준으로 작성하였습니다.
## 자동 설치본 경로 : /AUDPlatform
## APP 실행 계정 : AUD

# 1. 라이브러리사전 설치
sudo apt update && sudo apt install -y build-essential libreadline-dev zlib1g-dev flex bison curl ca-certificates gnupg lsb-release libicu-dev pkg-config libssl-dev

확인 & 백업
./AUDPlatform/bin/commander.sh -k was
tar czf /AUDPlatform/apps/tomcat_back.tar
mv /AUDPlatform/apps/tomcat /AUDPlatform/apps/tomcat_back



# 2. PostgreSQL최신 설치Tomcat 파일9 다운로드 및 검증
cd /AUDPlatform/apps
wgetcurl -O https://ftpdlcdn.postgresqlapache.org/pubtomcat/sourcetomcat-9/v16v9.3/postgresql-16.3.0.108/bin/apache-tomcat-9.0.108.tar.gz
tarcurl xzf postgresql-16.3.tar.gz && cd postgresql-16.3

-O https://downloads.apache.org/tomcat/tomcat-9/v9.0.108/bin/apache-tomcat-9.0.108.tar.gz.sha512
sha512sum -c apache-tomcat-9.0.108.tar.gz.sha512


# 3. PostgreSQL압축 설치해제 & 권한 변경버전 ./configure --prefix=/AUDPlatform/apps/pgsql16 --with-openssl --with-readline
make -j$(nproc)
sudo make install
chown -R AUD:AUD /AUDPlatform/apps/*준비
tar xvf apache-tomcat-9.0.108.tar.gz
mv apache-tomcat-9.0.108 tomcat


# 4. PostgreSQL 데이터 디렉토리 설정 및 설정 변경 /AUDPlatform/apps/pgsql16/bin/initdb -D /AUDPlatform/apps/pg16 --username=postgres --pwfile=<(echo "postgres!!")


# 5. Start & Stop - 6. Backup & Dump를 위한 임시 기동 명령어
적용 : 초기 설정에서 기존 conf와 bin만 수정
cp -pvfr /AUDPlatform/apps/pgsql16/bin/pg_ctl -D /AUDPlatform/data/pg16 -l /AUDPlatform/logs/pg16.log start
# /AUDPlatform/apps/pgsql16/bin/pg_ctl -D /AUDPlatform/data/pg16 stop

# 6. Backup & Dump - 기존, 신규 PostgreSQL이 실행중 일 때 실행 (Password: postgres!!)
tomcat_back/conf /AUDPlatform/apps/tomcat/conf
cp -pvfr /AUDPlatform/apps/pgsql/bin/pg_dumpall -h localhost -U postgres -p 5433 -f /AUDPlatform/apps/pgsql16/bin/db.dmp
/tomcat_back/bin/AUDPlatform/apps/pgsql16tomcat/bin/psql
-h
localhost
-U
postgres
-p# 54325. -U버전 postgres -d postgres -f 확인
./AUDPlatform/apps/pgsql16tomcat/bin/dbversion.dmpsh

##
기존
버전과의# 차이6. 때문에 권한 수정 필요
## psql실행이 안될 경우
## 'export LD_LIBRARY_PATH=/AUDPlatform/apps/pgsql/lib:$LD_LIBRARY_PATH'
/AUDPlatform/apps/pgsql16/bin/psql -h localhost -U postgres -p 5432 -U postgres -d postgres -c "GRANT ALL PRIVILEGES ON DATABASE matrixdb TO matrix;"
/AUDPlatform/apps/pgsql16/bin/psql -h localhost -U postgres -p 5432 -U postgres -d postgres -c "ALTER DATABASE matrixdb OWNER TO matrix;"

# 7. 중지 및 디렉토리 정리
## WAS, DB, META 중지
Start
./AUDPlatform/bin/commander.sh -s was


2. 510버전 (Tomcat 10.1.41.0 → 10.1.46.0)


코드 블럭
languagebash
titlePostgreSQL 업그레이드 쉘
## AUD 자동 설치본을 기준으로 작성하였습니다.
## 자동 설치본 경로 : /AUDPlatform
## APP 실행 계정 : AUD

# 1. 사전 확인 & 백업
./AUDPlatform/bin/commander.sh -k was
/AUDPlatform/bin/commander.sh -k meta
tar czf /AUDPlatform/bin/commander.sh -k db
/AUDPlatform/apps/pgsql16/bin/pg_ctl -D /AUDPlatform/data/pg16 stop
## 기존 DB 디렉토리 백업
mkdir /AUDPlatform/apps/oldDB
apps/tomcat_back.tar
mv /AUDPlatform/apps/pgsqltomcat /AUDPlatform/apps/oldDB/pgsqltomcat_oldback
mv
/AUDPlatform/pgData
/AUDPlatform/apps/oldDB/pgData_old
##
신규# DB2. 디렉토리최신 변경Tomcat mv /AUDPlatform/apps/pgsql16 /AUDPlatform/apps/pgsql
mv /AUDPlatform/apps/pg1610 다운로드 및 검증
cd /AUDPlatform/apps/pgData
curl # 8. 신규 DB설정 변경
## postgresql.conf파일 하위에 설정 추가
vi /AUDPlatform/apps/pgData/postgresql.conf
#-------------------------------------------------------------------------
listen_addresses = '*'
port = 5433
#-------------------------------------------------------------------------

## pg_hba.conf파일 하위에 설정 변경 및 추가
vi /AUDPlatform/apps/pgData/pg_hba.conf
#-------------------------------------------------------------------------
# TYPE  DATABASE        USER            ADDRESS                 METHOD
# "local" is for Unix domain socket connections only
local   all             all                                     password
# IPv4 local connections:
host    all             all             127.0.0.1/32            password
# IPv6 local connections:
host    all             all             ::1/128                 password
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     password
host    replication     all             127.0.0.1/32            password
host    replication     all             ::1/128                 password
host    all             all             0.0.0.0/0               password
#-------------------------------------------------------------------------

# 9. 시스템 기동
/AUDPlatform/bin/commander.sh -s db
/AUDPlatform/bin/commander.sh -s was
-O https://dlcdn.apache.org/tomcat/tomcat-10/v10.1.46/bin/apache-tomcat-10.1.46.tar.gz
curl -O https://downloads.apache.org/tomcat/tomcat-10/v10.1.46/bin/apache-tomcat-10.1.46.tar.gz.sha512
sha512sum -c apache-tomcat-10.1.46.tar.gz.sha512


# 3. 압축 해제 & 새 버전 준비
tar xvf apache-tomcat-10.1.46.tar.gz
mv apache-tomcat-10.1.46 tomcat


# 4. 설정 변경 적용 : 초기 설정에서 기존 conf와 bin만 수정
cp -pvfr /AUDPlatform/apps/tomcat_back/conf /AUDPlatform/apps/tomcat/conf
cp -pvfr /AUDPlatform/apps/tomcat_back/bin/AUDPlatform/apps/tomcat/bin




# 5. 버전 확인
./AUDPlatform/apps/tomcat/bin/version.sh




# 6. Start
./AUDPlatform/bin/commander.sh -s metawas