發布時間: 2018-02-25 23:26:53
YUM是在Fedora和RedHat以及SUSE中基于rpm的軟件包管理器,它可以使系統管理人員交互和自動化地更細與管理RPM軟件包,能夠從指定的服務器自動下載RPM包并且安裝,可以自動處理依賴性關系,并且一次安裝所有依賴的軟體包,無須繁瑣地一次次下載、安裝。
RHEL7中的RedHat的YUM需要注冊付費才能使用,本文簡單介紹一下使用iso鏡像文件建立本地YUM源;
Step1:上傳RHEL7的鏡像文件到/iso目錄;
[root@rhel7-01 ~]# cd /iso
[root@rhel7-01 iso]# ls -l
total 3948548
-rw-r--r--. 1 root root 4043309056 Feb 25 20:46 rhel-server-7.2-x86_64-dvd.iso
[root@rhel7-01 iso]#
Step2:mount這個iso文件到/mnt/iso目錄;
[root@rhel7-01 ~]# mount /iso/rhel-server-7.2-x86_64-dvd.iso /mnt/iso
mount: /dev/loop0 is write-protected, mounting read-only
[root@rhel7-01 ~]#
Step3:新建repo文件;
[root@rhel7-01 ~]# cd /etc
[root@rhel7-01 etc]# cd yum.repos.d/
[root@rhel7-01 yum.repos.d]# vim rhel7_local.repo
Step4:編輯repo文件,指定YUM路徑;
[rhel7_local]
name = rhel7_local
baseurl = file:///mnt/iso
enable = 1
gpgcheck = 0
Step5:建立YUM緩存數據庫,加快后續軟件安裝速度;
[root@rhel7-01 ~]# yum makecache
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
rhel7_local | 4.1 kB 00:00:00
(1/4): rhel7_local/group_gz | 136 kB 00:00:00
(2/4): rhel7_local/filelists_db | 3.2 MB 00:00:00
(3/4): rhel7_local/primary_db | 3.6 MB 00:00:00
(4/4): rhel7_local/other_db | 1.4 MB 00:00:00
Metadata Cache Created
Step6:編輯fstab,實現開機自動mount;
[root@rhel7-01 ~]# cd /etc
[root@rhel7-01 etc]# vim fstab
Step7:添加最后一行內容,開機自動mount,需要指明iso9660文件類型;
/iso/rhel-server-7.2-x86_64-dvd.iso /mnt/iso iso9660 defaults 0 0
Step8:確認fstab有效性和正確性;
[root@rhel7-01 ~]# mount -a
[root@rhel7-01 ~]# mount | grep iso
/iso/rhel-server-7.2-x86_64-dvd.iso on /mnt/iso type iso9660 (ro,relatime)
Step9:本地YUM源生效后,就能直接使用yum install 實現軟件的快速安裝部署;
[root@rhel7-01 ~]# yum install vsftpd* -y
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:3.0.2-10.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================
Package Arch Version Repository Size
========================================================================================================
Installing:
vsftpd x86_64 3.0.2-10.el7 rhel7_local 167 k
Transaction Summary
========================================================================================================
Install 1 Package
Total download size: 167 k
Installed size: 347 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : vsftpd-3.0.2-10.el7.x86_64 1/1
Verifying : vsftpd-3.0.2-10.el7.x86_64 1/1
Installed:
vsftpd.x86_64 0:3.0.2-10.el7
Complete!
王亦軍 老師 上海騰科
2018.02.25 提交上傳
上一篇: {思科 CCNA-SEC }由生成樹引發的端口五種狀態
下一篇: {紅帽 RHCA}Docker生態系統