Yum is a front-end tool for RPM, and the Yum command helps us automatically resolve dependencies between installing RPM packages. Here are the steps to build a local yum warehouse:
1. Mount the disc (CD-ROM ) Centos-6.5-x86_64-bin-dvd2.iso )
Mount/dev/cdrom1/media
LS a bit/media this directory, you can see the following content
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/30/78/wKiom1On6-2w7qeNAAFeysXZ7ds790.jpg "title=" 1.jpg " alt= "Wkiom1on6-2w7qenaafeysxz7ds790.jpg"/>
2. Create a local folder and copy all the RPM packages under packages to the local folder
Mount/dev/cdrom1/media/cp-r/media/packages/*/tmp/packages/
3. Run Createrepo command
Createrepo/tmp/packages/#如果没有createrepo命令 and needs to be installed.
After the Createrepo command is successfully run, the Repodata folder is generated under packages. The Repodata folder is similar to a small database with a dependency table between each RPM package.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/30/76/wKiom1On5NPRBmP6AAIi_0BMbZ8184.jpg "title=" 2.jpg " alt= "Wkiom1on5nprbmp6aaii_0bmbz8184.jpg"/>
4. Create a local Yum source and configure it next.
cd/etc/yum.repos.d/
You can see that there are several default Yum sources under this directory
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/30/76/wKioL1On5gmQhydeAAFIZb8i0Jg178.jpg "title=" 4.jpg " alt= "Wkiol1on5gmqhydeaafizb8i0jg178.jpg"/>
We can create a new file that ends with. Repo in this directory, and then define the values of several parameters in it. For example, I created a Local.repo file with the following file contents
[Localyum] Name=localrepo baseurl=file:///tmp/packages enabled=1 gpgcheck=0
[]: Define the name of the warehouse, not the same as other warehouse names.
Name: Description of the Warehouse
BaseURL: The address of the local Yum source. Start with file://, if it is a network Yum source, start with HTTP.//
Enabled: Whether to enable Yum source, 0 is disabled, 1 is enabled.
Gpgcheck: Whether to check the GPG signature. The local Yum source comes from the RPM package on the disc, so it can not be enabled, and if it is a network source, it needs to import the Gpgkey and specify the location if it is enabled for security.
If more than one Yum source is used at the same time, you can set the cost parameter to specify the priority, as follows:
cost=1000 #1000, 2000,3000 ... the smaller the number, the higher the priority.
5. Check if local yum is in effect
Yum Repolist #查看可用的yum源
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/30/78/wKiom1On6fqBiyhQAAFm5vWNpoE135.jpg "title=" 5.jpg " alt= "Wkiom1on6fqbiyhqaafm5vwnpoe135.jpg"/>
The red circle is the local Yum source that we just created, and if you think the local Yum source is enough, you can put the enabled=0 inside the other Yum source, which disables the source.
6, finally need to clean up the previous Yum cache, and then re-cache the new Yum source.
Yum Clean all yum Makecache
Done.