[root@localhost mnt]# vi aa.repo
[root@localhost mnt]# cat aa.repo
cat: aa.repo: 没有那个文件或目录
[root@localhost mnt]# cd /etc/yum
yum/ yum.conf yum.repos.d/
[root@localhost mnt]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# vi aa.repo
[root@localhost yum.repos.d]# cat aa.repo
name=aa
baseurl=file:///mnt
gpgcheck=0
enable=1
3. curl:下载yum仓库
[root@localhost ~]# curl -o /etc/yum.repos.d/Cent0S-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2523 100 2523 0 0 15596 0 --:--:-- --:--:-- --:--:-- 15670
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
aa.repo Cent0S-Base.repo
[root@localhost ~]# yum repolist disabled
已加载插件:fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
源标识 源名称
centosplus/x86_64 CentOS-7 - Plus - mirrors.aliyun.com
contrib/x86_64 CentOS-7 - Contrib - mirrors.aliyun.com
epel-debuginfo/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 - Debug
epel-source Extra Packages for Enterprise Linux 7 - x86_64 - Source
repolist: 0
[root@localhost ~]# grep 'enabled' /etc/yum.repos.d/epel-testing.repo
grep: /etc/yum.repos.d/epel-testing.repo: 没有那个文件或目录
[root@localhost ~]# grep 'enabled' /etc/yum.repos.d/epel.repo
enabled=1
enabled=0
enabled=0
7. yum install: 安装软件,安装过程中分析依赖关系后, 直接安装, 无需交互
[root@localhost ~]# yum -y install vim wget gcc gcc-c++ vsftpd
已加载插件:fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 gcc.x86_64.0.4.8.5-39.el7 将被 安装
--> 正在处理依赖关系 libgomp = 4.8.5-39.el7,它被软件包 gcc-4.8.5-39.el7.x86_64 需要
--> 正在处理依赖关系 cpp = 4.8.5-39.el7,它被软件包 gcc-4.8.5-39.el7.x86_64 需要
--> 正在处理依赖关系 libgcc >= 4.8.5-39.el7,它被软件包 gcc-4.8.5-39.el7.x86_64 需要
--> 正在处理依赖关系 glibc-devel >= 2.2.90-12,它被软件包 gcc-4.8.5-39.el7.x86_64 需要
......
8. yum update: 更新软件
[root@localhost ~]# rpm -qa|grep sudo
sudo-1.8.19p2-10.el7.x86_64
[root@localhost ~]# yum update sudo
已加载插件:fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
......
9. yum info: 显示rpm -qi package的结果
[root@localhost ~]# yum info vsftpd
已加载插件:fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
已安装的软件包
名称 :vsftpd
架构 :x86_64
版本 :3.0.2
发布 :25.el7
大小 :353 k
源 :installed
来自源:base
简介 : Very Secure Ftp Daemon
网址 :https://security.appspot.com/vsftpd.html
协议 : GPLv2 with exceptions
描述 : vsftpd is a Very Secure FTP daemon. It was written completely from
: scratch.
10. yum provides: 查看指定的文件或特性是由哪个包安装生成的
[root@localhost ~]# yum provides *bin/ls
已加载插件:fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
coreutils-8.22-24.el7.x86_64 : A set of basic GNU tools commonly used in shell scripts
源 :base
匹配来源:
文件名 :/bin/ls
文件名 :/usr/bin/ls
coreutils-8.22-18.el7.x86_64 : A set of basic GNU tools commonly used in shell scripts
11. yum search: 以指定的关键字搜索程序包名及summary信息
[root@localhost ~]# yum search httpd
已加载插件:fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
============================================== N/S matched: httpd ===============================================
dmlite-apache-httpd.x86_64 : Apache HTTPD frontend for dmlite
iipsrv-httpd-fcgi.noarch : Apache HTTPD files for iipsrv
......
12. yum group: 安装整个组的软件
[root@localhost ~]# yum groups mark install "带 GUI 的服务器"
已加载插件:fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
没有安装组信息文件
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Marked install: 带 GUI 的服务器
[root@localhost ~]# yum grouplist
已加载插件:fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
已安装环境分组:
带 GUI 的服务器
可用的环境分组:
最小安装
基础设施服务器
计算节点
文件及打印服务器