Linux yum源详解
Posted ftl1012
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux yum源详解相关的知识,希望对你有一定的参考价值。
软件包安装方式
0.默认从官网下载包(国内,雅虎,网易,阿里云)
cat /etc/yum.repos.d/rhel-source.repo 【yum文件目录--redhat6版】
【搜狐】http://mirrors.sohu.com/help/CentOS-Base-sohu.repo 【网易】http://mirrors.163.com/.help/CentOS6-Base-163.repo 【阿里】https://mirrors.aliyun.com/help/centos
1.yum : Linux包管理器 ,解决依赖问题,方便快捷
yum install XXX -y yum groupinstall XXX 包组的列表 -y yum grouplist 里面选择包组,然后yum groupinstall "包组" -y yum search 包名 yum search all 查询所有 yum remove tree -y 删除命令(不建议用,因为yum可以解决依赖问题,删除会删除所有包的依赖) yum update; 安装所有软件到最新版本
2. rpm安装:
rpm -ivh 包名 i==install h==human 人可读 rpm -ivh 包名 安装软件 rpm -qa 包名 查询包名 最大的问题:就是安装包的依赖问题(a->b->c->d)
3.源码安装:
/configure; make; make install 源代码安装方式
在线安装配置yum源
# 查看操作系统版本 cat /etc/redhat-release # 查看操作系统32/64位 uname -m # 进入yum文件目录 cd /etc/yum.repos.d # 备份源文件 cp CentOS-Base.repo CentOS-Base.repo.bak # 下载网易yum源
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo 【网易】 #【可选】下载阿里yum源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo 【阿里】
# 更改权限和属组 chmod 644 CentOS6-Base-163.repo chown root.root CentOS6-Base-163.repo 附[可选]:如果还是用不了yum,可以替换文件内的版本信息为你当前操作系统的版本,一般没问题的 # 替换文件的版本信息 sed -i ‘s/$releasever/6/g‘ CentOS6-Base-163.repo
配置yum安装保存安装包
# 更改配置文件 sed -i ‘s#keepcache=0#keepcache=1#g‘ /etc/yum.conf # 进入路径下查看安装包 cd /var/cache/yum/*/6/base/packages/ # 查看更改后的文件信息
grep ‘keep‘ /etc/yum.conf
附网易yum源:
# 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 - 163.com baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-$releasever - Updates - 163.com baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras - 163.com baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus - 163.com baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib - 163.com baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
以上是关于Linux yum源详解的主要内容,如果未能解决你的问题,请参考以下文章