redhut 7.5 修改yum源

yum仓库主要用于解决软件包依赖关系

yum仓库配置文件的语法及参数如下。

1、yum 配置文件语法

yum配置文件语法如下。

#cat/etc/yum.repos.d/define.repo
[repo_name]
name=
baseurl=
enabled=
gpgcheck=
gpgkey=

2、yum 配置文件语法解

[repo name ]
含义:[ ]内是yum 仓库的名称,用于区别不同 yum 仓库及功能
name=yum server
含义:name=后面跟的是仓库描述的信息
baseurl-path
含义:baseurl=后面跟仓库的路径
enabled-[0|1]
含义:enabled=后面跟的数字表示是否启用该仓库,[1]表示启用,[0]表示禁用
gpgcheck=[O|1]
含义:gpgcheck=后面跟数字表示是否检查软件包的md5sum,用于验证软件包的安全性,[1]表示检查,[0]表示不检查。
gpgkey-path
含义:gpgkey=后面跟软件包所使用的签名,一般启用gpgcheck时才配置。例如:
gpgkey=/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

3、yum基本命令参数介绍

可以通过man yum来详细了解每个参数的具体说明。

*install packagel [package2] [...]
软件包的安装
*update[package1] [package2] [...]
软件包的更新
check-update
检测最新的软件包
*remove | erase packagel [package2] [..]
卸载安装的软件包
* list [...]
查看安装的软件包列表
*info [...]
查看软件包的相关信息
* provides | whatprovides featurel [feature2] [...]
查看文件由哪个软件包提供
* clean [ packages| metadata| expire-cache | rpmdb| plugins | all ]
清除缓存信息
*makecache
重建缓存文件,一般新建yum 仓库时以及使用clean参数时,使用makecache 重建缓存
* groupinstall group1 [group2] [...]
以组的形式安装软件包组件
*groupupdate group1 [group2] [...]
更新组相关软件包
* grouplist [hidden][groupwildcard] [...]

获取已安装和没安装的软件包组件
*grOupremove groupl [group2] [...]
移除软件包组件
groupinfo groupl [...]
查看软件包组件相关信息
search stringl [string2] [...]
以软件包名称在仓库中进行搜索
*localinstall rpmfile1 [rpmfile2] [...]
(maintained for legacy reasons only - use install)
本地安装软件包
*localupdate rpmfilel [rpmfile2] [...]
本地更新软件包

RedHut yum repo 文件

vi /etc/yum.repos.d/CentOS7-Base-163.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-7 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os
baseurl=http://mirrors.163.com/centos/7/os/x86_64/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-7 - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates
baseurl=http://mirrors.163.com/centos/7/updates/x86_64/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-7 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras
baseurl=http://mirrors.163.com/centos/7/extras/x86_64/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

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

yum clean all && yum makecache
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值