建立本地yum源
使用环境
- 服务器处于内网,需要更新
- 网络资源紧张,节约带宽
建立yum目录
mkdir -p /opt/opmgmt/yum
rsync服务器列表
同步脚本
/opt/opmgmt/yum/rsync_centos.sh
#!/bin/bash
repo_root='/opt/opmgmt/yum/centos/'
sync_cmd='rsync -arv --delete-after --delete-excluded'
sync_srv='rsync://mirrors.shu.edu.cn/centos/'
exclude='--exclude [23456]/ --exclude [2345]\.*/ --exclude i386/ --exclude drpms/ --exclude SCL/ --exclude centosplus/ --exclude contrib/ --exclude cr/ --exclude fasttrack/ --exclude isos/ --exclude virt/ --exclude paas/ --exclude 7.[012]*/ --exclude atomic/ --exclude cloud/ --exclude storage/'
[ -d $repo_root ] && mkdir -p $repo_root
$sync_cmd $exclude $sync_srv $repo_root &
/opt/opmgmt/yum/rsync_epel.sh
#!/bin/bash
repo_root='/opt/opmgmt/yum/epel/'
sync_cmd='rsync -arv --delete-after --delete-excluded'
sync_srv='rsync://mirrors.shu.edu.cn/epel/'
exclude='--exclude [45]*/ --exclude testing/ --exclude SRPMS/ --exclude i386/ --exclude ppc64*/ --exclude aarch64/ --exclude debug/ --exclude=repoview'
[ -d $repo_root ] && mkdir -p $repo_root
$sync_cmd $exclude $sync_srv $repo_root &
cd yum
rsync -avzRHP --delete-after --exclude={'debug/','drpms/'} rsync://hkg.mirror.rackspace.com/epel/7/x86_64/ epel/
rsync -avzRHP --delete-after --exclude={'atomic/','cr/','dotnet/','fasttrack/','isos/','nfv/','opstools/','rt/'} rsync://hkg.mirror.rackspace.com/centos/7/ centos/
计划任务
/etc/cron.d/sync-yum-repo
0 1 * * * root /bin/sh /opt/opmgmt/yum/rsync_centos.sh
0 2 * * * root /bin/sh /opt/opmgmt/yum/rsync_epel.sh
自定义源
yum install createrepo
mkdir -p /opt/opmgmt/yum/custom/x86_64
copy *rpm /opt/opmgmt/yum/custom/x86_64
createrepo -p -d --update /opt/opmgmt/yum/custom/x86_64
nginx服务配置
/etc/nginx/conf.d/yum.conf
server {
listen 192.168.0.100:80;
server_name yum.localhost;
#allow 10.0.1.0/24;
#deny all;
charset utf-8;
access_log /var/log/nginx/$server_name.access.log main;
location / {
root /opt/www/yum;
index index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
repo文件
/opt/opmgmt/yum/repo/centos.repo
[base]
name=CentOS-$releasever - Base
baseurl=http://yum.localhost/centos/$releasever/os/$basearch
gpgcheck=0
enabled=1
priority=1
[updates]
name=CentOS-$releasever - Updates
baseurl=http://yum.localhost/centos/$releasever/updates/$basearch
gpgcheck=0
enabled=1
priority=1
[extras]
name=CentOS-$releasever - Extras
baseurl=http://yum.localhost/centos/$releasever/extras/$basearch
gpgcheck=0
enabled=1
priority=1
[centos-sclo-sclo]
name=CentOS-$releasever - SCLo sclo
baseurl=http://yum.localhost/centos/$releasever/sclo/$basearch/sclo
gpgcheck=0
enabled=1
priority=2
[centos-sclo-rh]
name=CentOS-$releasever - SCLo rh
baseurl=http://yum.localhost/centos/$releasever/sclo/$basearch/rh
gpgcheck=0
enabled=1
priority=2
另外一种方法
yum install yum-utils
reopsync
建立本地yum源的更多相关文章
- Centos6.5建立本地YUM源
很多情况下公司的服务器是不允许连外网的,那么安装软件的时候就很不方便了,这里就需要建立一个本地YUM源了. 文件位置:/etc/yum.repos.d/ 后缀一定是.repo结束. 下面我们搭建 ...
- createrepo 建立本地yum源
linux使用createrepo制作本地yum源 目录 linux使用createrepo制作本地yum源 安装createrepo软件包 进入本地rpm包目录 执行完后可以看到生成的repod ...
- CentOS下建立本地YUM源并自动更新
1. 尽管有很多的免费镜像提供yum源服务,但是还是有必要建立自己的yum服务器,主要出于以下几点考虑: l 网络速度:访问互联网可能比较慢 l 节省带宽:如果有大量的服务器,架设自己的yum源可以有 ...
- CentOS 6 通过DVD快速建立本地YUM源
一.将DVD光盘放入RedHat/CentOS6.X服务器/电脑光驱中 二.挂载DVD光驱到/mnt/cdrom # mkdir -p /mnt/cdrom # mount -t iso9660 /d ...
- Centos6.4建立本地yum源
https://jingyan.baidu.com/article/e9fb46e1aed8207521f7662c.html
- Linux网络安全篇,配置Yum源(一),本地Yum源
1.创建挂载目录 mkdir /mnt/cdrom 2.挂载软件源cdrom mount /dev/cdrom /mnt/cdrom/ 3.建立本地yum源资源文件夹 mkdir /usr/local ...
- 本地yum源建立
一.openstack(ocata)本地yum源的建立: 1.配置yum缓存: vi /etc/yum.conf 把yum.conf配置改为: [main] cachedir=/var/cache/y ...
- Centos6.4 本地yum源配置
由于单位的服务器均使用的是内网,而安装一些软件如Git,需要很多的依赖包,使用yum安装相对简单,由于不能联网故配置本地yum源配置. 1.首先将需要rpm库添加到系统中: 1).虚拟机中安装的lin ...
- yum_rpm(利用dvd建立本地yum库)
#wget "http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os" 建立起了index.html ...
随机推荐
- manjaro linux KDE桌面网易云音乐点击托盘图标无反应
这是一个很奇怪的问题,它的解决方法更奇怪... 找到网易云,右键,选择“编辑应用程序” 在打开的窗口中选中应用程序一栏 将“命令”的内容替换为: 1 env XDG_CURRENT_DESKTOP=D ...
- shiro 的简单应用
shiro 的简单应用 shiro官网:https://shiro.apache.org/ shiro 简介: Apache Shiro(日语"堡垒(Castle)"的意思)是 ...
- 前端优化系列之一:dns预获取 dns-prefetch 提升页面载入速度
问题:怎么做到dns域解析? 用于优化网站页面的图片 问题:怎么提升网站性能? dns域解析,是提升网站的一个办法. DNS Prefetch,即DNS预获取,是前端优化的一部分. 一般来 ...
- Python:raw_input 和 input用法
转自:http://blog.csdn.net/kjing/article/details/7450146 Python input和raw_input的区别 使用input和raw_input都可以 ...
- apache 压缩 gzip
配置 编辑httpd.conf文件 去掉 #LoadModule headers_module modules/mod_headers.so 前面的注释# 去掉 #LoadModule deflate ...
- Codeforces Round #520 (Div. 2) B math(素数因子的应用)
题意: 给出一个n ; 有两个操作: 1,mul A , n=n*A : 2,sqrt() , n=sqrt(n) 开更出来必须是整数 : 求出经过这些操作后得出的最小 n , 和 ...
- Photoshop入门教程(二):暂存盘设置与标尺设置
新建文档之后大家就可以对图像进行编辑.在对图像进行编辑之前,先来了解一下如何查看图像的一些基本信息.在软件左下角,会有这样的信息显示窗口. 1窗口表示当前图像显示比例,200%代表当前为放大两倍显示. ...
- bootstrap多选框
不多说,先上图片 本多选框是用的bootstrap的样式为基础,将弹出框css改造,然后自己写的js得到. 下面为全部页面的代码,需要的可以自己改动js,得到自己需要的效果 <!DOCTYPE ...
- java中double的四舍五入 BigDecimal
转载:https://blog.csdn.net/xiaobing_122613/article/details/71077225 1. 功能 将程序中的double值精确到小数点后两位.可以四舍五入 ...
- testlink数据库访问密码修改
testlink重启后数据库连接不上将会报错 错误:1045 - Access denied for user 'my_db '@'localhost' (using password: YES) 怎 ...