首页 > 其他 > 详细

centos6.0搭建本地yum源,网络源

时间:2019-07-18 12:21:52      阅读:109      评论:0      收藏:0      [点我收藏+]
centos6.0搭建本地yum源,网络源
本文讲解yum源的三个使用方法,可根据实际生产环境进行选择,建议有linux基础的同学学习,挂载镜像和服务安装启动这些不讲了,或者直接傻瓜式操作,直接粘贴复制也可以使用。
1.本地yum源:将本地的IOS镜像挂载在本地目录中,当作yum源。
2.服务器yum源:将某台服务器当作yum源,用于本地的服务安装和升级
注:有两种方法使用ftp时,需要将vsftpd服务启动,使用http时需要将httpd服务启动,关于linux的基础服务自己看书吧。
3.公网网络源(163、阿里云、等)使用公网资源当作本机的yum源,可根据服务器yum源配合使用(一台访问公网,其他访问这台)
本文整合了本地yum源和服务器地址的yum源以及阿里云的网络源,服务器IP根据实际生产环境自己更改

yum网络源地址:
163的网络源地址:
centos6.0的网络源地址:
http://mirrors.163.com/centos/6/os/x86_64/
centos7.0的网络源地址:
http://mirrors.163.com/centos/7/os/x86_64/

阿里云的网络源地址:
centos6.0的网络源地址:
http://mirrors.aliyun.com/repo/Centos-6.repo
centos7.0的网络源地址:
http://mirrors.aliyun.com/repo/Centos-7.repo
http://mirrors.aliyun.com/centos/6/os/x86_64/
2.下载新的repo 到/etc/yum.repos.d/
wget -O /etc/yum.repos.d/Centos-6.repo http://mirrors.aliyun.com/repo/Centos-6.repo
注:这一步下载下来的repo文件对于4年前不修改可以用,但对于目前需要更改地址才可以使用。

3.如下整合了本地yum源和服务器地址的yum源以及阿里云的网络源
[root@master yum.repos.d]# pwd
/etc/yum.repos.d
[root@master yum.repos.d]# cat CentOS-Base.repo
#linux系统本身的yum源地址
[base]
enable=0
name=aaa
baseurl=file:///mnt/server
gpgcheck=0

#将服务器10.1.1.10当作yum源地址
[pxe]
name=pxe
baseurl=http://10.1.1.10/kickstart
gpgcheck=0
#使用阿里云的yum源地址
[aliyun]
name=aliyun
baseurl=http://mirrors.aliyun.com/centos/6/os/x86_64/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/updates/x86_64/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/extras/x86_64/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/contrib/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
4.

  • clean [ packages | metadata | expire-cache | rpmdb | plugins | all ]
    *makecache
    Clean:
    Is used to clean up various things which accumulate in the yum cache directory over time. More complete
    details can be found in the Clean Options section below.
    Makecache:
    Is used to download and make usable all the metadata for the currently enabled yum repos.

技术分享图片
5.配置完成后使用命令yum -y list 测试yum

技术分享图片
整合后的yum源配置完成

centos6.0搭建本地yum源,网络源

原文:https://blog.51cto.com/7794482/2421141

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!