How to download RPM package to Local
When setting up Yum installation, keep the RPM package.
1. Edit/etc/yum.conf to set the value of Keepcache to 1;
This makes it possible to keep the RPM package at Yum installation under/var/cache/yum
2. Or use the Yum-plugin-downloadonly plugin,
sudo yum install yum-plugin-downloadonly
Usage: sudo yum install ceph-0.87.1-0.el7.centos.x86_64.rpm--downloadonly--downloaddir=./
Sometimes CentOS rpm source is not up-to-date, need to install a epel source, sudo yum install epel-release
Repodata as the repository of the software, there are four necessary files in the directory: Filelists.xml. [Gz],other.xml. [Gz],primary.xml. [GZ] and Repomd.xml (MD means metadata), the most important of which is the Repomd.xml file. There are usually three reasons for errors that cannot be found for Repodata directories or files: One is the path problem, the other is the Repodate directory is not generated, and the third is the *.repo configuration file conflict (this needs to be deliberately noted).
Create a local source step as follows:
1, install Createrepo package;
2. Create a new local source directory (if the local source is in the current home directory)
2.1 $mkdir-P local-yum/i386/#其中i386是包放置目录
2.2 Placing the installation package in the I386 directory
2.3 Createrepo local-yum/#创建一个源
3, configure the Yum source (you can create a separate repo file, you can also add to the existing repo file)
************************************************************
[Local-yum]
Name=local-yum
baseurl=file:///home/test/local-yum/#文件目录不能设置到i386, otherwise local source usage will error
Enabled=1
Gpgcheck=0
Explain:
[....] The name that represents the library must be unique and cannot be duplicated.
Name= is the description of this library, not much practical meaning, just a field description.
Baseurl= instructions to take what way transmission, specific path where, can be used in the way there, file://,ftp://,http://etc.
Enabled=1 instructions to enable this update library, 0 means not enabled.
Gpgcheck=1 means using GPG files to check the signature of the software package
The gpgkey= represents the location where the GPG file is stored, and it can also be located in HTTP mode.
************************************************************
You can use the following command to verify that the Yum source is successfully installed
Yum Clean Allyum repolist
4. Introduction to Yum Tools
The Yum tool has a number of parameters to use, as follows:
Yum install software name 1 [software name 2] [...]
Yum Update [software name 1][software name 2] [...]
Yum Check-update
Yum upgrade [software 1] [software 2] [...]
Yum Remove | Erase software name 1 [software name 2] [...]
Yum list [...]
Yum info [...]
Yum provides | Whatprovides Feature1 [Feature2] [...]
Yum Clean [Packages | headers | metadata | dbcache | all]
Yum Makecache
Yum Groupinstall software Group 1 [software Group 2] [...]
Yum groupupdate software Group 1 [software Group 2] [...]
Yum grouplist [Hidden] [Groupwildcard] [...]
Yum Groupremove group1 [group2] [...]
Yum groupinfo software group name [...]
Yum search string 1 [string 2] [...]
Yum Shell [file name]
Yum resolvedep Dependency 1 [Dependency 2] [...]
Yum Localinstall rpm Package 1 [RPM Package 2] [...]
Yum localupdate rpm Package 1 [RPM Package 2] [...]
Yum Reinstall package 1 [software package 2] [...]
Yum downgrade package 1 [software package 2] [...]
Yum deplist Package 1 [software package 2] [...]
Yum Repolist [all|enabled|disabled]
Yum Help [command]
The above is the full range of yum parameters, automatic analysis of dependency relationship is its best feature, but also the most convenient installation method at present.
5, update the local source, in the directory where the warehouse
Createrepo--update local-yum/# Update Local source
Createrepo local-yum/# Regenerate metadata
6, the use of the command
Createrepo--update:
Sometimes your repositories contain a lot of packages, although only a small part of it changes but you don't have to re-generate metadata for each package, which is obviously a waste of time. This is why the--update option was born.
Run the Createrepo command as before but add the--update option. $createrepo--updatelocal-yum/now Createrepo only updates those items that have been changed, added, or deleted since the last time the metadata was generated.
VerifytreeIf you have just done a repo and you want to verify that everything in your repo is correct and can do its job, you can run the Erifytree command to check all the Repodata and packages.
7. Create an HTML-based update source
7.1 Installing the HTTPD installation package
7.2 Create a local update source as above
cd/var/www/html/
Mkdir-p NSMC
Cdnsmc
mkdir RPMS SRPMS
7.3 Copying related files into the RPMs and Srpms directories
7.4 Execute the following command in the directory where the NSMC is located
Createrepo NSMC #创建仓库
7.5 Service httpd Start #启动httpd守护进程, this is one of the key places, otherwise you will be prompted not to find the relevant source on other machines
7.6 Writing repo files
*************************************
[NSM]
Name=neoshine Linux Desktop 5 NSMC repo-i386
Baseurl=http://xxx.xxx.xxx.xxx/nsmc
Enabled=1
Gpgcheck=0
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-neoshine-release
Note: Gpgcheck is set to 0, no authentication signature is required.
Linux download rpm package to local, Createrepo: Create local Yum source