linux创建本地yum仓库

先创建一个文件夹

# mkdir /docker

然后将要安装的rpm包放进这个文件夹

进入文件查看,确保已经有rpm包

# ls
docker-engine-1.12.1-1.el7.centos.x86_64.rpm       
docker-engine-selinux-1.12.1-1.el7.centos.noarch.rpm
 

创建repo

# createrepo .

Spawning worker 0 with 1 pkgs
Spawning worker 1 with 1 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
 

查看,已经有了repodata

# ls -l
-rw-r--r-- 1 root root 19917380 3月  28 2017 docker-engine-1.12.1-1.el7.centos.x86_64.rpm
-rw-r--r-- 1 root root    28860 3月  28 2017 docker-engine-selinux-1.12.1-1.el7.centos.noarch.rpm
drwxr-xr-x 2 root root     4096 1月   5 19:58 repodata
 

将repodata加进仓库列表

[docker]
name=docker
baseurl=file:///docker
enable=1
gpgcheck=0
 

然后清下yum缓存

# yum clean all

最后检查下有没加成功

# yum search docker

 

 

 

 

 

 

 

你可能感兴趣的:(linux)