linux commands (mount configuration iso file to the local repository)

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/Mr_Yang888/article/details/102615810

linux mount iso file

Mode 1

Vm virtualization software through "Settings" - "cd / dvd-" Set the ISO image. Select "Power Link" and "Connected"

Create an iso mounted directory / mnt / cdrom

​ lsblk -f

​ sr0 iso9660 CentOS_6.9_Final

Mount command execution: Mount / dev / SR0 / mnt / cdro m

​ [root@node01 mnt]# mount /dev/sr0 /mnt/cdrom/
​ mount: block device /dev/sr0 is write-protected, mounting read-only

​ [root@node01 mnt]# ll /mnt/cdrom/
​ 总用量 564
-r–r--r–. 2 root root 14 3月 29 2017 CentOS_BuildTag
dr-xr-xr-x. 3 root root 2048 3月 29 2017 EFI
-r–r--r–. 2 root root 212 11月 27 2013 EULA
-r–r--r–. 2 root root 18009 11月 27 2013 GPL
dr-xr-xr-x. 3 root root 2048 3月 29 2017 images
dr-xr-xr-x. 2 root root 2048 3月 29 2017 isolinux
dr-xr-xr-x. 2 root root 534528 3月 29 2017 Packages
-r–r--r–. 2 root root 1359 3月 28 2017 RELEASE-NOTES-en-US.html
dr-xr-xr-x. 2 root root 4096 3月 29 2017 repodata
-r–r--r–. 2 root root 1706 11月 27 2013 RPM-GPG-KEY-CentOS-6
-r–r--r–. 2 root root 1730 11月 27 2013 RPM-GPG-KEY-CentOS-Debug-6
-r–r--r–. 2 root root 1730 11月 27 2013 RPM-GPG-KEY-CentOS-Security-6
-r–r--r–. 2 root root 1734 11月 27 2013 RPM-GPG-KEY-CentOS-Testing-6
-r–r--r–. 1 root root 3380 3月 29 2017 TRANS.TBL

Rate Option 2: Mount achieved by internal linux iso files uploaded to the system

1, ISO files to upload linux file system

2, we need to create a directory to mount the iso

​ mkdir /mnt/cdrom

3, to achieve mount

​ mount -o loop /CentOS-6.9-x86_64-bin-DVD1.iso /mnt/cdrom

4, Mount View

[root@node01 Packages]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 20G 5.9G 13G 32% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 190M 40M 141M 22% /boot
/dev/sda3 7.8G 18M 7.4G 1% /mnt/disk1
/dev/sda5 7.6G 18M 7.2G 1% /mnt/disk2
/dev/sdb1 3.8G 7.7M 3.6G 1% /mnt/disk3
/dev/sdb2 6.0G 14M 5.7G 1% /mnt/disk4
/CentOS-6.9-x86_64-bin-DVD1.iso
​ 3.7G 3.7G 0 100% /mnt/cdrom

Configuring local repository

1, all of the files in the backup /etc/yum.repos.d/

​ [root@node01 mnt]# cd /etc/yum.repos.d/

Create a backup file folder

​ [root@node01 yum.repos.d]# mkdir bk

​ [root@node01 yum.repos.d]# mv * bk

2, copy CentOS-Media.repo backup files in the folder to /etc/yum.repos.d/

​ [root@node01 yum.repos.d]# cp bk/CentOS-Media.repo .

3, rename CentOS-Media.repo (change local.repo)

​ [root@node01 yum.repos.d]# mv CentOS-Media.repo local.repo

4, to achieve local repository configuration

​ [root@node01 yum.repos.d]# vim local.repo

Into the following

[c6-Media]
name = CentOS- $ releasever - Media (name of the repository)
baseurl = File: /// mnt / cdrom (path repository)
gpgcheck = 0 (check whether - 0: Do not check )
Enabled =. 1 (valid -1: active)

5, empty the cache

​ [root@node01 yum.repos.d]# yum clean all

6, test local repository is available

​ [root@node01 yum.repos.d]# yum search httpd

Guess you like

Origin blog.csdn.net/Mr_Yang888/article/details/102615810