#> vi Dockerfile

FROM postgres:17.3

RUN apt-get update && apt-get install -y locales openssh-client

RUN locale-gen ko_KR.UTF-8

RUN localedef -i ko_KR -f UTF-8 ko_KR.UTF-8

ENV LANG=ko_KR.utf8 \
    LC_COLATE=ko_KR.utf8 \
    POSTGRES_INITDB_ARGS=--data-checksums

 

#> docker build -t postgres-ko:17.3 .

#> docker image ls

REPOSITORY    TAG       IMAGE ID       CREATED             SIZE
postgres-ko   17.3      ce0b637e601d   About an hour ago   477MB
postgres      latest    d14b06b9a915   3 days ago          438MB

- 설치

# cd /usr/local/src 

# wget https://www.python.org/ftp/python/3.11.11/Python-3.11.11.tgz

# tar xvfz Python-3.11.11.tgz

# cd Python-3.11.11

 

* ctypes가 설치 안돼있으면 설치

centos => yum install libffi-devel

ubunut => apt-get install libffi-dev

 

* centos7에는 openssl 1.0.0대 버전이 설치되어 있다. python3.11이상 버전은 openssl 1.1대 버전을 설치 해야 한다.

* openssl 버전 확인

# openssl version 

# yum remove openssl openssl-devel

# wget https://www.openssl.org/source/openssl-1.1.1t.tar.gz

# tar xvfz openssl-1.1.1t.tar.gz

# cd openssl-1.1.1t

# ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl shared zlib && make && make install

# vi ~/.bashrc

export PATH="/usr/local/openssl/bin:$PATH"
export LD_LIBRARY_PATH=/usr/local/openssl/lib:$LD_LIBRARY_PATH

 

./configure --prefix=/home/venv/python-3.11.11 --with-openssl=/usr/local/openssl --with-openssl-rpath=auto && make && make install

- postgresql-14 관련 rpm파일 다운로드 받기

postgresql14-libs-14.1-1PGDG.rhel8.x86_64.rpm
postgresql14-14.1-1PGDG.rhel8.x86_64.rpm
postgresql14-server-14.1-1PGDG.rhel8.x86_64.rpm
postgresql14-contrib-14.1-1PGDG.rhel8.x86_64.rpm

 

- 설치 

cd /usr/local/src/postgresql_rpms
dnf install -y postgresql14-libs-14.1-1PGDG.rhel8.x86_64.rpm
dnf install -y postgresql14-14.1-1PGDG.rhel8.x86_64.rpm
dnf install -y postgresql14-server-14.1-1PGDG.rhel8.x86_64.rpm
dnf install -y postgresql14-contrib-14.1-1PGDG.rhel8.x86_64.rpm

 

- DB초기화

su - postgres -c "/usr/pgsql-14/bin/initdb -D /usr/local/src/pgsql/14/data"

- SVN설치

dnf install -y subversion

 

- docker-compose 다운받기(OS에 맞는 버전 다운로드)

https://github.com/docker/compose/releases

 

Releases · docker/compose

Define and run multi-container applications with Docker - docker/compose

github.com

- 실행 파일로 만들기

cp ./docker-compose-linux-x86_64 /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
chmod -x /usr/bin/docker-compose

 

- 버전 확인

docker-compose -v

- 구분(awk)

ls -altr | awk '{print $6}'

 

- 숫자만 출력(sed)

echo ls -altr | awk '{print $6} | sed 's/[^0-9]//g'

 

 

- docker download

http://hub.docker.com/

 

Docker Hub Container Image Library | App Containerization

Increase your reach and adoption on Docker Hub With a Docker Verified Publisher subscription, you'll increase trust, boost discoverability, get exclusive data insights, and much more.

hub.docker.com

docker search rocky
docker pull rockylinux/rockylinux:8

 

- image 목록

docker image ls

 

- container 생성

docker create -ti --name test_rocky rockylinux/rockylinux:8

 

- container 실행 및 진입

docker start test_rocky
docker container ps
docker attach test_rocky

- Disk 상태 확인

lsblk
fdisk -l

 

- Disk 생성

[test@localhost ~]# fdisk /dev/sdb1
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xa536c7c6.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-209713151, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209713151, default 209713151):
Using default value 209713151
Partition 1 of type Linux and of size 100 GiB is set
w

[test@localhost ~]# fdisk -l

 

- mount 

[test@localhost ~]mkfs.xfs /dev/sdb1
[test@localhost ~]mkdir /test
[test@localhost ~]mount /dev/sdb1 /test

 

- 부팅 후에도 자동 mount

[test@localhost ~]vi /etc/fstab
/dev/sdb1 /test xfs defaults 0 0

+ Recent posts