1. Go to the/ETC/YUM.REPOS.D directory (this directory is stored in the Yum Repository configuration file)
[Email protected] ~]# cd/etc/yum.repos.d/
2. Create a configuration file named Rhel7.repo using the Vim editor (the file name can be customized, but the suffix must be repo)
[Email protected] yum.repos.d]# vim Rhel7.repo
Write the following parameters and save the exit item
[Rhel-media] #yum仓库的唯一标识符 to avoid conflicts with other warehouses
Name=anker #yum仓库的名称描述, easy to identify the use of warehouses
Baseurl=file:///media/cdrom #提供方式包括 FTP (ftp://. ), HTTP (/.) , local (file:///. )
Enable=1 #设置此源是否可用, 1 is available, 0 is disabled
Gpgcheck=1 #设置是否校验文件, 1 for checksum, 0 for non-checksum
Gpgkey=file:///media/cdrom/rpm-gpg-key-redhat-release #若为校验需指定公钥文件地址
3. Mount the disc according to the path of the configuration parameter and write the CD mount information to the/etc/fstab file
[Email protected] yum.repos.d]# mkdir-p/media/cdrom[[email protected] yum.repos.d]# mount/dev/cdrom/media/cdrom/ Mount:/dev/sr0 is write-protected, mounting read-only[[email protected] yum.repos.d]# vim/etc/fstab/dev/cdrom/mdeia/c Drom iso9660 Defaults 0 0
4. Verify the success, the complete! appears It means that the Yum warehouse is configured correctly
[[email protected] yum.repos.d]# yum install -y httpdloaded plugins: Langpacks, product-id, subscription-managerthis system is not registered to red hat subscription management. you can use subscription-manager to register.rhel-media | 4.1 kb 00:00:00 (: 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 ..... Omit part of the information ... 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 &nbSp complete!
This article is from the "Learning Path" blog, please be sure to keep this source http://rhelanker.blog.51cto.com/12834161/1967409
RHEL7 Configuring the local yum repository in VMware