1. 程式人生 > 其它 >Redhat7-yum本地源安裝配置

Redhat7-yum本地源安裝配置

1、基本資訊描述
redhat版本:redhat 7.4
/tools/rhel-server-7.4-x86_64-dvd.iso
2、建立掛載目錄與掛載ISO檔案
[root@test2 /]# mkdir -p /mnt/cdrom
[root@test2 /]# mount -o loop /tools/rhel-server-7.4-x86_64-dvd.iso /mnt/cdrom/
mount: /dev/loop0 is write-protected, mounting read-only
[root@test2 tools]#
3、配置yum配置檔案myself.repo
[root@test2 /]# cd /etc/yum.repos.d/
[root@test2 yum.repos.d]# ll
total 0
[root@test2 yum.repos.d]# vi myself.repo
[RedHat7]
name=RedHat7
baseurl=file:///mnt/cdrom
enabled=1
gpgckeck=0
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
4、清除快取
[root@test2 yum.repos.d]# yum clean all
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: RedHat7
Cleaning up everything
[root@test2 yum.repos.d]#
5、配置開機啟動:
[root@test2 yum.repos.d]# vi /etc/fstab
/tools/rhel-server-7.4-x86_64-dvd.iso /mnt/cdrom/ iso9660 defaults 0 0
6、成功性驗證測試
[root@test2 yum.repos.d]# yum -y install gcc*
[root@test2 yum.repos.d]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 25G 4.9G 21G 20% /
devtmpfs 487M 0 487M 0% /dev
tmpfs 497M 0 497M 0% /dev/shm
tmpfs 497M 6.7M 490M 2% /run
tmpfs 497M 0 497M 0% /sys/fs/cgroup
/dev/sda3 2.0G 33M 2.0G 2% /home
/dev/sda1 1014M 119M 896M 12% /boot
tmpfs 100M 0 100M 0% /run/user/0
/dev/loop0 3.8G 3.8G 0 100% /mnt/cdrom
[root@test2 yum.repos.d]#