YUM源部署和使用

简介: 为什么需要内部yum源呢,有可能是业务内部的服务器对外是不通了,居于一些安全方面的考虑。内部yum源又有什么好处呢,第一,速度快;第二,内网可控,外网有问题也不影响内网包的下载和安装等。

1.前言

为什么需要内部yum源呢,有可能是业务内部的服务器对外是不通了,居于一些安全方面的考虑。内部yum源又有什么好处呢,第一,速度快;第二,内网可控,外网有问题也不影响内网包的下载和安装等。

2.部署

2.1 创建yum仓库目录

mkdir -p /data/yum_data/centos/6/os/x86_64/
mkdir -p /data/yum_data/centos/6/extras/x86_64/
mkdir -p /data/yum_data/centos/6/updates/x86_64/
mkdir -p /data/yum_data/epel/6/x86_64/

2.2 镜像同步公网yum源

上游yum源必须要支持rsync协议,否则不能使用rsync进行同步
CentOS官方标准源:rsync://mirrors.ustc.edu.cn/centos/
epel源:rsync://mirrors.ustc.edu.cn/epel/
同步命令:

rsync -auvzP --bwlimit=1000 rsync://rsync.mirrors.ustc.edu.cn/centos/6/os/x86_64/ /data/yum_data/centos/6/os/x86_64/
rsync -auvzP --bwlimit=1000 rsync://rsync.mirrors.ustc.edu.cn/centos/6/extras/x86_64/ /data/yum_data/centos/6/extras/x86_64/
rsync -auvzP --bwlimit=1000 rsync://rsync.mirrors.ustc.edu.cn/centos/6/updates/x86_64/ /data/yum_data/centos/6/updates/x86_64/
# epel源
 rsync -auvzP --bwlimit=1000 --exclude=debug rsync://rsync.mirrors.ustc.edu.cn/epel/6/x86_64/ /data/yum_data/epel/6/x86_64/

2.3 提供yum服务

部署tengine,server的配置如下:

#/usr/local/nginx/conf.d/iso.conf
server {
   
listen 80;
server_name localhost;
access_log logs/iso.log main;
location / {
   
autoindex on;
root /data/yum_data/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
   
root html;
   }
}

2.4 客户端配置

配置客户端的yum源文件,配置在/etc/yum.repos.d/下面:
/etc/yum.repos.d/CentOS-Base.repo 配置:

[base107]
name=CentOS-$releasever - Base
baseurl=http://192.168.31.107/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates
[updates107]
name=CentOS-$releasever - Updates
baseurl=http://192.168.31.107/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras107]
name=CentOS-$releasever - Extras
baseurl=http://192.168.31.107/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

/etc/yum.repos.d/epel.repo 配置:

[epel107]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://192.168.31.107/epel/6/$basearch
failovermethod=priority
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

2.5 客户端的命令使用

yum clean all
yum install telnet -y
目录
相关文章
|
JavaScript Linux 数据库
搭建本地yum源
本地yum源的搭建
2436 0
|
Linux Docker 容器
小记:配置阿里云yum源遇到的坑
在CentOS8.5上打算用yum安装docker, 执行时发现yum源没有配置,百度一下后,按照下面步骤进行了修改。
808 0
小记:配置阿里云yum源遇到的坑
|
缓存 PHP 存储
|
Linux 缓存 网络安全
|
测试技术
安装yum源
redhat系列的yum配置文件放在/etc/yum.repos.d/xxx.repo 文件的基本格式 [xxx] name=xxx baseurl= http://xxxxx 镜像仓库链接 gpgcheck=0 不扫描 测试yum是...
1760 0

热门文章

最新文章