테스트를 위해서 wsl2 사용 설정 필요
wsl 에 rocky linux 8 설치
- 아래 사이트에서 Rocky-8-Container-Base.latest.x86_64.tar.xz 파일 다운로드
-- wsl 에 Rocky Linux 8 설치
PS C:\Users\kalva> wsl --import PostgreSQL14 E:\Hyper-V\PostgreSQL14 E:\Hyper-V\Rocky-8-Container-Base.latest.x86_64.tar.xz --version 2
가져오기가 진행 중입니다. 이 작업은 몇 분 정도 걸릴 수 있습니다.
작업을 완료했습니다.
-- 설치된 Rocky Linux 8 설치
PS C:\Users\kalva> wsl -l -v
NAME STATE VERSION
* Ubuntu-22.04 Stopped 2
PostgreSQL14 Stopped 2
-- 설치된 Rocky Linux 8 접속
PS C:\Users\kalva> wsl -d PostgreSQL14
-- 리눅스 버전 확인
[root@RT-PC kalva]# cat /etc/redhat-release
Rocky Linux release 8.8 (Green Obsidian)
-- 시스템 정보 확인
[root@RT-PC kalva]# uname -a
Linux RT-PC 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
-- sudo passwd 설치
[root@RT-PC kalva]# dnf install -y sudo passwd
-- postgres 유저 추가, 패스워드 변경
[root@RT-PC kalva]# useradd postgres
[root@RT-PC kalva]# passwd postgres
Changing password for user postgres.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
-- postgres 유저가 sudo 를 사용할 수 있게 추가
[root@RT-PC kalva]# visudo
# %wheel ALL=(ALL) NOPASSWD: ALL 아래에 postgres 유저 추가
postgres ALL=(ALL) NOPASSWD: ALL
[root@RT-PC kalva]# su - postgres
[postgres@RT-PC ~]$ sudo -i
[root@RT-PC ~]# id
uid=0(root) gid=0(root) groups=0(root)
[root@RT-PC ~]# exit
logout
-- systemd 사용 설정
[postgres@RT-PC ~]$ echo "[boot]
systemd=true" | sudo tee /etc/wsl.conf
[boot]
systemd=true
-- systemd procps 설치
[postgres@RT-PC ~]$ sudo dnf install -y systemd procps
-- OS 로케일 확인
[postgres@RT-PC ~]$ locale -a
C
C.utf8
POSIX
-- glibc-locale-source 설치
[postgres@RT-PC ~]$ sudo dnf install -y glibc-locale-source
-- ko_KR.utf8 locale 생성
[postgres@RT-PC ~]$ sudo localedef -f UTF-8 -i ko_KR ko_KR.utf8
-- locale 설정 .bash_profile 파일에 LANG 설정 추가
[postgres@RT-PC ~]$ vi .bash_profile
export LANG=ko_KR.utf8
[postgres@RT-PC ~]$ exit
logout
[root@RT-PC ~]# exit
logout
--PostgreSQL14 재기동
PS C:\Users\kalva> wsl -t PostgreSQL14
작업을 완료했습니다.
PS C:\Users\kalva> wsl -d PostgreSQL14
[postgres@RT-PC ~]$ sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
[postgres@RT-PC ~]$ sudo dnf -qy module disable postgresql
[postgres@RT-PC ~]$ sudo dnf install -y postgresql14-server
[postgres@RT-PC ~]$ sudo /usr/pgsql-14/bin/postgresql-14-setup initdb
[postgres@RT-PC ~]$ sudo systemctl enable postgresql-14
[postgres@RT-PC ~]$ sudo systemctl start postgresql-14
[postgres@RT-PC ~]$ ps x
PID TTY STAT TIME COMMAND
34 ? Ss 0:00 /usr/pgsql-14/bin/postmaster -D /var/lib/pgsql/14/data/
38 ? Ss 0:00 postgres: logger
43 ? Ss 0:00 postgres: checkpointer
44 ? Ss 0:00 postgres: background writer
45 ? Ss 0:00 postgres: walwriter
46 ? Ss 0:00 postgres: autovacuum launcher
47 ? Ss 0:00 postgres: stats collector
48 ? Ss 0:00 postgres: logical replication launcher
91 pts/0 S 0:00 -bash
180 pts/0 R+ 0:00 ps x
[postgres@RT-PC ~]$ psql
psql (14.9)
Type "help" for help.
postgres=# select version();
version
---------------------------------------------------------------------------------------------------------
PostgreSQL 14.9 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-18), 64-bit
(1 row)
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+------------+------------+-----------------------
postgres | postgres | UTF8 | ko_KR.utf8 | ko_KR.utf8 |
template0 | postgres | UTF8 | ko_KR.utf8 | ko_KR.utf8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | ko_KR.utf8 | ko_KR.utf8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 rows)