yum、rpm

yum

本地yum源配置

1.保证光盘链接
yum、rpm_第1张图片
2.挂载

[root@localhost test]# mount /dev/sr0 /media
mount: /dev/sr0 is write-protected, mounting read-only
mount: /dev/sr0 is already mounted or /media busy
/dev/sr0 is already mounted on /media

3 备份Cen*

[root@localhost yum.repos.d]# mv Cen* bak
[root@localhost yum.repos.d]# ls
bak

4 创建后缀以.repo结尾的文件,并编辑

[root@localhost yum.repos.d]# vi yum.repo
在这里插入图片描述

5 yum clean all

6 yum makecache

网络yum源配置

1 将本地yum源关闭或移入bak中,将CentOS-Base.repo移至yum.repos.d目录下

2.挂载

[root@localhost test]# mount /dev/sr0 /media
mount: /dev/sr0 is write-protected, mounting read-only
mount: /dev/sr0 is already mounted or /media busy
/dev/sr0 is already mounted on /media

3.进入vi /etc/resolv.conf 配置DNS:nameserver=114.114.114.114(域名解析)

4.route -n查看默认路由,若没有默认路由,route add default gw 网关(若没有route,下载 yum install net-tools -y)

5 ping,看网络是否连通

6 yum list:列出yum源里面的所有包,@标识的是已经安装的,没有@的表示没有安装。

[root@localhost yum.repos.d]# yum list |grep vim

7 yum clean all

8 yum makecache

rpm

-i:安装

-e:卸载

–nodeps:不检查依赖

[root@localhost Packages]# rpm -ivh zip-3.0-11.el7.x86_64.rpm
[root@localhost Packages]# rpm -e libestr --nodeps(文件名)

-U:升级||安装

-F:升级

[root@localhost Packages]# rpm -U libestr-0.1.9-2.el7.x86_64.rpm

-qa:查询所有已经安装的包

-qf:查询当前文件属于哪个包

-qi:查看详细描述

-ql:软件安装的详细信息

-qR:查看依赖

[root@localhost Packages]# rpm -qa
[root@localhost bin]# rpm -qf perl
perl-5.16.3-293.el7.x86_64
[root@localhost Packages]# rpm -qi zip
[root@localhost Packages]# rpm -ql zip
[root@localhost Packages]# rpm -qR zip

你可能感兴趣的:(yum、rpm)