AlamLinux 9.4 install 설치하기

Updated on

목차:

almaLinux 로 포멧을 다시 진행하였고, 해당 과정을 간단하게 기록해본다.

기본 포멧 및 설치하기

기본 패키지 업그레이드

dnf upgrade

네트워크 인터페이스 잡기 (ONBOOT 수정)

cd /etc/sysconfig/network-scripts/
vi ifcfg-enp70s0

DEVICE=enp70s0
BOOTPROTO=dhcp
ONBOOT=yes

firewalld 비활성화

systemctl stop firewalld
systemctl disable firewalld

semanage 22960 port 추가

dnf install policycoreutils-python-utils
semanage port -a -t ssh_port_t -p tcp 22960

sshd port 변경

cd /etc/ssh
vim sshd_config

Port 22960
PermitRootLogin yes

systemctl restart sshd

디스크 마운트

lsblk -f

NAME                           FSTYPE      FSVER    LABEL UUID                                   FSAVAIL FSUSE% MOUNTPOINTS
sda                            ext4        1.0            b1f8274b-8367-46a3-af7a-9cc6415cebf8
nvme0n1
├─nvme0n1p1                    vfat        FAT32          E636-00F9                               591.8M     1% /boot/efi
├─nvme0n1p2                    xfs                        6784e138-f5c2-43b1-ad84-a977dfa9d206    683.4M    29% /boot
└─nvme0n1p3                    LVM2_member LVM2 001       kj7k6S-ph7v-BwDG-q3ad-tTph-OvTE-CR3pbI
  ├─almalinux_ollama--api-root xfs                        f260f019-aff5-419c-a402-7815b60da6a6       68G     3% /
  ├─almalinux_ollama--api-swap swap        1              ba20f638-52df-466a-b02a-f1ead179b24d                  [SWAP]
  └─almalinux_ollama--api-home xfs                        732350a1-a9fc-4f37-83e7-c8147ad755e1    849.5G     1% /home
nvme1n1                        xfs                        62a1faab-d641-4bc3-bacf-627f1f291c71


fdisk -l /dev/sda
fdisk -l /dev/nvme1n1

폴더 생성하기

mkdir /db
mkdir /data

폴더에 디스크 마운트 하기

mount /dev/nvme1n1 /db
mount /dev/sda /data

lsblk -f

NAME                           FSTYPE      FSVER    LABEL UUID                                   FSAVAIL FSUSE% MOUNTPOINTS
sda                            ext4        1.0            b1f8274b-8367-46a3-af7a-9cc6415cebf8        8T     6% /data
nvme0n1
├─nvme0n1p1                    vfat        FAT32          E636-00F9                               591.8M     1% /boot/efi
├─nvme0n1p2                    xfs                        6784e138-f5c2-43b1-ad84-a977dfa9d206    683.4M    29% /boot
└─nvme0n1p3                    LVM2_member LVM2 001       kj7k6S-ph7v-BwDG-q3ad-tTph-OvTE-CR3pbI
  ├─almalinux_ollama--api-root xfs                        f260f019-aff5-419c-a402-7815b60da6a6       68G     3% /
  ├─almalinux_ollama--api-swap swap        1              ba20f638-52df-466a-b02a-f1ead179b24d                  [SWAP]
  └─almalinux_ollama--api-home xfs                        732350a1-a9fc-4f37-83e7-c8147ad755e1    849.5G     1% /home
nvme1n1                        xfs                        62a1faab-d641-4bc3-bacf-627f1f291c71    868.6G     7% /db

/etc/fstab 수정 (자동 마운트)

# auto-mount > 추가 설정
UUID=62a1faab-d641-4bc3-bacf-627f1f291c71	/db	xfs	defaults	0	0
UUID=b1f8274b-8367-46a3-af7a-9cc6415cebf8	/data	ext4	defaults	0	0

재부팅 후 auto mount 잘 적용됬는지 아래 명령어로 확인

reboot

lsblk -f

저장소 추가

dnf install dnf-plugins-core
dnf install epel-release
dnf config-manager --set-enabled crb

기본 패키지 설치

dnf install vim htop net-tools iputils dnsutils curl wget rsync lsof ncdu which tcpdump unzip lsscsi bash-completion lm_sensors

sensors-detect

기본 패키지 업그레이드

dnf upgrade

현재 리눅스 및 커널 버전 확인

hostnamectl

   Static hostname: (unset)
Transient hostname: server.local
         Icon name: computer-desktop
           Chassis: desktop 🖥️
        Machine ID: 474b2ef929ea40a9b94cad40ae267e9f
           Boot ID: 9109fff82bde405b80c6977b8be00840
  Operating System: AlmaLinux 9.4 (Seafoam Ocelot)
       CPE OS Name: cpe:/o:almalinux:almalinux:9::baseos
            Kernel: Linux 5.14.0-427.18.1.el9_4.x86_64
      Architecture: x86-64
   Hardware Vendor: ASUS
    Hardware Model: ROG ZENITH II EXTREME ALPHA
  Firmware Version: 2102

cron.d 에 추가

0 0 * * * /bin/sync && echo 1 > /proc/sys/vm/drop_caches

nvidia driver 설치하기

설치하기

https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#nvidia-open-gpu-kernel-modules 주소에 설치 방법이 나와있다.

dnf install tar bzip2 wget make automake gcc gcc-c++ pciutils elfutils-libelf-devel libglvnd-devel bind-utils kernel-headers kernel-devel freeglut-devel libX11-devel libXi-devel libXmu-devel mesa-libGLU-devel freeimage-devel libglfw3-devel

lspci | grep VGA

dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repo
dnf module install nvidia-driver:open-dkms

reboot

nvidia-smi

nvidia-smi nvlink --status

여기서 nvidia Persistence 모드 활성화를 해준다.

systemctl enable nvidia-persistenced
systemctl start nvidia-persistenced

docker 설치하기

설치하기

dnf erase podman buildah
dnf update
dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
dnf -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin
systemctl --now enable docker

docker compose version
docker --version

docker network create frontend
docker network create backend

nvidia-toolkit docker 설치하기

https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html

curl -s -L https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo | \
  sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo

dnf config-manager --set-enabled nvidia-container-toolkit-experimental
dnf install -y nvidia-container-toolkit

nvidia-ctk runtime configure --runtime=docker
systemctl restart docker

성능 최적화

TCP 튜닝

/etc/sysctl.conf

net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.core.netdev_max_backlog = 5000
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_moderate_rcvbuf = 1
net.ipv4.tcp_congestion_control = cubic

sysctl -p

파일 디스크립터 한도 증가

/etc/security/limits.conf

*         soft    nofile      65536
*         hard    nofile      65536

이렇게 설치하면, 서버 컴퓨터의 리눅스 설치를 정상적으로 하게 된 것이다.