어쩌다 IT
article thumbnail
반응형

1. 개요

<bash />
[root@testlocal ~]# yum update Rocky Linux 8 - AppStream 0.0 B/s | 0 B 00:00 Errors during downloading metadata for repository 'appstream': - Curl error (6): Couldn't resolve host name for https://mirrors.rockylinux.org/mirrorlist?arch=x86_64&repo=AppStream-8 [Could not resolve host: mirrors.rockylinux.org] 오류: repo를 위한 메타자료 내려받기에 실패하였습니다 'appstream': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for https://mirrors.rockylinux.org/mirrorlist?arch=x86_64&repo=AppStream-8 [Could not resolve host: mirrors.rockylinux.org]

보통은 서버를 사무실에서 필요한 패키지들을 사전 설치한 후에 납품하는 경우가 많은데,

이번 케이스는 디스크 증설 후에 OS 재설치를 하기 때문에 시작부터 내부망에서 작업을 하게 되었다.

패키지 설치를 위해서는 인터넷이 연결되어야 한다.

하지만 이 서버는 내부망, 폐쇄망에 있기 때문에 외부와 통신이 되지 않는다.

그래서 로컬 레포지토리를 설정하여 패키지를 설치하는 방법을 정리하기로 했다.

해당 환경은 Rocky Linux 8.9 버전을 VMWare에 설치해서 테스트했다.


2. 설정

1. Repository 위치 확인

<bash />
ls -l /etc/yum.repos.d/
<bash />
[root@testlocal ~]# ls -l /etc/yum.repos.d/ 합계 52 -rw-r--r--. 1 root root 710 11월 3 12:09 Rocky-AppStream.repo -rw-r--r--. 1 root root 695 11월 3 12:09 Rocky-BaseOS.repo -rw-r--r--. 1 root root 1753 11월 3 12:09 Rocky-Debuginfo.repo -rw-r--r--. 1 root root 360 11월 3 12:09 Rocky-Devel.repo -rw-r--r--. 1 root root 695 11월 3 12:09 Rocky-Extras.repo -rw-r--r--. 1 root root 731 11월 3 12:09 Rocky-HighAvailability.repo -rw-r--r--. 1 root root 680 11월 3 12:09 Rocky-Media.repo -rw-r--r--. 1 root root 680 11월 3 12:09 Rocky-NFV.repo -rw-r--r--. 1 root root 690 11월 3 12:09 Rocky-Plus.repo -rw-r--r--. 1 root root 715 11월 3 12:09 Rocky-PowerTools.repo -rw-r--r--. 1 root root 681 11월 3 12:09 Rocky-RT.repo -rw-r--r--. 1 root root 746 11월 3 12:09 Rocky-ResilientStorage.repo -rw-r--r--. 1 root root 2335 11월 3 12:09 Rocky-Sources.repo [root@testlocal ~]#

 

 

2. 기존 Repository 백업

<bash />
mkdir /etc/yum.repos.d/repo_backup mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/repo_backup/
<bash />
[root@testlocal ~]# mkdir /etc/yum.repos.d/repo_backup [root@testlocal ~]# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/repo_backup/ [root@testlocal ~]# ls -la /etc/yum.repos.d/ 합계 16 drwxr-xr-x. 3 root root 25 3월 25 13:58 . drwxr-xr-x. 142 root root 8192 3월 25 13:43 .. drwxr-xr-x. 2 root root 4096 3월 25 13:58 repo_backup [root@testlocal ~]# ls -la /etc/yum.repos.d/repo_backup/ 합계 56 drwxr-xr-x. 2 root root 4096 3월 25 13:58 . drwxr-xr-x. 3 root root 25 3월 25 13:58 .. -rw-r--r--. 1 root root 710 11월 3 12:09 Rocky-AppStream.repo -rw-r--r--. 1 root root 695 11월 3 12:09 Rocky-BaseOS.repo -rw-r--r--. 1 root root 1753 11월 3 12:09 Rocky-Debuginfo.repo -rw-r--r--. 1 root root 360 11월 3 12:09 Rocky-Devel.repo -rw-r--r--. 1 root root 695 11월 3 12:09 Rocky-Extras.repo -rw-r--r--. 1 root root 731 11월 3 12:09 Rocky-HighAvailability.repo -rw-r--r--. 1 root root 680 11월 3 12:09 Rocky-Media.repo -rw-r--r--. 1 root root 680 11월 3 12:09 Rocky-NFV.repo -rw-r--r--. 1 root root 690 11월 3 12:09 Rocky-Plus.repo -rw-r--r--. 1 root root 715 11월 3 12:09 Rocky-PowerTools.repo -rw-r--r--. 1 root root 681 11월 3 12:09 Rocky-RT.repo -rw-r--r--. 1 root root 746 11월 3 12:09 Rocky-ResilientStorage.repo -rw-r--r--. 1 root root 2335 11월 3 12:09 Rocky-Sources.repo [root@testlocal ~]#

 

 

3. Rocky Linux 이미지 마운트

<bash />
[root@testlocal ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 1 29.3G 0 disk └─sda1 8:1 1 29.3G 0 part /run/media/test/ROCKY-8-9-X sr0 11:0 1 1024M 0 rom nvme0n1 259:0 0 50G 0 disk ├─nvme0n1p1 259:1 0 1G 0 part /boot └─nvme0n1p2 259:2 0 49G 0 part ├─rl_testlocal-root 253:0 0 20G 0 lvm / ├─rl_testlocal-swap 253:1 0 2G 0 lvm [SWAP] └─rl_testlocal-home 253:2 0 27G 0 lvm /home [root@testlocal ~]#

현재 마운트 상황 확인하고, 마운트할 지점을 생성하고 마운트 한다.

 

<bash />
mkdir /mnt/tmp mount /dev/sda1 /mnt/tmp

위에서 보다시피 Rocky Linux 이미지가 sda1에 있기 때문에 /dev/sda1을 /mnt/tmp에 마운트 한다.

 

<bash />
[root@testlocal ~]# mkdir /mnt/tmp [root@testlocal ~]# mount /dev/sda1 /mnt/tmp/ [root@testlocal ~]# ls -l /mnt/tmp 합계 304 drwxr-xr-x. 4 test test 16384 3월 25 2024 AppStream drwxr-xr-x. 4 test test 16384 3월 25 2024 BaseOS drwxr-xr-x. 3 test test 16384 3월 25 2024 EFI -rw-r--r--. 1 test test 2204 3월 25 2024 LICENSE drwxr-xr-x. 2 test test 16384 3월 25 2024 'System Volume Information' -rw-r--r--. 1 test test 883 3월 25 2024 TRANS.TBL -rw-r--r--. 1 test test 34494 3월 25 2024 autorun.ico -rw-r--r--. 1 test test 226 3월 25 2024 autorun.inf drwxr-xr-x. 3 test test 16384 3월 25 2024 images drwxr-xr-x. 2 test test 16384 3월 25 2024 isolinux -r--r--r--. 1 test test 69145 3월 25 2024 ldlinux.sys -rw-r--r--. 1 test test 88 3월 25 2024 media.repo -rw-r--r--. 1 test test 94 3월 25 2024 syslinux.cfg [root@testlocal ~]#

 

위와 같이 /mnt/tmp에 마운트 되었음을 확인할 수 있는데,

당장 패키지 설치 이후에 추가적인 설치가 필요 없으면 이렇게 사용하고, 그게 아니라면 해당 내용들을 복사한다.

<bash />
mkdir /rocky cp -a /mnt/tmp/. /rocky

나의 경우에는 약 20분 조금 안 걸렸다.

<bash />
[root@testlocal ~]# ls -l /rocky/ 합계 128 drwxr-xr-x. 4 test test 38 3월 25 2024 AppStream drwxr-xr-x. 4 test test 38 3월 25 2024 BaseOS drwxr-xr-x. 3 test test 18 3월 25 2024 EFI -rw-r--r--. 1 test test 2204 3월 25 2024 LICENSE drwxr-xr-x. 2 test test 53 3월 25 2024 'System Volume Information' -rw-r--r--. 1 test test 883 3월 25 2024 TRANS.TBL -rw-r--r--. 1 test test 34494 3월 25 2024 autorun.ico -rw-r--r--. 1 test test 226 3월 25 2024 autorun.inf drwxr-xr-x. 3 test test 76 3월 25 2024 images drwxr-xr-x. 2 test test 4096 3월 25 2024 isolinux -r--r--r--. 1 test test 69145 3월 25 2024 ldlinux.sys -rw-r--r--. 1 test test 88 3월 25 2024 media.repo -rw-r--r--. 1 test test 94 3월 25 2024 syslinux.cfg [root@testlocal ~]#

 

 

4. Local Repository 파일 작성

<bash />
vi /etc/yum.repos.d/local.repo
<bash />
[ISO_AppStream] name=Rocky8.9_AppStream baseurl=file:///rocky/AppStream/ #해당 경로 입력 enabled=1 gpgcheck=0 [ISO_BaseOS] name=Rocky8.9_BaseOS baseurl=file:///rocky/BaseOS/ #해당 경로 입력 enabled=1 gpgcheck=0

 

 

5. 캐시 재구성

<bash />
yum makecache
<bash />
[root@testlocal ~]# yum makecache Rocky8.9_AppStream 24 MB/s | 8.7 MB 00:00 Rocky8.9_BaseOS 60 MB/s | 2.6 MB 00:00 마지막 메타자료 만료확인(0:00:03 이전): 2024년 03월 25일 (월) 오후 03시 59분 47초. 메타 자료 캐쉬가 생성되었습니다. [root@testlocal ~]#

 

 

6. Local Repository 정상 작동 확인

<bash />
[root@testlocal ~]# yum repolist 저장소 ID 저장소 이름 ISO_AppStream Rocky8.9_AppStream ISO_BaseOS Rocky8.9_BaseOS [root@testlocal ~]#

 

테스트로 vsftpd와 samba까지 설치를 마쳤다.

 

<bash />
[root@testlocal ~]# systemctl status vsftpd ● vsftpd.service - Vsftpd ftp daemon Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor pres> Active: active (running) since Fri 2024-03-29 14:35:12 KST; 1min 1s ago Process: 1417 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited> Main PID: 1424 (vsftpd) Tasks: 1 (limit: 22797) Memory: 780.0K CGroup: /system.slice/vsftpd.service └─1424 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf 3월 29 14:35:12 test systemd[1]: Starting Vsftpd ftp daemon... 3월 29 14:35:12 test systemd[1]: Started Vsftpd ftp daemon. [root@testlocal ~]# [root@testlocal ~]# [root@testlocal ~]# [root@testlocal ~]# systemctl status smb ● smb.service - Samba SMB Daemon Loaded: loaded (/usr/lib/systemd/system/smb.service; disabled; vendor preset> Active: active (running) since Fri 2024-03-29 14:36:56 KST; 1s ago Docs: man:smbd(8) man:samba(7) man:smb.conf(5) Main PID: 3403 (smbd) Status: "smbd: ready to serve connections..." Tasks: 3 (limit: 22797) Memory: 15.2M CGroup: /system.slice/smb.service ├─3403 /usr/sbin/smbd --foreground --no-process-group ├─3405 /usr/sbin/smbd --foreground --no-process-group └─3406 /usr/sbin/smbd --foreground --no-process-group 3월 29 14:36:56 test systemd[1]: Starting Samba SMB Daemon... 3월 29 14:36:56 test smbd[3403]: [2024/03/29 14:36:56.477955, 0] ../../source> 3월 29 14:36:56 test smbd[3403]: smbd version 4.18.6 started. 3월 29 14:36:56 test smbd[3403]: Copyright Andrew Tridgell and the Samba Tea> 3월 29 14:36:56 test systemd[1]: Started Samba SMB Daemon. [root@testlocal ~]#

 


3. 정리

지금 회사에서 많이 쓰는 Linux OS는 Rocky이다 보니 Rocky로 테스트를 했다.

한동안은 폐쇄망에서 패키지 설치하는 것쯤은 쉽게 느껴지겠지만 언젠가는 또 까먹을 테니 정리를 해둔다.

 

xrdp는 epel-release를 어떻게 하지를 못해서 내부망 설치는 해보지 못했다.

정보처리기사 준비나 좀 하고... 나중에 찾아봐야겠다.

 

 

 

반응형
profile

어쩌다 IT

@jwlish

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!