1.创建yum仓库
1.1 安装依赖包
yum groupinstall "Development Tools" -y
yum install net-tools vim -y
yum install yum-utils -y
yum install createrepo.noarch -y
1.2 部署Http服务
yum install httpd
systemctl enable httpd
systemctl start httpd
1.3 通过Http服务配置yum源
mkdir /etc/httpd/conf.d/bak
mv /etc/httpd/conf.d/*.conf /etc/httpd/conf.d/bak
vim /etc/httpd/conf/http.conf 修改如下:
<Directory />
AllowOverride none
Require all granted # 权限放行
</Directory>
具体可能依赖于httpd版本。
1.4 关闭selinux
vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled # 改为disable
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
1.5 打开防火墙端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
1.6 创建一个yum源
mkdir -p /data/repos/4.3.10
cp test.rpm /data/repos/4.3.10
cd /data/repos/4.3.10
createrepo ./ 后续如果要更新:createrepo --update ./
ln -s /data/repos /var/www/html
systemctl restart httpd
2.引用yum仓库
在另一台Centos7主机上,创建文件: /etc/yum.repos.d/ovirt-dev.repo ,内容如下:
[ovirt-dev]
name=ovirt-dev
baseurl=http://10.103.177.58/repos/4.3.10
enabled=1
gpgcheck=0
执行:
yum search test