Centos7创建局域网yum源仓库

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7创建局域网yum源仓库相关的知识,希望对你有一定的参考价值。

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

以上是关于Centos7创建局域网yum源仓库的主要内容,如果未能解决你的问题,请参考以下文章

在Centos7上搭建局域网的yum源仓库

CentOS 如何搭建本地和局域网yum源

CentOS7.3 创建本地YUM源和局域网YUM源

CentOS7.2 创建本地YUM源和局域网YUM源

局域网内配置yum源仓库

centos7创建本地源并搭建局域网yum源服务器