标签:本地yum源 rhel7
1.进入到 /etc/yum.repos.d 目录中(该目录是存放yum仓库配置文件的)
[root@RHEL-CLU01 ~]# cd /etc/yum.repos.d/
2.使用vim编辑器创建名为 rhel7.repo 的配置文件(文件名称可以自定义,但后缀必须是repo)
[root@RHEL-CLU01 yum.repos.d]# vim rhel7.repo
逐项写入以下参数并保存退出
[rhel-media] #yum仓库的唯一标识符,避免与其他仓库冲突
name=anker #yum仓库的名称描述,易于识别仓库的用处
baseurl=file:///media/cdrom #提供方式包括 FTP(ftp://..)、HTTP(http://..) 、本地(file:///..)
enable=1 #设置此源是否可用,1为可用,0为禁用
gpgcheck=1 #设置是否校验文件,1为校验,0为不校验
gpgkey=file:///media/cdrom/RPM-GPG-KEY-redhat-release #若为校验需指定公钥文件地址
3..按照配置参数的路径把光盘挂载,并把光盘挂载信息写入到 /etc/fstab 文件中
[root@RHEL-CLU01 yum.repos.d]# mkdir -p /media/cdrom [root@RHEL-CLU01 yum.repos.d]# mount /dev/cdrom /media/cdrom/ mount: /dev/sr0 is write-protected, mounting read-only [root@RHEL-CLU01 yum.repos.d]# vim /etc/fstab /dev/cdrom /mdeia/cdrom iso9660 defaults 0 0
4.验证是否成功,出现 Complete! 则代表Yum仓库配置正确
[root@RHEL-CLU01 yum.repos.d]# yum install -y httpd Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. rhel-media | 4.1 kB 00:00:00 (1/2): rhel-media/group_gz | 134 kB 00:00:00 (2/2): rhel-media/primary_db | 3.4 MB 00:00:00 Resolving Dependencies --> Running transaction check ---> Package httpd.x86_64 0:2.4.6-17.el7 will be installed --> Processing Dependency: httpd-tools = 2.4.6-17.el7 for package: httpd-2.4.6-17.el7.x86_64 --> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-17.el7.x86_64 --> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-17.el7.x86_64 --> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-17.el7.x86_64 --> Running transaction check ---> Package apr.x86_64 0:1.4.8-3.el7 will be installed ---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed ---> Package httpd-tools.x86_64 0:2.4.6-17.el7 will be installed ---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed --> Finished Dependency Resolution 。。。。。。。。。。省略部分信息。。。。。。。。。 Running transaction Installing : apr-1.4.8-3.el7.x86_64 1/5 Installing : apr-util-1.5.2-6.el7.x86_64 2/5 Installing : httpd-tools-2.4.6-17.el7.x86_64 3/5 Installing : mailcap-2.1.41-2.el7.noarch 4/5 Installing : httpd-2.4.6-17.el7.x86_64 5/5 rhel-media/productid | 1.6 kB 00:00:00 Verifying : mailcap-2.1.41-2.el7.noarch 1/5 Verifying : httpd-tools-2.4.6-17.el7.x86_64 2/5 Verifying : apr-1.4.8-3.el7.x86_64 3/5 Verifying : apr-util-1.5.2-6.el7.x86_64 4/5 Verifying : httpd-2.4.6-17.el7.x86_64 5/5 Installed: httpd.x86_64 0:2.4.6-17.el7 Dependency Installed: apr.x86_64 0:1.4.8-3.el7 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-17.el7 mailcap.noarch 0:2.1.41-2.el7 Complete!
本文出自 “学习之路” 博客,请务必保留此出处http://rhelanker.blog.51cto.com/12834161/1967409
标签:本地yum源 rhel7
原文地址:http://rhelanker.blog.51cto.com/12834161/1967409