创建yum本地仓库,将阿里仓库同步到本地,并定时更新
很多时候为了加速自己内部的rpm包安装速度,都会搭建自己的yum源仓库,而使用系统光盘自带的源,由于软件版本比较落后,所以不太适用,而大家都在用的阿里仓库比较好用,所以就想到了把阿里仓库的rpm全部拉到本地,并做yum仓库的定时更新。这样既能保证软件包是最新的,也能保证软件的安装速度。那么下面来具体实施,搭建自己的yum本地仓库,并定时从阿里仓库同步过来。
第一步:下载阿里镜像的repo安装包,centos6就下载6的,7的就下载7的地址:https://mirrors.aliyun.com/repo/
我们以centos7的镜像为例
- cd /etc/yum.repos.d/
- mkdir bak
- mv Centos* bak #将系统自带的源备份到bak目录下
- wget https://mirrors.aliyun.com/repo/Centos-7.repo
- cat Centos-7.repo
- # CentOS-Base.repo
- #
- # The mirror system uses the connecting IP address of the client and the
- # update status of each mirror to pick mirrors that are updated to and
- # geographically close to the client. You should use this for CentOS updates
- # unless you are manually picking other mirrors.
- #
- # If the mirrorlist= does not work for you, as a fall back you can try the
- # remarked out baseurl= line instead.
- #
- #
- [base]
- name=CentOS-$releasever - Base - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
- http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
- #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
- gpgcheck=1
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
- #released updates
- [updates]
- name=CentOS-$releasever - Updates - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
- http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
- #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
- gpgcheck=1
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
- #additional packages that may be useful
- [extras]
- name=CentOS-$releasever - Extras - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
- http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
- #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
- gpgcheck=1
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
- #additional packages that extend functionality of existing packages
- [centosplus]
- name=CentOS-$releasever - Plus - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
- http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
- #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
- gpgcheck=1
- enabled=0
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
- #contrib - packages by Centos Users
- [contrib]
- name=CentOS-$releasever - Contrib - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
- http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
- #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
- gpgcheck=1
- enabled=0
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
已经配置好的阿里仓库
- yum repolist #查看阿里的可用仓库,有启用的表示已经成功了
- 从阿里服务器将rpm同步到本地需要两个rpm软件createrepo 和 yum-utils
- yum install createrepo yum-utils -y #yum安装这两个包
- mkdir -p /mirrors/Packege #创建rpm包的存放目录
- reposync -r base -p /mirrors/Packege #将已经配置好的阿里仓库镜像内的rpm包拉到本地,b ase为本地已经配置好的仓库名,可以用yum repolist查看到
- createrepo -pdo /mirrors/ /mirrors/Packege #创建repo数据库
- vim /cron/repository.sh #编写同步脚本
- reposync -r base -p /mirrors/Packege -d #来删除本地老旧
- reposync -r base -p /mirrors/Packege
- crontab -e #添加定时任务
- 0 0 1 * * sh /cron/repository.sh #每月1日0时更新yum仓库
创建yum本地仓库,将阿里仓库同步到本地,并定时更新的更多相关文章
- maven多仓库配置 公司仓库和阿里仓库
针对公司内网私服仓库,私服仓库不能访问外网,此时无法在私服仓库代理阿里的maven仓库.我们的maven就需要配置多个仓库: maven目录下的conf/settings.xml配置文件: 一.在pr ...
- CentOS7搭建本地YUM仓库,并定期同步阿里云源
CentOS7同步阿里云镜像rpm包并自建本地yum仓库 系统环境 # cat /etc/centos-release CentOS Linux release 7.6.1810 (Core) # u ...
- 同步阿里云镜像到本地,在本地搭建YUM仓库
1.下载阿里云镜像repo文件 项目使用CentOS6系统,因此我下载的文件是: # CentOS-Base.repo # # The mirror system uses the connectin ...
- CentOS 7 搭建本地YUM仓库,并定期同步阿里云源
目录导航: 1. 系统环境 2. 修改yum 源为阿里云源 3. 安装yum相关的软件 4. 根据源标识同步源到本地目录 5. 安装nginx开启目录权限保证本地机器可以直接本地yum源 6. 客户端 ...
- CentOS7搭建yum源仓库(阿里源)
文章目录 注意:环境要求 1.配置服务器端yum 1.1.安装yum源工具 1.2.配置nginx 1.2.1.配置nginx页面目录 1.3.替换yum源文件 1.4.建立yum源仓库 2.配置客户 ...
- Git本地仓库与远程github同步的时候提示fatal: remote origin already exists 错误解决办法
Git本地仓库与远程github同步的时候提示fatal: remote origin already exists 错误解决办法 1.git在本地的电脑创建了仓库,要远程同步github的仓库.使用 ...
- Maven settings.xml配置(指定本地仓库、阿里云镜像设置)
转: 详解Maven settings.xml配置(指定本地仓库.阿里云镜像设置) 更新时间:2018年12月18日 11:14:45 作者:AmaniZ 我要评论 一.settings. ...
- Maven本地仓库/中央仓库(阿里镜像)/JDK配置
第一步打开你已经下载好的Maven,进入:根磁盘:\......\apache-maven-3.6.2\conf文件夹找到settings.xml文件(没有的可以自行创建一个同名的文件即可) 使用文本 ...
- github 创建网络仓库 ,使用git工具将本地文件上传/删除 --- 心得
1.前言 使用 git做项目控制版本工具,当然,使用SVN也可以,但是,git让人感觉更先进一些,与GitHub结合,用起来很方便,服务端由官网控制. 而SVN分客户端和服务端,都是个人控制,因此, ...
随机推荐
- 使用power designer,PL/SQL,cmd建立oracle数据库
这一系列操作需要powerDesigner,PL/SQL工具 1.首先使用powerDesigner建立概念模型 2.概念模型界面例子 3.其中建立概念模型操作图标详解 4.建立物理模型 5.生成数据 ...
- java-监听器(Listener)
监听器:用于监听web应用中某些对象.信息的创建.销毁等动作,服务器会自动调用相应的方法进行处理.常用于统计在线人数,初始化系统参数等. Javaweb监听器主要监听对象有ServletContext ...
- 记录一次 hadoop yarn resourceManager无故切换的故障
某日 收到告警 线上集群rm切换 观察resourcemanager 日志报错如下 这行不明显 再看看其他日志报错 在 app attempt_removed 时候发生了空指针错误 break; ca ...
- C程序设计语言练习 第三章
3.3 else-if语句 折半查找,这里通过一个折半查找说明三路判定程序的用法.该函数用于判定已排序好的数组v中是否存在某个特定的值.数组v的元素必须以升序排列.如果v中包含x,则该函数返回x在v中 ...
- 剑指offer21:第一个序列表示栈的压入顺序,请判断第二个序列是否可能为该栈的弹出顺序。(注意:这两个序列的长度是相等的)
1 题目描述 输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否可能为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是 ...
- codeforces 1251D Salary Changing (二分+贪心)
(点击此处查看原题) 题意分析 一共有s元钱,要用这些钱给n个人发工资,发给每个人的工资si有最少和最多限制 si ∈[li,ri],在发给n个人的总工资小于s的情况下,要求发给n个人中的工资的中位数 ...
- linux fork进程请谨慎多个进程/线程共享一个 socket连接,会出现多个进程响应串联的情况。
昨天组内同学在使用php父子进程模式的时候遇到了一个比较诡异的问题 简单说来就是:因为fork,父子进程共享了一个redis连接.然后父子进程在发送了各自的redis请求分别获取到了对方的响应体. 复 ...
- spring cloud链路追踪组件sleuth和zipkin
spring cloud链路追踪组件sleuth 主要作用就是日志埋点 操作方法 1.增加依赖 <dependency> <groupId& ...
- Python【条件判断】
单向判断ifif xxx: #冒号 #条件 print(xxx) #缩进是四个空格或一个Tab键#被缩进的内容(print()函数)和if条件语句组成了一个代码块(一个整体)————————————— ...
- python 基础例子 双色球 查询天气 查询电话
# 随机生成双色球import random# 随机数 1-16之间# r = random.randint(1,16)# print(r)phone_numbers_str = "匪警[1 ...