centos配置yum源
CentOS6.6下配置本地yum源与网络yum源
CentOS6.6下配置本地yum源与⽹络yum源⼀、本地yum源1、系统默认已经安装了可使⽤yum的软件包,所以可以直接配置:[root@localhost ~]# cd /etc/yum.repos.d/ yum源配置⽂件放置⽬录[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak 先将⽹络yum源配置⽂件更名(让其失效)[root@localhost yum.repos.d]# vim CentOS-Media.repo 编辑本地yum源⽂件[c6-media]name=CentOS-$releasever - Media 本地yum源名称(可随意修改)baseurl=file:///mnt/sr0 光盘挂载⽬录/mnt/sr0gpgcheck=1enabled=1 使⽤此yum源(等于0为不启⽤)gpgkey=file:///mnt/sr0/RPM-GPG-KEY-CentOS-6 本地yum源密钥⼆、简单配置国内⽹络yum源⽹易(163)yum源是国内最好的yum源之⼀,⽆论是速度还是软件版本,都⾮常的不错,将yum源设置为163yum,可以提升软件包安装和更新的速度,同时避免⼀些常见软件版本⽆法找到。
具体设置⽅法如下:1,进⼊yum源配置⽬录cd /etc/yum.repos.d3,更新玩yum源后,执⾏下边命令更新yum配置,使操作⽴即⽣效yum makecache理论上讲,这些yum源redhat系统以及fedora也是可以⽤的,但是没有经过测试,需要的站长可以⾃⼰测试⼀下。
三、⽹络yum源(前提是必须能连上互联⽹,此处使⽤的yum源是中国科技⼤学的地址如下:[root@localhost yum.repos.d]# mv CentOS-Base.bak CentOS-Base.repo 如果之前没更名就不⽤操作此步骤[root@localhost yum.repos.d]# vim CentOS-Base.repo 编辑⽹络yum源⽂件[base]name=CentOS-$releasever - Basegpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#released updates[updates]name=CentOS-$releasever - Updatesgpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#additional packages that may be useful[extras]name=CentOS-$releasever - Extrasgpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages [centosplus]name=CentOS-$releasever - Plusgpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib]name=CentOS-$releasever - Contribgpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6四、注意事项:使⽤yum时最好只能让⼀个yum源⽣效,因为系统默认优先使⽤⽹络yum源。
redhat6.6配置使用centos的yum源
5、更新 yum 源 在/etc/yum.repos.d/目录下去除原有的*.repo 文件,新建一个新的 Base.repo 文件,该文件的内容如下: (注意,文件中相应的 baseurl 需要确保路径正确,所以有必要检查实际的 ftp 镜像路劲是否存在) # 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 mirБайду номын сангаасorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # #
Centos 6 YUM源配置
Centos 6.2 YUM源配置CentOS自带的yum源中rpm包数量有限,很多时候找不到我们需的软件包,(例如:要安装网络连接查看软件iftop,默认设置下无法使用yum命令安装),下面教大家在CentOS 6.2中(以32位系统为例,64位系统安装方法一样),使用第三方yum源来安装更多软件包。
一、安装CentOS yum源优先级插件yum-prioritiesyum install yum-priorities #输入y安装二、设置CentOS默认yum源的优先级为最高cd /etc/yum.repos.d/ #进入yum源目录vi CentOS-Base.repo #在[base]、[updates]、[extras]组下面添加priority=1,在[centosplus]、[contrib]组下面添加priority=2################################################################ [base]name=CentOS-$releasever - Basemirrorlist=/?release=$releasever&arch=$basearch&repo=os#baseurl=/centos/$releasever/os/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6priority=1[updates]name=CentOS-$releasever - Updatesmirrorlist=/?release=$releasever&arch=$basearch&repo=updat es#baseurl=/centos/$releasever/updates/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6priority=1[extras]name=CentOS-$releasever - Extrasmirrorlist=/?release=$releasever&arch=$basearch&repo=extras#baseurl=/centos/$releasever/extras/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6priority=1[centosplus]name=CentOS-$releasever - Plusmirrorlist=/?release=$releasever&arch=$basearch&repo=cento splus#baseurl=/centos/$releasever/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6priority=2[contrib]name=CentOS-$releasever - Contribmirrorlist=/?release=$releasever&arch=$basearch&repo=contri b#baseurl=/centos/$releasever/contrib/$basearch/gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6priority=2###############################################################备注:priority的优先级为1到99,设置为1即优先级最高,1-10为系统保留,第三方yum 源的优先级从11-99三、安装epel yum源rpm -ivh /pub/epel/6/i386/epel-release-6-5.noarch.rpm rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6vi /etc/yum.repos.d/epel.repo #修改epel yum源优先级,priority=11############################################################### [epel]name=Extra Packages for Enterprise Linux 6 - $basearch#baseurl=/pub/epel/6/$basearchmirrorlist=https:///metalink?repo=epel-6&arch=$basearch failovermethod=priorityenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6priority=11#################################################################四、安装rpmforge yum源wget http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.r pmwget /rpm/packages/RPM-GPG-KEY.dag.txtrpm --import RPM-GPG-KEY.dag.txtrpm -ivh rpmforge-release-0.5.2-2.el6.rf.i686.rpmvi /etc/yum.repos.d/rpmforge.repo #修改rpmforge yum源优先级,priority=12################################################################# [rpmforge]name = RHEL $releasever - - dagbaseurl = http://apt.sw.be/redhat/el6/en/$basearch/rpmforgemirrorlist = http://apt.sw.be/redhat/el6/en/mirrors-rpmforge#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforgeenabled = 1protect = 0gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-daggpgcheck = 1priority=12#################################################################系统运维 温馨提醒:qihang01原创内容©版权所有,转载请注明出处及原文链接五、安装rpmfusion yum源rpm -ivh /free/el/updates/testing/6/i386/rpmfusion-free-release-6-0.1.noarch.rpmvi /etc/yum.repos.d/rpmfusion-free-updates-testing.repo #修改rpmfusion yum源优先级,priority=13################################################################# [rpmfusion-free-updates-testing]name=RPM Fusion for EL 6 - Free - Test Updates#baseurl=/free/el/updates/testing/6/$basearch/mirrorlist=/mirrorlist?repo=free-el-updates-testing-6&arch=$ba searchenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-el-6priority=13系统运维 温馨提醒:qihang01原创内容©版权所有,转载请注明出处及原文链接#################################################################六、安装atomic yum源wget /installers/atomic #下载sh ./atomic #安装vi /etc/yum.repos.d/atomic.repo #修改atomic yum源优先级,priority=14############################################################## [atomic]name = CentOS / Red Hat Enterprise Linux $releasever - mirrorlist = /mirrorlist/atomic/centos-6-$basearch#mirrorlist = /channels/atomic/centos/6/mirrors-atomic enabled = 1priority = 1protect = 0gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY.art.txtgpgcheck = 1priority=14##############################################################七、更新yum软件包yum check-update八、安装iftopyum install iftop至此,CentOS 第三方yum源配置完成,现在你可以用yum命令安装自己需要的软件了!比如yum install nginx、yum update php等安装或者升级软件包。
yum源配置及详解
yum源配置及详解红帽系列中,进⾏软件安装可以有三种⽅法,编译安装,rpm包安装,和yum源安装。
其中yum⽅法安装最简单,因为它可以⾃动解决软件包之间的依赖关系。
⼀、常⽤yum源yum源可以来源于多种⽂件服务器:http://https://ftp://file:// 本地⽂件yum源国内镜像站点:阿⾥源 https:///centos/7.3.1611/os/x86_64/清华⼤学https:///centos/7.3.1611/os/x86_64/⽹易源/centos/7.3.1611/os/x86_64/浙江⼤学/centos/7.3.1611/os/x86_64/注意:有repodata的⽬录的⼦⽬录为yum源的路径⼆、yum源配置yum的配置⽂件cachedir=/var/cache/yum/$basearch/$releasever #yum下载后的缓存⽬录keepcache=0 #是否缓存,0为不缓存,1为缓存debuglevel=2logfile=/var/log/yum.log #yum的安装⽇志exactarch=1obsoletes=1gpgcheck=1 #默认是否进⾏gpg校验,0为不校验,1校验plugins=1installonly_limit=5bugtracker_url=/set_project.php?project_id=23&ref=/bug_report_page.php?category=yumdistroverpkg=centos-release配置实战在yum配置⽂件中的最后⼀⾏,有以下说明,意思是:让你的repo放在/etc/yum.repo.d⽬录中,并且以.repo结尾# PUT YOUR REPOS HERE OR IN separate files named file.repo# in /etc/yum.repos.d1.先切换到yum源中的配置⽬录cd /etc/yum.conf.d/2.因为默认的yum源是CentOS-Base.repo,可以在此⽂件中修改,也可以将他修改后缀名,这⾥就修改后缀名吧mv /etc/yum.conf.d/CentOS-Base.repo /etc/yum.conf.d/CentOS-Base.repo.bak3.新建⼀个repo⽂件,命名为CentOS7.repo,如下配置:[CentOS7-base] #源名称,必填name=CentOS-$releasever-base #源描述,可以不填,但是会有提⽰baseurl=file:///misc/cd/ #本地的光盘⽂件,可以有多个地址。
Red Hat Enterprise 6.4配置CentOS 6.4软件源
Red Hat Enterprise 6.4配置CentOS 6.4软件源1.用su 命令切换到root2.删除rhel6.4自带的yum,命令如下:rpm -aq|grep yum|xargs rpm -e --nodeps3.下载CentOS 6.4的yum,命令如下:wget /centos/6.4/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpmwget /centos/6.4/os/x86_64/Packages/y um-3.2.29-40.el6.centos.noarch.rpmwget /centos/6.4/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm wget /centos/6.4/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm 4.安装yumrpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpmrpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpmrpm -ivhyum-3.2.29-40.el6.centos.noarch.rpmyum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm5.配置repo文件新建CentOS-Base.repo文件,内容为:[base]name=CentOS-6 - Baserepo=osbaseurl=/centos/6.4/os/$basearch/gpgcheck=1gpgkey=/centos/RPM-GPG-KEY-CentOS-6#released updates[update]name=CentOS-6 - Updatesbaseurl=/centos/6.4/updates/$basearch/gpgcheck=1gpgkey=/centos/RPM-GPG-KEY-CentOS-6#packages used/produced in the build but not released#[addons]#name=CentOS-6 - Addons#baseurl=/centos/6.4/addons/$basearch/#gpgcheck=1#gpgkey=/centos/RPM-GPG-KEY-CentOS-6#additional packages that may be useful[extras]name=CentOS-6 - Extrasbaseurl=/centos/6.4/extras/$basearch/gpgcheck=1gpgkey=/centos/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus]name=CentOS-6 - Plusbaseurl=/centos/6.4/centosplus/$basearch/gpgcheck=1enabled=1gpgkey=/centos/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib]name=CentOS-6 - Contribbaseurl=/centos/6.4/contrib/$basearch/gpgcheck=1enabled=0gpgkey=/centos/RPM-GPG-KEY-CentOS-6保存后将CentOS-Base.repo移到/etc/yum.repos.d/ 里面,命令如下:mv ./CentOS-Base.repo /etc/yum.repos.d/6.清除yum缓存clean yum all7.试试能不能用yum install gcc-c++-4.4.7-3.el6。
RedHat 5.3配置YUM 从centos5源与光盘源更新软件
YUM顾名思义,Yellow Dog Updater, Modified. Yum为基于RPM系统做了相同的工作。
它提供了一个简单的命令,可用于在首先安装和更新任何其他必要的软件包以满足所需的软件包依赖关系之后,自动化安装或更新一个软件包,类似Debian下apt-get的工具.YUM的特点:可以同时配置多个资源库(Repository)简洁的配置文件(/etc/yum.conf)自动解决增加或删除rpm包时遇到的倚赖性问题使用方便保持与RPM数据库的一致性RHEL AS5可以通过Yum升级系统的功能,但默认rhel-debuginfo.repo的设置是从RedHat 的Yum源来升级系统,如果您没有购买Redhat的服务,Redhat5后面版本升级是收费,需要key 才能升级,那么使用Yum是无法升级的。
幸运的是,由于centos是免费的企业版本,可以借用centos yum源更新RHEL AS5系统.配置YUM 从centos5源更新软件[root@clinet ~]# rpm --import/Linux/CentOS/RPM-GPG-KEY-CentOS-5安装那个的GPG,也可增加其他资源库,自己选择一个离自己地理位置近点[root@clinet ~]# rpm -qa gpg-pubkey*检查GPG Keygpg-pubkey-e8562897-459f07a4如果要删除Key,使用以下命令:[root@clinet ~]# rpm -e gpg-pubkey-e8562897-459f07a4[root@clinet ~]# vi /etc/yum.repos.d/rhel-debuginfo.repo[rhel-debuginfo]name=Red Hat Enterprise Linux $releasever - $basearch - Debugbaseurl=ftp:///pub/redhat/linux/enterprise/$releasever/en/os/$basear ch/Debuginfo/baseurl是你的YUM源地址enabled=0是否启用这个仓库,1为起用,0为禁用gpgcheck=1设置gpgcheck=1会让yum检查每个下载的RPM的GnuPG签名。
CentOS6.5下的yum本地源配置
CentOS自带强大的yum功能,默认为从网上自动下载rpm包,对于网速不太给力或者没有网络的情况下需要用的话就不是很方便,很多软件尤其是服务器上的软件我们么有必要追求最新,稳定性最重要,这里我们用CentOS光盘里的Packages作为yum源就是个不错的选择,它基本包含了所有你平常需要用到的软件,下面来介绍下CentOS光盘作为yum本地源的配置过程:1.建立本地源目录及挂载临时目录#mkdir /mnt/centosyum#mkdir /mnt/cdrom2.挂载CentOS光盘(我这里用的IOS镜像,有两块分别定为盘1,和盘2)插入盘1然后挂载盘1#mount /dev/cdrom /mnt/cdrom拷贝盘1内所有rpm包到本地源目录#cp /mnt/cdrom/* /mnt/centosyum同理挂载并将盘2内的rpm包拷贝到本地源目录3.进入/etc/yum.repos.d目录,可以看到四个文件分别为CentOS-Base.repo、CentOS-Media.repo 、CentOS-Vault.repo、CentOS-Vault.repo.repo,将其中三个改名或者移走留下CentOS-Media.repo#cd /etc/yum.repos.d#mv CentOS-Base.repo CentOS-Base.repo.bak#mv CentOS-Vault.repo CentOS-Vault.repo.bak#mv CentOS-Vault.repo CentOS-Vault.repo.bak#vi CentOS-Media.repo将以下内容[c6-media]name=CentOS-$releasever - Mediabaseurl=file:///media/CentOS/file:///media/cdrom/file:///media/cdrecorder/gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6修改为[c6-media]name=CentOS-$releasever - Mediabaseurl=file:///mnt/centosyum ##这里为本地源路径file:///media/cdrom/file:///media/cdrecorder/gpgcheck=1enabled=1 ##开启本地源gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6修改好保存并退出#yum clean 清除原来的缓存到此配置就完成!备注:如需要将yum源改为网络还原/etc/yum.repos.d目录下的四个文件即可!。
CentOS更换yum源的方法
CentOS更换yum源的⽅法
1. 原来的yum源做备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
2. 下载新的yum源
•我⽤的vagrant centos 6.5 的box,默认没有装wget命令,yum源⾥也没有wget包,下载下来替换
vim /etc/yum.repos.d/CentOS-Base.repo
tips : 具体的linux版本及系统版本请⾃⾏选择,当然,还有其他的源,选择你⾃⼰喜欢的就可以了。
下载下来复制⾥⾯的内容
进⼊ INSERT 模式:刚开始学linux,直接在command 模式下粘贴,总是错,新⼿注意下这个
或者wget直接下载
wget -O /etc/yum.repos.d/CentOS-Base.repo /repo/Centos-6.repo
3. 更新列表,安装软件
yum clean all
yum makecache
总结
以上所述是⼩编给⼤家介绍的CentOS更换yum源的⽅法,希望对⼤家有所帮助,如果⼤家有任何疑问欢迎给我留⾔,⼩编会及时回复⼤家的!。
yum源配置的三种方法
yum源配置的三种⽅法(⼀)yum源概述 yum需要⼀个yum库,也就是yum源。
默认情况下,CentOS就有⼀个yum源。
在/etc/yum.repos.d/⽬录下有⼀些默认的配置⽂件(可以将这些⽂件移到/opt下,或者直接在yum.repos.d/下重命名)。
⾸先要找⼀个yum库(源),然后确保本地有⼀个客户端(yum这个命令就是客户端),由yum程序去连接服务器。
连接的⽅式是由配置⽂件决定的。
通过编辑/etc/yum.repos.d/CentOS-Base.repo⽂件,可以修改设置。
name=Description#⼀个描述,随意。
baseurl=#设置资源库的地址,可以写阿⾥云也可以是⾃⼰的yumftp://http://file:///enabled={1|0}#enabled=1开启本地更新模式gpgcheck={1|0}# gpgcheck=1表⽰检查;可以不检查gpgcheck=0gpgkey=#检查的key;如果上⾯不检查这⼀⾏可以不写。
(⼆)yum源配置⽅法⼀(阿⾥云源)1) 安装wgetyum install -y wget2) 备份/etc/yum.repos.d/CentOS-Base.repo⽂件cd /etc/yum.repos.d/mv CentOS-Base.repo CentOS-Base.repo.back3) 下载阿⾥云的Centos-6.repo⽂件wget -O CentOS-Base.repo /repo/Centos-6.repo4) 重新加载yumyum clean allyum makecache(三)yum源配置⽅法⼆(本地挂载⽬录)1) 下载iso⽂件 从CentOS的下载CentOS的完整版iso⽂件,并上传到Linux⽂件系统中,例如/opt/tools/。
2) 创建挂载⽬录 为iso⽂件的挂载创建⽬录。
mkdir /mnt/vcdrom3) 挂载 将iso⽂件挂载到挂载⽬录。
如何更换CentOS6的yum源
将yum源设置为国内yum源可以提升软件包安装和更新的速度同时避免一些常见软件版本无yum源,可以提升软件包安装和更新的速度,同时避免一些常见软件版本无法找到。 国内免费提供yum源的网站有很多,如果,阿里、网易、清华、中科大等。 这 里 以 阿 里 yum源 为 例
RedHat使用CentOS YUM源更新软件包的配置方法
RedHat 6 使用 CentOS YUM 源更新的方法由于 Redhat 的 yum 在线更新是收费的,如果没有注册账号则不能使用, 即不能在线安装软件。
所以,无注册号的 Redhat 系统,想用 yum 源来在线安 装软件,就必须重新安装 centos 的 yum 包,并配置 yum 镜像源。
具体步骤如下:1、删除 redhat 原有的 yum 源# rpm -aq | grep yum|xargs rpm -e --nodeps2、下载新的 yum 安装包下载 CentOS 的 yum 安装包,可从官方网站查找下载 (/centos/6/os/x86_64/Packages/),找到相关包 名即可,后面的版本号有可能不同。
注:域名如果不能访问,添加 DNS 服务器:vi /etc/resolv.conf nameserver 221.131.143.69python-iniparse-0.3.1-2.1.el6.noarch.rpm yum-metadata-parser-1.1.2-14.1.el6.i686.rpm yum-3.2.27-14.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.26-1.el6.noarch.rpm3、安装 yum 软件包# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm# rpm -ivhyum-metadata-parser-1.1.2-14.1.el6.i686.rpm# rpm -ivh yum-3.2.27-14.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm注意:最后两个安装包要放在一起同时安装,否则会提示相互依 赖,安装失败。
4、更改 yum 源 (示例使用网易的 CentOS 镜像源)# cd /etc/yum.repos.d/ # wget /.help/CentOS6-Base-163.repo# vi CentOS6-Base-163.repo 编辑文件,把文件里面的$releasever 全部替换为版本号,即 6 最后保存! 或者直接把下面的内存拷贝到 CentOS6-Base-163.repo 文件中即可 (已经修改 好)[base] name=CentOS-6 - Base - baseurl=/centos/6/os/$basearch/ #mirrorlist=/?release=6&arch=$basearch&re po=os gpgcheck=1 gpgkey=/centos/RPM-GPG-KEY-CentOS-6#released updates [updates] name=CentOS-6 - Updates - baseurl=/centos/6/updates/$basearch/ #mirrorlist=/?release=6&arch=$basearch&re po=updates gpgcheck=1 gpgkey=/centos/RPM-GPG-KEY-CentOS-6#additional packages that may be useful [extras] name=CentOS-6 - Extras - baseurl=/centos/6/extras/$basearch/ #mirrorlist=/?release=6&arch=$basearch&re po=extras gpgcheck=1 gpgkey=/centos/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages [centosplus] name=CentOS-6 - Plus - baseurl=/centos/6/centosplus/$basearch/ #mirrorlist=/?release=6&arch=$basearch&re po=centosplus gpgcheck=1 enabled=0 gpgkey=/centos/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users [contrib] name=CentOS-6 - Contrib - baseurl=/centos/6/contrib/$basearch/ #mirrorlist=/?release=6&arch=$basearch&re po=contrib gpgcheck=1 enabled=0 gpgkey=/centos/RPM-GPG-KEY-CentOS-65、清理 yum 缓存# yum clean all # yum makecache 装软件的速度 # yum install vim* #测试域名是否可用 #将服务器上的软件包信息缓存到本地,以提高搜索安现在,Redhat6 系统可以使用 CentOS 的 yum 源在线安装软件了!附件说明: 1、yumrpm.tgz ---centos yum 安装包 ---yum 配置文件2、CentOS6-Base-163.repo。
[Linux-CentOS7]yum清华源CentOS7
[Linux-CentOS7]yum清华源CentOS7 shell直接运⾏cat > 01.yumrepo.sh << 'EOF'# 创建备份路径mkdir -p /etc/yum.repos.d/repo.bak/# 备份源mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/repo.bak/# 导⼊镜像内容到yum⽂件中cat > /etc/yum.repos.d/centos-tuna.repo << 'EOO'#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 - Basebaseurl=https:///centos/\$releasever/os/\$basearch/enabled=1gpgcheck=0#released updates[updates]name=CentOS-\$releasever - Updatesbaseurl=https:///centos/\$releasever/updates/\$basearch/#baseurl=https:///centos/\$releasever/updates/\$basearch/#mirrorlist=/?release=\$releasever&arch=\$basearch&repo=updatesenabled=1gpgcheck=0#additional packages that may be useful[centosplus]name=CentOS-\$releasever - Plusbaseurl=https:///centos/\$releasever/centosplus/\$basearch/#baseurl=https:///centos/\$releasever/centosplus/\$basearch/#mirrorlist=/?release=\$releasever&arch=\$basearch&repo=centosplusenabled=1gpgcheck=0[cloud]name=CentOS-\$releasever - Cloudbaseurl=https:///centos/\$releasever/cloud/\$basearch/openstack-train/#baseurl=https:///centos/\$releasever/cloud/\$basearch/openstack-train/enabled=1gpgcheck=0[paas]name=CentOS-\$releasever - paasbaseurl=https:///centos/\$releasever/paas/\$basearch/openshift-origin13/#baseurl=https:///centos/\$releasever/paas/\$basearch/openshift-origin13/enabled=1gpgcheck=0[kvm]name=CentOS-\$releasever - kvmbaseurl=https:///centos/\$releasever/virt/\$basearch/kvm-common/#baseurl=https:///centos/\$releasever/virt/\$basearch/kvm-common/enabled=1gpgcheck=0[extras]name=CentOS-\$releasever - extrasbaseurl=https:///centos/\$releasever/extras/\$basearch/#baseurl=https:///centos/\$releasever/extras/\$basearch/enabled=1gpgcheck=0[epel]name=Extra Packages for Enterprise Linux 7 - $basearchbaseurl=https:///epel/7/$basearch#mirrorlist=https:///metalink?repo=epel-7&arch=$basearchfailovermethod=priorityenabled=1gpgcheck=0[epel-debuginfo]name=Extra Packages for Enterprise Linux 7 - $basearch - Debugbaseurl=https:///epel/7/$basearch/debug#mirrorlist=https:///metalink?repo=epel-debug-7&arch=$basearch failovermethod=priorityenabled=1gpgcheck=0[epel-source]name=Extra Packages for Enterprise Linux 7 - $basearch - Sourcebaseurl=https:///epel/7/SRPMS#mirrorlist=https:///metalink?repo=epel-source-7&arch=$basearch failovermethod=priorityenabled=1gpgcheck=0EOO#清除yum缓存yum clean all#重新做yum 缓存yum makecacheEOF# 执⾏该脚本bash 01.yumrepo.sh。
CentOS中yum源的配置与使用详解
CentOS中yum源的配置与使⽤详解⼀、yum 简介yum,是Yellow dog Updater, Modified 的简称,是杜克⼤学为了提⾼RPM 软件包安装性⽽开发的⼀种软件包管理器。
起初是由yellow dog 这⼀发⾏版的开发者Terra Soft 研发,⽤python 写成,那时还叫做yup(yellow dog updater),后经杜克⼤学的Linux@Duke开发团队进⾏改进,遂有此名。
yum 的宗旨是⾃动化地升级,安装/移除rpm 包,收集rpm 包的相关信息,检查依赖性并⾃动提⽰⽤户解决。
yum 的关键之处是要有可靠的repository,顾名思义,这是软件的仓库,它可以是http 或ftp 站点,也可以是本地软件池,但必须包含rpm 的header,header 包括了rpm 包的各种信息,包括描述,功能,提供的⽂件,依赖性等。
正是收集了这些header 并加以分析,才能⾃动化地完成余下的任务。
yum 的理念是使⽤⼀个中⼼仓库(repository)管理⼀部分甚⾄⼀个distribution 的应⽤程序相互关系,根据计算出来的软件依赖关系进⾏相关的升级、安装、删除等等操作,减少了Linux ⽤户⼀直头痛的dependencies 的问题。
这⼀点上,yum 和apt 相同。
apt 原为debian 的deb 类型软件管理所使⽤,但是现在也能⽤到RedHat 门下的rpm 了。
yum 主要功能是更⽅便的添加/删除/更新RPM 包,⾃动解决包的倚赖性问题,便于管理⼤量系统的更新问题。
yum 可以同时配置多个资源库(Repository),简洁的配置⽂件(/etc/yum.conf),⾃动解决增加或删除rpm 包时遇到的依赖性问题,保持与RPM 数据库的⼀致性。
⼆、yum 安装CentOS 默认已经安装了yum,不需要另外安装,这⾥为了实验⽬的,先将yum 卸载再重新安装。
1、查看系统默认安装的yum# rpm -qa|grep yum2、卸载yum# rpm -e yum-fastestmirror-1.1.16-14.el5.centos.1 yum-metadata-parser-1.1.2-3.el5.centos yum-3.2.22-33.el5.centos3、重新安装yum这⾥可以通过wget 从⽹上下载相关包安装,也可以挂载系统安装光盘进⾏安装,这⾥选择挂载系统安装光盘进⾏安装。
centos5.8 换yum源
centos 5.8 64位换yum源换源(就是把baseurl前面的#去掉和把后面的网址改成对应系统的)1.vi/etc/yum.repos.d/CentOS-Base.repo 进入配置文件2.把里面的数据全部DD掉3.按i进入编辑模式(一定要注意)4.直接把下面的数据复制进去后保存退出# 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 - Basemirrorlist=/?release=$releasever&arch=$basearch&repo=os baseurl=/5.8/os/x86_64/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5#released updates[updates]name=CentOS-$releasever - Updatesmirrorlist=/?release=$releasever&arch=$basearch&repo=updates baseurl=/5.8/updates/x86_64/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5#additional packages that may be useful[extras]name=CentOS-$releasever - Extrasmirrorlist=/?release=$releasever&arch=$basearch&repo=extras baseurl=/5.8/extras/x86_64/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plusmirrorlist=/?release=$releasever&arch=$basearch&repo=centosplus baseurl=/5.8/centosplus/x86_64/gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5#contrib - packages by Centos Users[contrib]name=CentOS-$releasever - Contribmirrorlist=/?release=$releasever&arch=$basearch&repo=contrib baseurl=/5.8/contrib/x86_64/gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-55.运行yum clean all若yum报错:Error: Cannot find a valid baseurl for repo: base,则进入/etc/yum.repos.d/,输入命令:mv/etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.bak6.执行yum check-update,没报错,跑进度的话就是成功了,也可以试下yum下载测试其他系统的可以在这里找源:/安装mysql 5.11.yum -y remove mysql2.yum -y update3.wget https:///archives/mysql-5.1/MySQL-server-5.1.72-1.glibc23.x86_64.rpm4.wget https:///archives/mysql-5.1/MySQL-client-5.1.72-1.glibc23.x86_64.rpm5.yum -y install*.rpm --nogpgcheck(这个是一键安装已有的rpm包,要先确认系统只有上面下载的两个rpm包时才可以用这条命令,有其他的话,就要用rpm -ivh 包名这条命令单独安装,ll可以查看系统下载了那些rpm的包和名字)6.service mysql restart7./usr/bin/mysqladmin -u root password'xxxxx'。
CentOS配置本地yum源(使用镜像iso文件)
CentOS配置本地yum源(使用镜像iso文件)本人在使用yum安装软件的时候,感觉最不爽的是网络不佳时,安装的速度特别慢。
所以,个人就上网search了一下如何使用Linux的安装文件作为其yum源。
经过几次尝试,已经可以成功的配置了。
下面是详细的介绍:(1)个人的使用环境本人的CentOS是安装在vmware上的:VMware workstation 7.1.1 + CentOS 5.5(2)yum使用的相关文件介绍CentOS使用的yum源是在/etc/yum.repos.d/目录下的两个文件中进行配置的CentOS-Base.repo和CentOS-Media.repo,其中,CentOS-Base.repo是配置网络yum源,CentOS-Media.repo是配置本地yum源。
[root@localhost ~]# cd /etc/yum.repos.d/[root@localhost yum.repos.d]# lltotal 16-rw-r--r-- 1 root root 2245 Apr 26 2010 CentOS-Base.repo-rw-r--r-- 1 root root 626 Apr 26 2010 CentOS-Media.repo我们可以看看CentOS-Media.repo中的内容:[root@localhost yum.repos.d]# more CentOS-Media.repo# CentOS-Media.repo## This repo is used to mount the default locations for a CDROM / DVD on# CentOS-5. Y ou can use this repo and yum to install items directly off the# DVD ISO that we release.## To use this repo, put in your DVD and use it with the other repos too:# yum --enablerepo=c5-media [command]## or for ONLY the media repo, do this:## yum --disablerepo=\* --enablerepo=c5-media [command][c5-media]name=CentOS-$releasever - Mediabaseurl=file:///media/CentOS/ #把media改写为光盘挂载的目录file:///media/cdrom/ #把后面的/cdrom删除就可以了file:///media/cdrecorder/gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5其中,baseurl是本地yum源的位置,当然,根据我们iso的配置位置,这里是可以进行修改的。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
/dev/mapper/vg_test-lv_swap swap swap defaults 0 0
rhel-source/primary_db | 3.1 MB 00:00 ...
rhel-source/other_db | 1.6 MB 00:00 ...
[root@test /]# mount /dev/sr0 /mnt -t iso9660
mount: block device /dev/sr0 is write-protected, mounting read-only
(3)继续使用mount命令,查看是否挂载成功
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
rhel-source/group_gz | 204 kB 00:00 ...
rhel-source/filelists_db | 3.8 MB 00:00 ...
Cleaning up Everything
(8)创建yum缓存
命令:yum makecache
[root@test yum.repos.d]# yum makecache
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
rhel-source | 3.9 kB 00:00 ...
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: InstallMedia rhel-source
1.用yum源安装rpm安装包命令:
yum install xxx.rpm
2.配置本地yum源
(1)列出Linux系统里的所有挂载点 mount
[root@test /]# mount
/dev/mapper/vg_test-lv_root on / type ext4 (rw)
sysfs /sys sysfs defaults 0 0
roc /proc proc defaults 0 0
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
packagekit-media.repo rhel-source.repo
[root@test yum.repos.d]# vim rhel-source.repo
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
[root@test /]# mount
/dev/mapper/vg_test-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
/dev/sr0 on /mnt type iso9660 (ro) --挂载成功--
(4)配置启动自动挂载光盘镜像 vim /etc/fstab 插入一下内容,保存退出,重启生效
/dev/sr0 /mnt iso9660 defaults,ro 0 0
/dev/sr0 /mnt iso9660 defaults,ro 0 0
(5)配置yum源文件
[root@test /]# cd /etc/yum.repos.d/
[root@test yum.repos.d]# ls
gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)
/dev/sr0 on /media/RHEL_6.5 x86_64 Disc 1 type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=0,gid=0,iocharset=utf8,mode=0400,dmode=0500)
/dev/sr0 on /media/RHEL_6.5 x86_64 Disc 1 type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=0,gid=0,iocharset=utf8,mode=0400,dmode=0500)
(2)将光盘镜像挂载到/mnt下 mount /dev/sr0 /mnt -t iso9660
[root@test /]# vim /etc/fstab
# /etc/fstab
# Created by anaconda on Tue Jun 5 18:40:48 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)
(7)清楚yum源缓存
命令:yum clean all
[root@test yum.repos.d]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_test-lv_root / ext4 defaults 1 1
baseurl=file:///mnt
enabled=1
gpgcheck=1
(6)导入yum源的key
命令格式:rpm --import /mnt/RPM-GPG-KEY*
[root@test yum.repos.d]# rpm --import /mnt/RPM-GPG-KEY-redhat-*
Metadata Cache Created
[root@test yum.repos.d]#
(9)列出所有缓存生成的rpm包
命令:yum list
[root@test yum.repos.d]# yum list
... --内容这里省略--