본문 바로가기

리눅스-기초명령어/패키지 관리

iso mount

보조기억장치(HDD, FDD, CD-ROM 등)나 파일 시스템이 다른 디스크를 (/root 디렉토리)의 하위 디렉토리에 연결하여 사용할 수 있게 해주는 명령 특정 옵션없이 mount를 사용하면 현재 마운트된 장치나 디스크를 확인할 수 있다.

 

사용법

mount [option] [device] [directory]

 

옵션

옵션 설명
-a /etc/fstab에 명시된 파일 시스템을 마운트할 때 쓰이는 옵션이다
-t fs_type 파일 시스템의 유형을 지정하는 옵션으로 지정하지않으면 /etc/fstab 파일을 참조한다.
-o 항목 마운트할 때 추가적인 설정을 적용할때 사용하는 옵션으로 다수의 조건을 적용할 때는 콤마(,)로 구분 하면 된다.



1. iso 마운트 및 repository 등록

 

vm웨어 설정에서 iso 파일을 지정




utilities - disk 에서 마운트 확인

 

 

 

마운트 위치 바꾸기

[root@rocky1 ~]# cd /run/media/root/Rocky-9-1-x86_64-dvd/
[root@rocky1 Rocky-9-1-x86_64-dvd]# ll
total 26
drwxr-xr-x. 1 root root 2048 11월 24 10:48 AppStream
drwxrwxr-x. 1 root root 2048 11월 24 11:09 BaseOS
-rw-r--r--. 1 root root 5504 11월 24 10:48 COMMUNITY-CHARTER
...

# 마운트된 파일의 원래 위치
[root@rocky1 Rocky-9-1-x86_64-dvd]# cd /
[root@rocky1 /]# mount -t iso9660 /dev/sr0 /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
[root@rocky1 /]# cd /mnt
[root@rocky1 mnt]# ll
total 26
drwxr-xr-x. 1 root root 2048 Dec 14 15:28 AppStream
drwxrwxr-x. 1 root root 2048 Dec 13 01:21 BaseOS
-rw-r--r--. 1 root root 5504 Nov 23 20:48 COMMUNITY-CHARTER
...
# 마운트 위치를 /mnt로 변경

 

baseurl 위치를 /mnt로 지정정

[root@rocky1 ~]# cd /etc/yum.repos.d/
[root@rocky1 yum.repos.d]# vi dvd.repo
# vi 편집창
[dvd-baseos]
name=dvd - BaseOS
baseurl=file:///mnt/BaseOS/
...

[dvd-appstream]
name=dvd - AppStream
baseurl=file:///mnt/AppStream/
...

 

[root@rocky1 yum.repos.d]# dnf reinstall tree
Last metadata expiration check: 0:08:09 ago on Tue 09 May 2023 09:41:50 PM EST.
Dependencies resolved.
=====================================================
Package       Architecture    Version                Repository           Size
=====================================================
Reinstalling:
tree          x86_64          1.8.0-10.el9           dvd-baseos           55 k

Transaction Summary
=====================================================# 마운트된 파일을 repository로 가져온다

 

2. 원격으로 install 파일 가져오기

서버에 접속

[root@rocky1 yum.repos.d]# ssh root@192.168.20.21
root@192.168.20.21's password:
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Wed May 10 12:48:31 2023 from 192.168.20.25

 

install 받을 디렉토리로 이동

[root@rocky1 test]# pwd
/tmp/test

 

Security Tools 다운로드

[root@rocky1 test]# dnf install "@Security Tools" --downloadonly --downloaddir=/tmp/test
Last metadata expiration check: 1:10:54 ago on Wed May 10 11:43:48 2023.
Dependencies resolved.

 

파일 압축

[root@rocky1 test]# tar czvf openscap.tar.gz *
openscap-1.3.6-4.el9.rocky.0.2.x86_64.rpm
openscap-scanner-1.3.6-4.el9.rocky.0.2.x86_64.rpm
openscap.tar.gz
tar: openscap.tar.gz: file changed as we read it
scap-security-guide-0.1.63-5.el9.rocky.1.5.noarch.rpm
test.tar.gz

 

확인

[root@rocky1 test]# ll
total 25500
-rw-r--r--. 1 root root  1987522 May 10 12:55 openscap-1.3.6-4.el9.rocky.0.2.x86_64.rpm
-rw-r--r--. 1 root root    59272 May 10 12:55 openscap-scanner-1.3.6-4.el9.rocky.0.2.x86_64.rpm
-rw-r--r--. 1 root root 13917322 May 10 12:56 openscap.tar.gz
-rw-r--r--. 1 root root  1473729 May 10 12:55 scap-security-guide-0.1.63-5.el9.rocky.1.5.noarch.rpm
-rw-r--r--. 1 root root  8666486 May 10 12:55 test.tar.gz

 

rsync로 서버에서 압축파일 가져오기

[root@rocky1 ~]# rsync -avh 192.168.20.21:/tmp/test/openscap.tar.gz /root/
root@192.168.20.21's password:
receiving incremental file list
openscap.tar.gz

sent 43 bytes  received 13.92M bytes  5.57M bytes/sec


total size is 13.92M  speedup is 1.00

 

압축 파일  확인

[root@rocky1 ~]# ll
total 13596
-rw-r--r--. 1 root root        6 May  8 14:54 happy.txt
-rw-r--r--. 1 root root 13917322 May 10 12:56 openscap.tar.gz

 

압축 풀기

[root@rocky1 ~]# tar xzvf openscap.tar.gz

 

[root@rocky1 ~]# ll
total 13704
-rw-r--r--. 1 root root       6 May  8 14:54 happy.txt
-rw-r--r--. 1 root root 1987522 May 10 12:55 openscap-1.3.6-4.el9.rocky.0.2.x86_64.rpm
-rw-r--r--. 1 root root   59272 May 10 12:55 openscap-scanner-1.3.6-4.el9.rocky.0.2.x86_64.rpm
-rw-r--r--. 1 root root 1835008 May 10 12:56 openscap.tar.gz
-rw-r--r--. 1 root root 1473729 May 10 12:55 scap-security-guide-0.1.63-5.el9.rocky.1.5.noarch.rpm
-rw-r--r--. 1 root root 8666486 May 10 12:55 test.tar.gz

 

가져온 install 파일 설치

[root@rocky1 ~]# dnf install *rpm
Last metadata expiration check: 1:22:36 ago on Wed May 10 11:42:23 2023.
Dependencies resolved.

 

'리눅스-기초명령어 > 패키지 관리' 카테고리의 다른 글

VM으로 repository 서버 구축  (1) 2023.09.01
repository  (0) 2023.09.01
yum, dnf  (1) 2023.09.01
rpm(Red Hat Package Manager)  (0) 2023.09.01