Create a local repo source

1, reserved rpm package

Retention package to the specified directory when you install yum

The value of the edit /etc/yum.conf keepcache is 1;

2, the use of plug-ins

1, yum-plugin-downloadonly plug

sudo yum install yum-plugin-downloadonly
sudo yum install epel-release

sudo yum install ceph-0.87.1-0.el7.centos.x86_64.rpm --downloadonly --downloaddir=./

2,yumdownloader

In the command yum-utils package

yum  install  yum-utils   -y 
yumdownloader ntp --resolve  --destdir=./ 

3, the source arranged repo

repodata as a software repository, there are four necessary files in its catalog:. filelists.xml [gz], other.xml [gz], primary.xml [gz] and repomd.xml (md meaning metadata)...
Chief among them is repomd.xml file. Common reasons for not found error repodata directory or file appears usually there are three: First, routing problem; the second is not generated repodate directory; the third is * .repo profile conflict (this requires specially note)

Create a local source

1,yum install createrepo

2, a new local source directory

   mkdir -p local-yum/xxx/       #其中xx是包放置目录
   将安装包放置到xxx目录中
   createrepo local-yum/           #创建一个源

3, placed repo

[local-yum]
name=local-yum
baseurl=file:///home/test/local-yum/               #文件目录不能设置到xxxx,否则本地源使用会报错
enabled=1
gpgcheck=0

4, the detection

yum clean all
yum repolist

5, update the local source
in the directory where the warehouse
   createrepo --update local-yum / # update local source
   createrepo local-yum / # regenerate metadata

4, yum tool

yum install 软件名1 [软件名2] [...]
        yum update [软件名1][软件名2] [...]
        yum check-update
        yum upgrade [软件1] [软件2] [...]
        yum remove | erase 软件名1 [软件名2] [...]
        yum list [...]
        yum info [...]
        yum provides | whatprovides feature1 [feature2] [...]
        yum clean [ packages | headers | metadata | dbcache | all ]
        yum makecache
        yum groupinstall 软件组1 [软件组2] [...]
        yum groupupdate 软件组1 [软件组2] [...]
        yum grouplist [hidden] [groupwildcard] [...]
        yum groupremove group1 [group2] [...]
        yum groupinfo 软件组名 [...]
        yum search 字符串1 [字符串2] [...]
        yum shell [文件名]
        yum resolvedep 依赖关系1 [依赖关系2] [...]
        yum localinstall rpm包1 [rpm包2] [...]
        yum localupdate rpm包1 [rpm包2] [...]
        yum reinstall 软件包1 [软件包2] [...]
        yum downgrade 软件包1 [软件包2] [...]
        yum deplist 软件包1 [软件包2] [...]
        yum repolist [all|enabled|disabled]
        yum help [command]

Guess you like

Origin www.cnblogs.com/g2thend/p/11829020.html