使用一台服务器配置私有仓库做yum源,本身使用file,客户端使用http连接
安装http服务:
[root@ceph1 ~]# yum -y install httpd
修改配置文件
DocumentRoot "/var/www/myyum" #作为yum的仓库地址
ServerName 172.25.254.130:80 #访问地址,直接使用IP
[root@ceph1 ~]# systemctl start httpd
[root@ceph1 ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
把yum包导进来
[root@ceph1 ~]# cd /var/www/myyum/
[root@ceph1 myyum]# ll
drwxr-xr-x. 3 root root 4096 Apr 1 14:17 saltstack
[root@ceph1 myyum]# tar -xf salt.tar
[root@ceph1 myyum]# cd saltstack/
[root@ceph1 saltstack]# createrepo .
-bash: createrepo: command not found
[root@ceph1 saltstack]# yum -y install createrepo
Spawning worker 0 with 13 pkgs Spawning worker 1 with 13 pkgs Workers Finished Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete
在文件下多一个这个文件
配置仓库
[root@ceph1 myyum]# cd /etc/yum.repos.d/
[root@ceph1 yum.repos.d]# vim private.repo
[private] name=centos baseurl=file:///var/www/myyum/saltstack gpgcheck=0
[root@ceph1 yum.repos.d]# yum clean all
[root@ceph1 yum.repos.d]# yum repolist
安装测试
在另一个服务器使用http读取仓库
[root@ceph2 ~]# cd /etc/yum.repos.d/
[root@ceph2 yum.repos.d]# vim private.repo
[private] name=private baseurl=http://172.25.254.130/saltstack gpgcheck=0
测试正常
[root@ceph2 yum.repos.d]# yum clean all
[root@ceph2 yum.repos.d]# yum repolist