(一)、概述
- RPM包
RPM(原Red Hat Package Manager,现在是一个递归缩写)
由 Red Hat 公司提出,被众多 Linux 发行版所采用
也称二进制( binary code)无需编译,可以直接使用
无法设定个人设置,开关功能
软件包示例(注意后缀):mysql-community-common-5.7.12-1.el7.x86_64.rpm
认识RPM包
zip-3.0-11.el7.x86_64.rpm
wget-1.14-15.el7.x86_64.rpm
tcpdump-4.9.0-5.el7.x86_64.rpm
注释:
zip - 3.0-11. el7. x86_64. rpm
软件包名:zip
版本号(Version) :3.0-11
发布版本(Release5/6/7) : el7
系统平台(32/64):x86_64
文件后缀:rpm
2.源码包:
source code 需要经过GCC,C++编译环境编译才能运行
可以设定个人设置,开关功能
软件包示例:nginx-1.8.1.tar.gz
认识源码包:包名:nginx
版本号:-1.8.1
压缩格式:.tar.gz
(二)、RPM包管理
1.yum 工具
简介:Yum(全称为 Yellow dog Updater, Modified)
是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器。
基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,
可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。
配置YUM仓库/YUM源
1.网络源:使用官方源
前提:联网
设置虚拟机网络为NAT
打开Linux网络设置
上网测试
[root@localhost ~]# ping www.baidu.com
PING www.a.shifen.com (39.156.66.14) 56(84) bytes of data.
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=1 ttl=128 time=15.6 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=2 ttl=128 time=14.8 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=3 ttl=128 time=14.4 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=4 ttl=128 time=14.5 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=5 ttl=128 time=14.7 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=6 ttl=128 time=14.4 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=7 ttl=128 time=19.4 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=8 ttl=128 time=15.1 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=9 ttl=128 time=15.1 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=10 ttl=128 time=14.4 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=11 ttl=128 time=14.8 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=12 ttl=128 time=14.6 ms
^C
目的:
使用国内厂商提供的软件包地址(如:http://alibaba.com/.sadflsdjfjsdalkfdsa)作为YUM的仓库。
阿里云:
Base/Extras/Updates: 默认(国外源)
1 清理原先YUM库
yum install wget
mv /etc/yum.repos.d/* /tmp
2 下载阿里源至yum库
wget http://mirrors.aliyun.com/repo/Centos-7.repo -O /etc/yum.repos.d/CentOS-Base.repo
3 更新YUM源
yum repolist
yum makecache
[root@localhost ~]# yum -y install wget
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.bfsu.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
软件包 wget-1.14-18.el7_6.1.x86_64 已安装并且是最新版本
无须任何处理
[root@localhost ~]#
[root@localhost ~]# mv /etc/yum.repos.d/* /tmp
[root@localhost ~]# wget http://mirrors.aliyun.com/repo/Centos-7.repo -O /etc/yum.repos.d/CentOS-Base.repo
--2020-08-04 19:58:43-- http://mirrors.aliyun.com/repo/Centos-7.repo
正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 111.7.88.239, 111.7.88.238, 111.7.88.244, ...
正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|111.7.88.239|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:2523 (2.5K) [application/octet-stream]
正在保存至: “/etc/yum.repos.d/CentOS-Base.repo”
100%[============================================================================>] 2,523 --.-K/s 用时 0.001s
2020-08-04 19:58:43 (3.69 MB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [2523/2523])
[root@localhost ~]#
[root@localhost ~]# yum repolist
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
源标识 源名称 状态
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,070
extras/7/x86_64