Add a local source linux yum

1、yum repolist

2, https: //opsx.alibaba.com/mirror, under the first mirror in the yum, Pick source epel

epel-release-latest-7.noarch.rpm

3, rpm -ivh epel-release-latest-7.noarch.rpm # installation source

4, this time to see epel source has been installed, if we do not apply the source bash, bash source can be modified or removed name  mv CentOS-Base.repo CentOS-Base.repo.bak

5, mkdir -p / media / cdrom # New Directory

6, mount / dev / sr0 / media / cdrom / # local source mounted in the directory

7, df -h # View the local source directory is mounted successfully 

/dev/sr0                 8.1G  8.1G     0 100% /media/cdrom

8, mounted on the need to modify /etc/yum.repos.d/ CentOS-Media.repo information in the source file in the local source profile, open follows

[c7-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
        file:///media/cdrom/
        file:///media/cdrecorder/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

 Modified

[c7-media]
name=CentOS-$releasever - Media
baseurl=file:///media/cdrom/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

9, yum repolist # View system uses source

10, yum makecache # Finally, the source create a cache for a faster

11, if the local source is provided automatically mount the boot, it is necessary / etc / fstab add / dev / sr0 automatically mounted

/dev/mapper/centos-root /                       ext4    defaults        1 1

UUID=0cceaf55-a63f-4f0c-97c7-305c848781bc  /boot                    ext4    defaults        1 2
/dev/mapper/centos-data  /data                    ext4    defaults        1 2
/dev/mapper/centos-swap  swap                    swap    defaults        0 0
/dev/sr0                /media/cdrom            iso9660 defaults        0 0光盘文件类型为 iso9660

 

Guess you like

Origin www.cnblogs.com/shizhengquan/p/11368344.html