1.挂载光盘
- 命令名称:mount /dev/cdrom /mnt/
作用:挂载光盘,将光盘挂载到mnt下面
实例:
[root@localhost ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]# ls /mnt
addons GPL media.repo RPM-GPG-KEY-redhat-release
EFI images Packages TRANS.TBL
EULA isolinux repodata
extra_files.json LiveOS RPM-GPG-KEY-redhat-beta
- 命令名称: umount /mnt
作用:取消挂载
实例:
[root@localhost ~]# umount /mnt
- 命令名称:ls /etc/yum.repos.d
作用:查看yum源库
实例:
···
[root@localhost ~]# ls /etc/yum.repos.d
CentOS-Base.repo epel.repo
···
- 命令名称:vi /etc/yum.conf
作用:为所有仓库提供公共配置
实例:
[root@localhost ~]# vi /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release
# This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
# It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
"/etc/yum.conf" 26L, 970C
2.yum本地仓库
- 命令名称: cp -r /mnt/* /opt/myrepo/
作用:将/mnt挂载的目录复制到/opt/myrepo下面
实例:
[root@localhost ~]# mkdir /opt/myrepo
[root@localhost ~]# cp -r /mnt/* /opt/myrepo/
[root@localhost ~]# ls /opt/myrepo/
addons GPL media.repo RPM-GPG-KEY-redhat-release
EFI images Packages TRANS.TBL
EULA isolinux repodata
extra_files.json LiveOS RPM-GPG-KEY-redhat-beta
- 命令名称:vi /etc/yum.repos.d/myrepo.repo
作用:配置repo文件
实例:
[root@localhost ~]# ls /etc/yum.repos.d/
CentOS-Base.repo epel.repo redhat.repo
[root@localhost ~]# vi /etc/yum.repos.d/myrepo.repo
[root@localhost ~]# cat /etc/yum.repos.d/myrepo.repo
[myrepo]
name=myrepo
baseurl=file:///opt/myrepo
gpgcheck=0
enabled=1
- 命令名称:yum clean all
作用:清理缓存
实例:
[root@localhost ~]# yum clean all
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
正在清理软件源: base epel extras myrepo updates
Cleaning up list of fastest mirrors
- 命令名称: ls /var/cache/yum/
作用:查看缓存目录
实例:
[root@localhost ~]# ls /var/cache/yum/
x86_64
[root@localhost ~]# ls /var/cache/yum/x86_64/
$releasever
[root@localhost ~]# ls /var/cache/yum/x86_64/\$releasever/
base epel extras myrepo timedhosts updates
3.redhat7使用centos7的yum源步骤
1.卸载红帽yum源
[root@localhost ~]# rpm -e $(rpm -qa|grep yum) --nodeps
2.删除所有repo相关文件
[root@localhost ~]# rm -f /etc/yum.conf
[root@localhost ~]# rm -rf /etc/yum.repos.d/
[root@localhost ~]# rm -rf /var/cache/yum
3.下载centos相关yum组件
[root@localhost ~]# wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-cron-3.4.3-163.el7.centos.noarch.rpm
[root@localhost ~]# wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
[root@localhost ~]# wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
[root@localhost ~]# wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-52.el7.noarch.rpm
[root@localhost ~]# wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-52.el7.noarch.rpm
//如果没有wget命令则使用curl命令
[root@localhost ~]# curl -o yum-utils-1.1.31-50.el7.noarch.rpm https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-cron-3.4.3-163.el7.centos.noarch.rpm
[root@localhost ~]# curl -o yum-3.4.3-161.el7.centos.noarch.rpm https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
[root@localhost ~]# curl -o yum-metadata-parser-1.1.4-10.el7.x86_64.rpm https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
[root@localhost ~]# curl -o yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-52.el7.noarch.rpm
[root@localhost ~]# curl -o yum-updateonboot-1.1.31-50.el7.noarch.rpm https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-52.el7.noarch.rpm
3.安装所有相关组件
[root@localhost ~]# rpm -ivh yum-* --nodeps
4.下载base和epel仓库
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost ~]# sed -i 's#\$releasever#7#g' /etc/yum.repos.d/CentOS-Base.repo
[root@localhost ~]# wget -O /etc/yum.repos.d/epel.repo
4.安装软件包
命令名称: yum -y install vsftpd
作用:安装是自动回答yes
实例:
[root@localhost ~]# yum -y install vsftpd
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
epel | 5.4 kB 00:00:00
extras | 2.9 kB 00:00:00
myrepo | 4.1 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/9): epel/x86_64/group_gz | 88 kB 00:00:00
(2/9): base/x86_64/group_gz | 165 kB 00:00:00
(3/9): myrepo/group_gz | 137 kB 00:00:00
(4/9): myrepo/primary_db | 4.0 MB 00:00:00
(5/9): extras/x86_64/primary_db | 152 kB 00:00:00
(6/9): epel/x86_64/updateinfo | 1.0 MB 00:00:01
(7/9): updates/x86_64/primary_db | 1.1 MB 00:00:01
(8/9): base/x86_64/primary_db | 6.0 MB 00:00:02
(9/9): epel/x86_64/primary_db | 6.8 MB 00:00:04
正在解决依赖关系
--> 正在检查事务
---> 软件包 vsftpd.x86_64.0.3.0.2-25.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=================================================================================
Package 架构 版本 源 大小
=================================================================================
正在安装:
vsftpd x86_64 3.0.2-25.el7 base 171 k
事务概要
=================================================================================
安装 1 软件包
总下载量:171 k
安装大小:353 k
Downloading packages:
警告:/var/cache/yum/x86_64/$releasever/base/packages/vsftpd-3.0.2-25.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
vsftpd-3.0.2-25.el7.x86_64.rpm 的公钥尚未安装
vsftpd-3.0.2-25.el7.x86_64.rpm | 171 kB 00:00:00
从 http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:
用户ID : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
指纹 : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
来自 : http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
** 发现 2 个已存在的 RPM 数据库问题, 'yum check' 输出如下:
rhn-check-2.0.2-17.el7.noarch 有缺少的需求 yum-rhn-plugin >= ('0', '1.6.4', '1')
yum-utils-1.1.31-52.el7.noarch 有缺少的需求 python-kitchen
正在安装 : vsftpd-3.0.2-25.el7.x86_64 1/1
myrepo/productid | 1.6 kB 00:00:00
验证中 : vsftpd-3.0.2-25.el7.x86_64 1/1
已安装:
vsftpd.x86_64 0:3.0.2-25.el7
- 命令名称:yum list all
作用:列出仓库所有列表
实例:
root@localhost ~]# yum list all
valadoc-devel.x86_64 0.40.8-1.el7 base
valgrind.i686 1:3.14.0-16.el7 base
valgrind.x86_64 1:3.14.0-16.el7 base
valgrind-devel.i686 1:3.14.0-16.el7 base
valgrind-devel.x86_64 1:3.14.0-16.el7 base
valgrind-openmpi.x86_64 1:3.14.0-16.el7 base
vamp-plugin-sdk.x86_64 2.5-4.el7 epel
vamp-plugin-sdk-devel.x86_64 2.5-4.el7 epel
vamp-plugin-sdk-static.x86_64 2.5-4.el7 epel
vanessa_adt.x86_64 0.0.9-1.el7 epel
vanessa_adt-devel.x86_64 0.0.9-1.el7 epel
vanessa_logger.x86_64 0.0.10-2.el7 epel
vanessa_logger-devel.x86_64 0.0.10-2.el7 epel
vanessa_logger-sample.x86_64 0.0.10-2.el7 epel
vanessa_socket.x86_64 0.0.12-3.el7 epel
vanessa_socket-devel.x86_64 0.0.12-3.el7 epel
vanessa_socket-pipe.x86_64 0.0.12-3.el7 epel
varnish.x86_64 4.0.5-1.el7 epel
varnish-docs.x86_64 4.0.5-1.el7 epel
varnish-libs.x86_64 4.0.5-1.el7 epel
varnish-libs-devel.x86_64 4.0.5-1.el7 epel
vcftools.x86_64 0.1.16-1.el7 epel
vconfig.x86_64 1.9-16.el7 epel
vdo.x86_64 6.1.2.41-4.el7 base
vdpauinfo.x86_64 0.9-0.1.el7 epel
velocity.noarch 1.7-10.el7 base
velocity-demo.noarch 1.7-10.el7 base
velocity-javadoc.noarch 1.7-10.el7 base
velocity-manual.noarch 1.7-10.el7 base
vemana2000-fonts.noarch 1.1.3-6.el7 base
verilator.x86_64 3.922-1.el7 epel ```
5.常用的command
- 命令名称:yum list available
作用:列出仓库中有但尚未安装的包
实例:
[root@localhost ~]# yum list available
zmap.x86_64 2.1.1-1.el7 epel
znc.x86_64 1.7.4-4.el7 epel
znc-devel.x86_64 1.7.4-4.el7 epel
znc-modperl.x86_64 1.7.4-4.el7 epel
znc-modpython.x86_64 1.7.4-4.el7 epel
znc-modtcl.x86_64 1.7.4-4.el7 epel
zopfli.x86_64 1.0.1-1.el7 epel
zsh.x86_64 5.0.2-33.el7 base
zsh-html.x86_64 5.0.2-33.el7 base
zsh-lovers.noarch 0.9.0-1.el7 epel
zstd.x86_64 1.4.2-1.el7 epel
zulucrypt.x86_64 5.0.1-1.el7 epel
zulucrypt-console.x86_64 5.0.1-1.el7 epel
zulucrypt-devel.x86_64 5.0.1-1.el7 epel
zulucrypt-doc.noarch 5.0.1-1.el7 epel
zulucrypt-libs.x86_64 5.0.1-1.el7 epel
zvbi.x86_64 0.2.35-1.el7 epel
zvbi-devel.x86_64 0.2.35-1.el7 epel
zvbi-fonts.noarch 0.2.35-1.el7 epel
zziplib.i686 0.13.62-11.el7 base
zziplib.x86_64 0.13.62-11.el7 base
zziplib-devel.i686 0.13.62-11.el7 base
zziplib-devel.x86_64 0.13.62-11.el7 base
zziplib-utils.x86_64 0.13.62-11.el7 base
- 命令名称: yum list installed
作用:列出已经安装的包
实例:
[root@localhost ~]# yum list installed
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. 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
已安装的软件包
GeoIP.x86_64 1.5.0-11.el7 @anaconda/7.4
NetworkManager.x86_64 1:1.8.0-9.el7 @anaconda/7.4
NetworkManager-config-server.noarch 1:1.8.0-9.el7 @anaconda/7.4
NetworkManager-libnm.x86_64 1:1.8.0-9.el7 @anaconda/7.4
NetworkManager-team.x86_64 1:1.8.0-9.el7 @anaconda/7.4
NetworkManager-tui.x86_64 1:1.8.0-9.el7 @anaconda/7.4
Red_Hat_Enterprise_Linux-Release_Notes-7-en-US.noarch
7-2.el7 @anaconda/7.4
Red_Hat_Enterprise_Linux-Release_Notes-7-zh-CN.noarch
7-2.2.el7 @anaconda/7.4
acl.x86_64 2.2.51-12.el7 @anaconda/7.4
aic94xx-firmware.noarch 30-6.el7 @anaconda/7.4
alsa-firmware.noarch 1.0.28-2.el7 @anaconda/7.4
alsa-lib.x86_64 1.1.3-3.el7 @anaconda/7.4
alsa-tools-firmware.x86_64 1.1.0-1.el7 @anaconda/7.4
audit.x86_64 2.7.6-3.el7 @anaconda/7.4
audit-libs.x86_64 2.7.6-3.el7 @anaconda/7.4
authconfig.x86_64 6.2.8-30.el7 @anaconda/7.4
basesystem.noarch 10.0-7.el7 @anaconda/7.4
bash.x86_64 4.2.46-28.el7 @anaconda/7.4
bind-libs-lite.x86_64 32:9.9.4-50.el7 @anaconda/7.4
bind-license.noarch 32:9.9.4-50.el7 @anaconda/7.4
binutils.x86_64 2.25.1-31.base.el7 @anaconda/7.4
biosdevname.x86_64 0.7.2-2.el7 @anaconda/7.4
btrfs-progs.x86_64 4.9.1-1.el7 @anaconda/7.4
bzip2.x86_64 1.0.6-13.el7 installed
- 命令名称:yum list updates
作用:列出可用的升级的包
实例:
[root@localhost ~]# yum list updates
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. 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
更新的软件包
GeoIP.x86_64 1.5.0-14.el7 base
NetworkManager.x86_64 1:1.18.0-5.el7_7.1 updates
NetworkManager-config-server.noarch 1:1.18.0-5.el7_7.1 updates
NetworkManager-libnm.x86_64 1:1.18.0-5.el7_7.1 updates
NetworkManager-team.x86_64 1:1.18.0-5.el7_7.1 updates
NetworkManager-tui.x86_64 1:1.18.0-5.el7_7.1 updates
acl.x86_64 2.2.51-14.el7 base
alsa-lib.x86_64 1.1.8-1.el7 base
audit.x86_64 2.8.5-4.el7 base
audit-libs.x86_64 2.8.5-4.el7 base
basesystem.noarch 10.0-7.el7.centos base
bash.x86_64 4.2.46-33.el7 base
bind-libs-lite.x86_64 32:9.11.4-9.P2.el7 base
bind-license.noarch 32:9.11.4-9.P2.el7 base
binutils.x86_64 2.27-41.base.el7 base
biosdevname.x86_64 0.7.3-2.el7 base
ca-certificates.noarch 2018.2.22-70.0.el7_5 base
chrony.x86_64 3.4-1.el7 base
coreutils.x86_64 8.22-24.el7 base
cpio.x86_64 2.11-27.el7 base
cronie.x86_64 1.4.11-23.el7 base
cronie-anacron.x86_64 1.4.11-23.el7 base
cryptsetup-libs.x86_64 2.0.3-5.el7 base
curl.x86_64 7.29.0-54.el7 base
cyrus-sasl-lib.x86_64 2.1.26-23.el7 base
dbus.x86_64 1:1.10.24-13.el7_6 base
dbus-libs.x86_64 1:1.10.24-13.el7_6 base
desktop-file-utils.x86_64 0.23-2.el7 base
device-mapper.x86_64 7:1.02.158-2.el7 base
device-mapper-event.x86_64 7:1.02.158-2.el7 base
device-mapper-event-libs.x86_64 7:1.02.158-2.el7 base
device-mapper-libs.x86_64 7:1.02.158-2.el7 base
- 命令名称: yum repolist
作用:列出yum源可用的软件仓库
实例:
[root@localhost ~]# yum repolist
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. 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
源标识 源名称 状态
base/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,097
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,415
extras/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 304
myrepo myrepo 4,986
updates/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 319
repolist: 29,121
- 命令名称:yum repolist all
作用:显示yum源可用和禁用的仓库
实例:
[root@localhost ~]# yum repolist all
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. 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
源标识 源名称 状态
base/x86_64 CentOS-7 - Base - mirrors.aliyun.com 启用: 10,097
centosplus/x86_64 CentOS-7 - Plus - mirrors.aliyun.com 禁用
contrib/x86_64 CentOS-7 - Contrib - mirrors.aliyun.com 禁用
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 启用: 13,415
epel-debuginfo/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 禁用
epel-source Extra Packages for Enterprise Linux 7 - x86_64 禁用
extras/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 启用: 304
myrepo myrepo 启用: 4,986
updates/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 启用: 319
repolist: 29,121
- 命令名称: yum clean packages
作用:清空包缓存
实例:
[root@localhost ~]# yum clean packages
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
正在清理软件源: base epel extras myrepo updates
0 package 文件已移除
- 命令名称:yum remove -y vsftpd
作用:卸载vsftpd
实例:
[root@localhost ~]# yum remove -y vsftpd
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
正在解决依赖关系
--> 正在检查事务
---> 软件包 vsftpd.x86_64.0.3.0.2-25.el7 将被 删除
--> 解决依赖关系完成
依赖关系解决
=========================================================================================================================================================================================
Package 架构 版本 源 大小
=========================================================================================================================================================================================
正在删除:
vsftpd x86_64 3.0.2-25.el7 @base 353 k
事务概要
=========================================================================================================================================================================================
移除 1 软件包
安装大小:353 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在删除 : vsftpd-3.0.2-25.el7.x86_64 1/1
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
验证中 : vsftpd-3.0.2-25.el7.x86_64 1/1
删除:
vsftpd.x86_64 0:3.0.2-25.el7
完毕!
- 命令名称:yum provides *bin/wget
作用: 查看指定的文件或特性是由哪个包安装生成的
实例:
[root@localhost ~]# yum provides *bin/wget
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. 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
wget-1.14-15.el7.x86_64 : A utility for retrieving files using the HTTP or FTP
: protocols
源 :myrepo
匹配来源:
文件名 :/usr/bin/wget
wget-1.14-18.el7_6.1.x86_64 : A utility for retrieving files using the HTTP or
: FTP protocols
源 :base
匹配来源:
文件名 :/usr/bin/wget
wget-1.14-15.el7.x86_64 : A utility for retrieving files using the HTTP or FTP
: protocols
源 :installed
匹配来源:
文件名 :/usr/bin/wget
- 命令名称: yum search httpd
作用:搜索关于httpd的包
实例:
[root@localhost ~]# yum search httpd
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. 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
keycloak-httpd-client-install.noarch : Tools to configure Apache HTTPD as
: Keycloak client
libmicrohttpd-devel.i686 : Development files for libmicrohttpd
libmicrohttpd-devel.x86_64 : Development files for libmicrohttpd
libmicrohttpd-doc.noarch : Documentation for libmicrohttpd
lighttpd-fastcgi.x86_64 : FastCGI module and spawning helper for lighttpd and PHP
: configuration
lighttpd-mod_authn_gssapi.x86_64 : Authentication module for lighttpd that uses
: GSSAPI
lighttpd-mod_authn_mysql.x86_64 : Authentication module for lighttpd that uses a
: MySQL database
lighttpd-mod_authn_pam.x86_64 : Authentication module for lighttpd that uses PAM
lighttpd-mod_geoip.x86_64 : GeoIP module for lighttpd to use for location lookups
lighttpd-mod_mysql_vhost.x86_64 : Virtual host module for lighttpd that uses a
: MySQL database
nextcloud-httpd.noarch : Httpd integration for NextCloud
owncloud-httpd.noarch : Httpd integration for ownCloud
python2-keycloak-httpd-client-install.noarch : Tools to configure Apache HTTPD as
: Keycloak client
radicale-httpd.noarch : httpd config for Radicale
sympa-lighttpd.x86_64 : Sympa with lighttpd
darkhttpd.x86_64 : A secure, lightweight, fast, single-threaded HTTP/1.1 server
httpd.x86_64 : Apache HTTP Server
httpd-devel.x86_64 : Development interfaces for the Apache HTTP server
httpd-itk.x86_64 : MPM Itk for Apache HTTP Server
httpd-manual.noarch : Documentation for the Apache HTTP server
httpd-tools.x86_64 : Tools for use with the Apache HTTP Server
- 命令名称:yum deplist httpd
作用:查看包的依赖关系
实例:
[root@localhost ~]# yum deplist httpd
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. 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
软件包:httpd.x86_64 2.4.6-90.el7.centos
依赖:/bin/sh
provider: bash.x86_64 4.2.46-33.el7
依赖:/etc/mime.types
provider: mailcap.noarch 2.1.41-2.el7
依赖:/usr/sbin/groupadd
provider: shadow-utils.x86_64 2:4.6-5.el7
依赖:/usr/sbin/useradd
provider: shadow-utils.x86_64 2:4.6-5.el7
依赖:httpd-tools = 2.4.6-90.el7.centos
provider: httpd-tools.x86_64 2.4.6-90.el7.centos
依赖:libapr-1.so.0()(64bit)
provider: apr.x86_64 1.4.8-5.el7
依赖:libaprutil-1.so.0()(64bit)
provider: apr-util.x86_64 1.5.2-6.el7
依赖:libc.so.6(GLIBC_2.14)(64bit)
provider: glibc.x86_64 2.17-292.el7
依赖:libcrypt.so.1()(64bit)
provider: glibc.x86_64 2.17-292.el7
依赖:libdb-5.3.so()(64bit)
provider: libdb.x86_64 5.3.21-25.el7
依赖:libdl.so.2()(64bit)
provider: glibc.x86_64 2.17-292.el7
依赖:libexpat.so.1()(64bit)
provider: expat.x86_64 2.1.0-10.el7_3
依赖:liblua-5.1.so()(64bit)
provider: lua.x86_64 5.1.4-15.el7
依赖:libm.so.6()(64bit)
provider: glibc.x86_64 2.17-292.el7
依赖:libpcre.so.1()(64bit)
provider: pcre.x86_64 8.32-17.el7
依赖:libpthread.so.0()(64bit)
provider: glibc.x86_64 2.17-292.el7
依赖:libpthread.so.0(GLIBC_2.2.5)(64bit)
provider: glibc.x86_64 2.17-292.el7
依赖:libselinux.so.1()(64bit)
provider: libselinux.x86_64 2.5-14.1.el7
依赖:libsystemd-daemon.so.0()(64bit)
provider: systemd-libs.x86_64 219-67.el7_7.1
依赖:libsystemd-daemon.so.0(LIBSYSTEMD_DAEMON_31)(64bit)
provider: systemd-libs.x86_64 219-67.el7_7.1
依赖:libz.so.1()(64bit)
provider: zlib.x86_64 1.2.7-18.el7
依赖:rtld(GNU_HASH)
provider: glibc.x86_64 2.17-292.el7
provider: glibc.i686 2.17-292.el7
依赖:system-logos >= 7.92.1-1
provider: redhat-logos.noarch 70.0.3-6.el7
provider: centos-logos.noarch 70.0.6-3.el7.centos
依赖:systemd-units
provider: systemd.x86_64 219-67.el7_7.1
- 命令名称:查看历史事务信息
作用:yum history
实例:
[root@localhost ~]# yum history
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
ID | 登录用户 | 日期和时间 | 操作 | 变更数
-------------------------------------------------------------------------------
3 | root <root> | 2019-09-28 17:02 | Erase | 1
2 | root <root> | 2019-09-28 16:34 | Install | 1 P<
1 | 系统 <空> | 2019-09-14 00:17 | Install | 340 >
history list
- 命令名称:yum grouplist
作用:列出可用的包组
实例:
[root@localhost ~]# yum grouplist
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. 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
可用的环境分组:
最小安装
基础设施服务器
计算节点
文件及打印服务器
Cinnamon 桌面环境
MATE 桌面环境
基本网页服务器
虚拟化主机
带 GUI 的服务器
GNOME 桌面
KDE Plasma Workspaces
开发及生成工作站
可用组:
Cinnamon
Fedora Packager
Haskell
MATE
Milkymist
TurboGears 应用程序构架
Xfce
传统 UNIX 兼容性
兼容性程序库
图形管理工具
安全性工具
开发工具
控制台互联网工具
教育软件
智能卡支持
电子实验室
科学记数法支持
系统管理
系统管理工具
通用桌面
- 命令名称:yum makecache
作用:创建元数据缓存
实例:
[root@localhost ~]# yum makecache
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. 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
base | 3.6 kB 00:00:00
epel | 5.4 kB 00:00:00
extras | 2.9 kB 00:00:00
myrepo | 4.1 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/10): epel/x86_64/prestodelta | 2.3 kB 00:00:00
(2/10): base/x86_64/other_db | 2.6 MB 00:00:06
(3/10): epel/x86_64/filelists_db | 12 MB 00:00:10
(4/10): myrepo/other_db | 1.5 MB 00:00:00
extras/x86_64/other_db FAILED
http://mirrors.cloud.aliyuncs.com/centos/7/extras/x86_64/repodata/1f4b7c95a68d523c8ac486be0e2f024dacbc1efb0a570545c32bbf3f5f4b80be-other.sqlite.bz2: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Name or service not known"
正在尝试其它镜像。
(5/10): epel/x86_64/other_db | 3.3 MB 00:00:10
(6/10): extras/x86_64/filelists_db | 207 kB 00:00:01
(7/10): updates/x86_64/other_db | 124 kB 00:00:00
(8/10): extras/x86_64/other_db | 100 kB 00:00:00
(9/10): updates/x86_64/filelists_db | 1.1 MB 00:00:01
(10/10): epel/x86_64/updateinfo_zck | 1.5 MB 00:00:02
元数据缓存已建立
作业:
1.如何配置本地光盘yum仓库以及网络yum仓库
配置本地光盘yum仓库:
[root@localhost ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]# mkdir /opt/myrepo
[root@localhost ~]# cp -r /mnt/* /opt/myrepo/
[root@localhost ~]# ls /opt/myrepo/
addons GPL media.repo RPM-GPG-KEY-redhat-release
EFI images Packages TRANS.TBL
EULA isolinux repodata
extra_files.json LiveOS RPM-GPG-KEY-redhat-beta
[root@localhost ~]# ls /etc/yum.repos.d/
CentOS-Base.repo epel.repo redhat.repo
[root@localhost ~]# vi /etc/yum.repos.d/myrepo.repo
[root@localhost ~]# cat /etc/yum.repos.d/myrepo.repo
[myrepo]
name=myrepo
baseurl=file:///opt/myrepo
gpgcheck=0
enabled=1
配置网络仓库:
[root@localhost ~]# vi /etc/yum.repos.d/CentOS.repo
[root@localhost ~]# cat /etc/yum.repos.d/CentOS.repo
[CentOS]
name=CentOS.repo
baseurl=http://mirrors.aliyun.com/repo/Centos-7.repo
gpgcheck=0
enabled=1
2.如何使用yum安装 httpd php nginx
安装httpd:
[root@localhost ~]# yum -y install httpd
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. 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
base | 3.6 kB 00:00:00
epel | 5.4 kB 00:00:00
extras | 2.9 kB 00:00:00
myrepo | 4.1 kB 00:00:00
updates | 2.9 kB 00:00:00
正在解决依赖关系
--> 正在检查事务
---> 软件包 httpd.x86_64.0.2.4.6-90.el7.centos 将被 安装
--> 正在处理依赖关系 httpd-tools = 2.4.6-90.el7.centos,它被软件包 httpd-2.4.6-90.el7.centos.x86_64 需要
--> 正在处理依赖关系 /etc/mime.types,它被软件包 httpd-2.4.6-90.el7.centos.x86_64 需要
--> 正在处理依赖关系 libaprutil-1.so.0()(64bit),它被软件包 httpd-2.4.6-90.el7.centos.x86_64 需要
--> 正在处理依赖关系 libapr-1.so.0()(64bit),它被软件包 httpd-2.4.6-90.el7.centos.x86_64 需要
安装php
[root@localhost ~]# yum -y install php
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. 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
正在解决依赖关系
--> 正在检查事务
---> 软件包 php.x86_64.0.5.4.16-46.el7 将被 安装
--> 正在处理依赖关系 php-common(x86-64) = 5.4.16-46.el7,它被软件包 php-5.4.16-46.el7.x86_64 需要
--> 正在处理依赖关系 php-cli(x86-64) = 5.4.16-46.el7,它被软件包 php-5.4.16-46.el7.x86_64 需要
--> 正在检查事务
---> 软件包 php-cli.x86_64.0.5.4.16-46.el7 将被 安装
---> 软件包 php-common.x86_64.0.5.4.16-46.el7 将被 安装
--> 正在处理依赖关系 libzip.so.2()(64bit),它被软件包 php-common-5.4.16-46.el7.x86_64 需要
--> 正在检查事务
安装nginx
[root@localhost ~]# yum -y install nginx
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. 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
正在解决依赖关系
--> 正在检查事务
---> 软件包 nginx.x86_64.1.1.12.2-3.el7 将被 安装
--> 正在处理依赖关系 nginx-all-modules = 1:1.12.2-3.el7,它被软件包 1:nginx-1.12.2-3.el7.x86_64 需要
--> 正在处理依赖关系 nginx-filesystem = 1:1.12.2-3.el7,它被软件包 1:nginx-1.12.2-3.el7.x86_64 需要
--> 正在处理依赖关系 nginx-filesystem,它被软件包 1:nginx-1.12.2-3.el7.x86_64 需要
--> 正在处理依赖关系 libprofiler.so.0()(64bit),它被软件包 1:nginx-1.12.2-3.el7.x86_64 需要
--> 正在检查事务
---> 软件包 gperftools-libs.x86_64.0.2.6.1-1.el7 将被 安装
---> 软件包 nginx-all-modules.noarch.1.1.12.2-3.el7 将被 安装
3.如何配置yum缓存rpm包(至少阐述两种方式)
第一种:
vim /etc/yum.conf
cachedir=/var/cache/yum/$basearch/$releasever //缓存目录
keepcache=1 //缓存软件包, 1启动 0 关闭
debuglevel=2 //调试级别
logfile=/var/log/yum.log //日志记录位置
exactarch=1 //检查平台是否兼容
obsoletes=1 //检查包是否废弃
gpgcheck=1 //检查来源是否合法,需要有制作者的公钥信息
plugins=1 //是否启用插件
tolerant={1|0} //容错功能,1为开启,0为关闭,当设为0时,如果用yum安装多个软件包且其中某个软件包已经安装过就会报错;当设为1时,当要安装的软件已经安装时自动忽略
installonly_limit=5
bugtracker_url
# metadata_expire=90m //每小时手动检查元数据
# in /etc/yum.repos.d //包含repos.d目录
第二种:
[root@localhost yum.repos.d]# yum install --downloadonly --downloaddir=/opt/ httpd
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. 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
base | 3.6 kB 00:00:00
epel | 5.4 kB 00:00:00
extras | 2.9 kB 00:00:00
myrepo | 4.1 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/9): epel/x86_64/group_gz | 88 kB 00:00:00
(2/9): epel/x86_64/updateinfo | 1.0 MB 00:00:00
(3/9): myrepo/group_gz | 137 kB 00:00:00
(4/9): myrepo/primary_db | 4.0 MB 00:00:00
(5/9): base/x86_64/group_gz | 165 kB 00:00:00
(6/9): updates/x86_64/primary_db | 1.1 MB 00:00:00
(7/9): extras/x86_64/primary_db | 152 kB 00:00:00
(8/9): base/x86_64/primar 64% [========== ] 1.5 MB/s | 13 MB 00:00:04 ETA
(8/9): epel/x86_64/primary_db | 6.8 MB 00:00:03
(9/9): base/x86_64/primary_db | 6.0 MB 00:00:04
正在解决依赖关系
--> 正在检查事务
---> 软件包 httpd.x86_64.0.2.4.6-90.el7.centos 将被 安装
--> 正在处理依赖关系 httpd-tools = 2.4.6-90.el7.centos,它被软件包 httpd-2.4.6-90.el7.centos.x86_64 需要
--> 正在处理依赖关系 /etc/mime.types,它被软件包 httpd-2.4.6-90.el7.centos.x86_64 需要
--> 正在处理依赖关系 libaprutil-1.so.0()(64bit),它被软件包 httpd-2.4.6-90.el7
4.如何使用yum安装本地缓存好的rpm包
[root@localhost ~]# yum localinstall /opt/httpd-2.4.6-90.el7.centos.x86_64.rpm
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
正在检查 /opt/httpd-2.4.6-90.el7.centos.x86_64.rpm: httpd-2.4.6-90.el7.centos.x86_64
/opt/httpd-2.4.6-90.el7.centos.x86_64.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 httpd.x86_64.0.2.4.6-90.el7.centos 将被 安装
--> 正在处理依赖关系 httpd-tools = 2.4.6-90.el7.centos,它被软件包 httpd-2.4.6-90.el7.centos.x86_64 需要
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
--> 正在处理依赖关系 /etc/mime.types,它被软件包 httpd-2.4.6-90.el7.centos.x86_64 需要
--> 正在处理依赖关系 libapr-1.so.0()(64bit),它被软件包 httpd-2.4.6-90.el7.centos.x86_64 需要
--> 正在处理依赖关系 libaprutil-1.so.0()(64bit),它被软件包 httpd-2.4.6-90.el7.centos.x86_64 需要
--> 正在检查事务
5.如何使用yum删除httpd软件包
[root@localhost ~]# yum -y remove httpd
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
正在解决依赖关系
--> 正在检查事务
---> 软件包 httpd.x86_64.0.2.4.6-90.el7.centos 将被 删除
--> 正在处理依赖关系 httpd-mmn = 20120211x8664,它被软件包 php-5.4.16-46.el7.x86_64 需要
--> 正在检查事务
---> 软件包 php.x86_64.0.5.4.16-46.el7 将被 删除
--> 解决依赖关系完成
依赖关系解决
=================================================================================
Package 架构 版本 源 大小
=================================================================================
正在删除:
httpd x86_64 2.4.6-90.el7.centos @base 9.4 M
为依赖而移除:
php x86_64 5.4.16-46.el7 @base 4.4 M
事务概要
=================================================================================
移除 1 软件包 (+1 依赖软件包)
安装大小:14 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在删除 : php-5.4.16-46.el7.x86_64 1/2
正在删除 : httpd-2.4.6-90.el7.centos.x86_64 2/2
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
验证中 : php-5.4.16-46.el7.x86_64 1/2
验证中 : httpd-2.4.6-90.el7.centos.x86_64 2/2
删除:
httpd.x86_64 0:2.4.6-90.el7.centos
作为依赖被删除:
php.x86_64 0:5.4.16-46.el7
完毕!