
<div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;">
讯享网
Linux软件包的安装与卸载
安装软件包的三种方法
rpm工具
red hat package manager,红帽公司开发的包管理软件
yum工具
Yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及CentOS中的
Shell前端软件包管理器。基于
RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系。
源码包安装
需要通过编译器把源码包编译成可执行的文件,可以看到作者的所有代码
rpm包介绍
rpm包格式,
包名
,
版本号
,
发布版本号
,
平台
例:
popt-
1.13
-
16.el7.
x86_64.rpm
包名
版本号
发布版本
平台
postgresql-jdbc-
9
.2.
1002-5.el7.
noarch.rpm
主版本号9,
次版本号2,
修正版本号1002,
noarch表示不限制平台
rpm工具用法
rpm -ivh rpm包文件 安装
rpm -Uvh rpm包文件 升级
rpm -e 包名 卸载
不能跟rmp包文件名
rpm -qa 查询安装的包
rpm -q 包名 查询指定的包是否安装
rpm -qi包名 查询指定的包信息
rpm -ql包名 列出包安装的文件
rpm -qf文件绝对路径 查看指定文件是由哪个包安装的
rpm -qf `which cd` 查询cd命令的包是由哪个包安装的
例:
[root@bogon ~]#
mount /dev/cdrom /mnt
挂载光盘至/mnt/目录下
mount: /dev/sr0 写保护,将以只读方式挂载
/dev/sr0 已经挂载到 /mnt 上
[root@bogon ~]#
ls /mnt
CentOS_BuildTag EULA images LiveOS repodata RPM-GPG-KEY-CentOS-Testing-7
EFI GPL isolinux Packages RPM-GPG-KEY-CentOS-7 TRANS.TBL
[root@bogon ]#
cd /mnt/Packages/
[root@bogon Packages]#
ls |head
列出前10个文件
389-ds-base-1.3.6.1-16.el7.x86_64.rpm
389-ds-base-libs-1.3.6.1-16.el7.x86_64.rpm
abattis-cantarell-fonts-0.0.25-1.el7.noarch.rpm
abrt-2.1.11-48.el7.centos.x86_64.rpm
abrt-addon-ccpp-2.1.11-48.el7.centos.x86_64.rpm
abrt-addon-kerneloops-2.1.11-48.el7.centos.x86_64.rpm
abrt-addon-pstoreoops-2.1.11-48.el7.centos.x86_64.rpm
abrt-addon-python-2.1.11-48.el7.centos.x86_64.rpm
abrt-addon-vmcore-2.1.11-48.el7.centos.x86_64.rpm
abrt-addon-xorg-2.1.11-48.el7.centos.x86_64.rpm
[root@bogon Packages]#
rpm -ivh abrt-addon-ccpp-2.1.11-48.el7.centos.x86_64.rpm
安装此包
准备中… [100%]
软件包 abrt-addon-ccpp-2.1.11-48.el7.centos.x86_64 已经安装
[root@bogon Packages]#
rpm -Uvh abrt-addon-ccpp-2.1.11-48.el7.centos.x86_64.rpm
升级此包
准备中… [100%]
软件包 abrt-addon-ccpp-2.1.11-48.el7.centos.x86_64 已经安装
[root@bogon Packages]#
rpm -e abrt-addon-ccpp-2.1.11-48.el7.centos.x86_64.rpm
卸载此包
错误
:未安装软件包 abrt-addon-ccpp-2.1.11-48.el7.centos.x86_64.rpm
用包文件名会报错
[root@bogon Packages]#
rpm -e abrt-addon-ccpp
卸载此包,用包名才正确
错误:
依赖检测失败
: 因为有其他包依赖此此包,故卸载失败,非必要,不可强制卸载,可能引起系统崩溃
abrt-addon-ccpp
被
(已安裝) abrt-desktop-2.1.11-48.el7.centos.x86_64
需要
[root@bogon Packages]#
rpm -qa
查询已安装的包
libmusicbrainz5-5.0.1-9.el7.x86_64
grub2-2.02-0.64.el7.centos.x86_64
lvm2-2.02.171-8.el7.x86_64
bind-license-9.9.4-50.el7.noarch
libsemanage-python-2.5-8.el7.x86_64
microcode_ctl-2.1-22.el7.x86_64
libimobiledevice-1.2.0-1.el7.x86_64
ncurses-libs-5.9-13..el7.x86_64
libnice-0.1.3-4.el7.x86_64
[root@bogon Packages]#
[root@bogon Packages]#
rpm -q libmusicbrainz5
查询指定包是否已安装
libmusicbrainz5-5.0.1-9.el7.x86_64
[root@bogon Packages]#
rpm -qi libmusicbrainz5
查询指定包的详细信息
Name : libmusicbrainz5
Version : 5.0.1
Release : 9.el7
Architecture: x86_64
Install Date: 2018年04月03日 星期二 02时42分15秒
Group : System Environment/Libraries
Size :
License : LGPLv2
Signature : RSA/SHA256, 2014年07月04日 星期五 11时00分51秒, Key ID 24c6a8a7f4a80eb5
Source RPM : libmusicbrainz5-5.0.1-9.el7.src.rpm
Build Date : 2014年06月10日 星期二 12时14分00秒
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://www.musicbrainz.org/
Summary : Library for accessing MusicBrainz servers
Description :
The MusicBrainz client library allows applications to make metadata
lookup to a MusicBrainz server, generate signatures from WAV data and
create CD Index Disk ids from audio CD roms.
[root@bogon Packages]#
rpm -ql libmusicbrainz5
查询指定包安装的文件
/usr/lib64/libmusicbrainz5.so.0
/usr/lib64/libmusicbrainz5.so.0.0.1
/usr/share/doc/libmusicbrainz5-5.0.1
/usr/share/doc/libmusicbrainz5-5.0.1/AUTHORS.txt
/usr/share/doc/libmusicbrainz5-5.0.1/COPYING.txt
/usr/share/doc/libmusicbrainz5-5.0.1/NEWS.txt
/usr/share/doc/libmusicbrainz5-5.0.1/README.md
[root@bogon Packages]# rpm -qf /usr/share/d
dbus-1/ defaults/ dict/
dconf/ desktop-directories/ doc/
[root@bogon Packages]#
rpm -qf /usr/share/doc/libmusicbrainz5-5.0.1/NEWS.txt
依据文件查询由哪个包安装
libmusicbrainz5-5.0.1-9.el7.x86_64
[root@bogon Packages]#
rpm -qf `which cd`
查
询cd命令的包是由哪个包安装的,两步合并操作
bash-4.2.46-28.el7.x86_64
[root@bogon Packages]#
yum工具用法
yum list 可安装和可更新的RPM包
ls /etc/yum.repos.d 查看yum源的配置文件
yum search 包名 搜索包
yum install (-y)包名 安装 (-y 自动应答yes,-q 静默执行,-t 忽略错误,-R[分钟] 设置等待时间)
yum grouplist 列出可安装的组
yum groupinstall 包组名 安装组包 如果是一个单词,
不用加单引号,有空格要加单引号
yum remove (-y)包名 卸载包 {yum erase (-y)}
yum updeta (-y)包名 升级,若不指定文件名,则升级全部已安装包,包括升级系统
yum upgrade 升级系统
yum provides “/*/
” 搜索特定文件或命令对应的包名
yum list |grep ‘’ 过滤列出包名中包含*的包名
yum info 包名 可安装和可更新的RPM包 信息
yum deplist 包文件名 显示软件包依赖关系
拓展部分:
yum –skip-broken 忽略依赖问题
yum –nogpgcheck 忽略GPG验证check-update 检查可更新的包
yum clean all 清除全部
yum clean packages 清除临时包文件(/var/cache/yum 下文件)
yum clean headers 清除rpm头文件
yum clean oldheaders 清除旧的rpm头文件
yum deplist 列出包的依赖
yum list installed 已安装的包
yum list extras 已安装且不在资源库的包
yum info installed 已安装包的信息(-qa 参数相似)
yum localinstall 安装本地的 RPM包
yum reinstall[RPM包] 重新安装包
yum repolist 显示资源库的配置
yum resolvedep 指定依赖
例:
[root@bogon Packages]#
yum list | head -n 20
列出可安装和可更新的包,列出前20个文件
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.cn99.com
已安装的软件包
GConf2.x86_64 3.2.6-8.el7 @base
GeoIP.x86_64 1.5.0-11.el7 @anaconda
ModemManager-glib.x86_64 1.6.0-2.el7 @base
NetworkManager.x86_64 1:1.8.0-11.el7_4 @updates
NetworkManager-glib.x86_64 1:1.8.0-11.el7_4 @updates
NetworkManager-libnm.x86_64 1:1.8.0-11.el7_4 @updates
NetworkManager-libreswan.x86_64 1.2.4-2.el7 @base
NetworkManager-libreswan-gnome.x86_64 1.2.4-2.el7 @base
NetworkManager-team.x86_64 1:1.8.0-11.el7_4 @updates
NetworkManager-tui.x86_64 1:1.8.0-11.el7_4 @updates
NetworkManager-wifi.x86_64 1:1.8.0-11.el7_4 @updates
PackageKit.x86_64 1.1.5-1.el7.centos @base
PackageKit-command-not-found.x86_64 1.1.5-1.el7.centos @base
PackageKit-glib.x86_64 1.1.5-1.el7.centos @base
由于管道被破坏而退出
忽略此错误
[root@bogon Packages]#
ls /etc/yum.repos.d
查看yum源配置文件,Base是仓库配置文件
CentOS-
Base
.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo
[root@bogon Packages]#
yum search GConf2-3.2.6-8.el7.x86_64.rpm
搜索此包,不能用包文件名
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.cn99.com
警告:没有匹配 GConf2-3.2.6-8.el7.x86_64.rpm 的软件包
No matches found
[root@bogon Packages]#
yum search GConf2
搜索此包,用包名才正确
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.163.com
* updates: mirrors.cn99.com
============================================ N/S matched: GConf2 =============================================
GConf2.i686 : A process-transparent configuration system
GConf2.x86_64 : A process-transparent configuration system
GConf2-devel.i686 : Headers and libraries for GConf development
GConf2-devel.x86_64 : Headers and libraries for GConf development
名称和简介匹配 only,使用“search all”试试。
[root@bogon Packages]#
yum install GConf2
安装此包
已加载插件:fastestmirror
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
updates/7/x86_64/primary_db | 6.9 MB 00:00:02
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.cn99.com
软件包 GConf2-3.2.6-8.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@bogon Packages]#
yum grouplist
列出可安装的包组
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.163.com
* updates: mirrors.cn99.com
可用的环境分组:
最小安装
基础设施服务器
计算节点
文件及打印服务器
基本网页服务器
虚拟化主机
带 GUI 的服务器
GNOME 桌面
KDE Plasma Workspaces
开发及生成工作站
可用组:
传统 UNIX 兼容性
兼容性程序库
图形管理工具
安全性工具
开发工具
控制台互联网工具
智能卡支持
科学记数法支持
系统管理
系统管理工具
完成
[root@bogon Packages]#
LANG=en
切换系统语言至英语
[root@bogon Packages]#
yum grouplist
列出可安装的包组
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.cn99.com
Available Environment Groups:
Minimal Install
Compute Node
Infrastructure Server
File and Print Server
Basic Web Server
Virtualization Host
Server with GUI
GNOME Desktop
KDE Plasma Workspaces
Development and Creative Workstation
Available Groups:
Compatibility Libraries
Console Internet Tools
Development Tools
Graphical Administration Tools
Legacy UNIX Compatibility
Scientific Support
Security Tools
Smart Card Support
System Administration Tools
System Management
Done
[root@bogon Packages]#
yum groupinstall Basic Web Server
安装名为Basic Web Server的包组
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.cn99.com
Warning: group Basic does not exist.
Warning: group Web does not exist.
Warning: group Server does not exist.
Maybe run: yum groups mark install (see man yum)
Error: No packages in any requested group available to install or update
[root@bogon Packages]#
yum groupinstall ‘Basic Web Server’
包组名字中有空格,需给包组添加单引号
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.cn99.com
Warning: Group core does not have any packages to install.
Resolving Dependencies
–> Running transaction check
—> Package abrt-cli.x86_64 0:2.1.11-48.el7.centos will be installed
–> Processing Dependency: abrt-tui for package: abrt-cli-2.1.11-48.el7.centos.x86_64
—>
省略
Transaction Summary
==============================================================================================================
Install 51 Packages (+20 Dependent packages)
Upgrade ( 2 Dependent packages)
Total download size: 25 M
Is this ok [y/d/N]: N
[root@bogon Packages]#
[root@bogon Packages]#
LANG=zh_CN
.
UTF-8
切换系统语言至中文简体
[root@bogon Packages]#
yum remove GConf2-3.2.6-8.el7.x86_64.rpm
删除此包,不能用包文件名
已加载插件:fastestmirror
参数 GConf2-3.2.6-8.el7.x86_64.rpm 没有匹配
不删除任何软件包
[root@bogon Packages]#
yum remove GConf2
删除此包,用包名才对
已加载插件:fastestmirror
正在解决依赖关系
–> 正在检查事务
—> 软件包 GConf2.x86_64.0.3.2.6-8.el7 将被 删除
–> 正在处理依赖关系 GConf2,它被软件包 gstreamer-plugins-good-0.10.31-13.el7.x86_64 需要
–> 正在处理依赖关系 GConf2,它被软件包 gstreamer-plugins-good-0.10.31-13.el7.x86_64 需要
–> 正在处理依赖关系 GConf2,它被软件包 gstreamer-plugins-good-0.10.31-13.el7.x86_64 需要
–> 正在处理依赖关系 libgconf-2.so.4()(64bit),它被软件包 gstreamer-plugins-good-0.10.31-13.el7.x86_64 需要
–> 正在处理依赖关系 libgconf-2.so.4()(64bit),它被软件包 gnome-session-3.22.3-4.el7.x86_64 需要
–> 正在处理依赖关系 libgconf-2.so.4()(64bit),它被软件包 gnome-terminal-3.22.1-2.el7.x86_64 需要
省略
[root@bogon Packages]#
yum update
升级全部已安装的包
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.cn99.com
正在解决依赖关系
–> 正在检查事务
—> 软件包 bash.x86_64.0.4.2.46-28.el7 将被 升级
—> 软件包 bash.x86_64.0.4.2.46-29.el7_4 将被 更新
—> 软件包 bind-libs-lite.x86_64.32.9.9.4-50.el7 将被 升级
—> 软件包 bind-libs-lite.x86_64.32.9.9.4-51.el7_4.2 将被 更新
省略
[root@bogon Packages]#
yum update GConf2
升级指定包
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.cn99.com
No packages marked for update
[root@bogon Packages]# yum update
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.cn99.com
正在解决依赖关系
–> 正在检查事务
—> 软件包 bash.x86_64.0.4.2.46-28.el7 将被 升级
—> 软件包 bash.x86_64.0.4.2.46-29.el7_4 将被 更新
—> 软件包 bind-libs-lite.x86_64.32.9.9.4-50.el7 将被 升级
~
省略
[root@bogon Packages]#
yum provides “/*/cat”
搜索cat文件的包名
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.sohu.com
coreutils-8.22-18.el7.x86_64 : A set of basic GNU tools commonly used in shell scripts
源 :base
匹配来源:
文件名 :/usr/bin/cat
文件名 :/bin/cat
irssi-0.8.15-16.el7.x86_64 : Modular text mode IRC client with Perl scripting
源 :base
匹配来源:
文件名 :/usr/share/irssi/help/cat
coreutils-8.22-18.el7.x86_64 : A set of basic GNU tools commonly used in shell scripts
源 :@anaconda
匹配来源:
文件名 :/usr/bin/cat
文件名 :/bin/cat
[root@bogon Packages]#
yum list |grep ‘vim’
列出有关vim可安装和可更新的包
vim-common.x86_64 2:7.4.160-2.el7
@
base
@表示此包已安装
vim-enhanced.x86_64 2:7.4.160-2.el7
@
base
vim-filesystem.x86_64 2:7.4.160-2.el7
@
base
vim-minimal.x86_64 2:7.4.160-2.el7
@
anaconda
表示此包所在仓库
protobuf-vim.x86_64 2.5.0-8.el7
base
base表示此包所在仓库
vim-X11.x86_64 2:7.4.160-2.el7
base
无@表示未安装
[root@bogon Packages]#
yum deplist vim
列出vim的依赖关系,不能用包名
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.163.com
* updates: mirrors.cn99.com
[root@bogon Packages]#
yum deplist vim-common-7.4.160-2.el7.x86_64.rpm
列出vim的依赖关系,要用包的文件名才正确
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.cn99.com
软件包:vim-common.x86_64 2:7.4.160-2.el7
依赖:/bin/sh
provider: bash.x86_64 4.2.46-29.el7_4
依赖:config(vim-common) = 2:7.4.160-2.el7
provider: vim-common.x86_64 2:7.4.160-2.el7
依赖:libc.so.6()(64bit)
provider: glibc.x86_64 2.17-196.el7_4.2
依赖:libc.so.6(GLIBC_2.2.5)(64bit)
provider: glibc.x86_64 2.17-196.el7_4.2
依赖:libc.so.6(GLIBC_2.3)(64bit)
provider: glibc.x86_64 2.17-196.el7_4.2
依赖:libc.so.6(GLIBC_2.3.4)(64bit)
provider: glibc.x86_64 2.17-196.el7_4.2
依赖:rtld(GNU_HASH)
provider: glibc.x86_64 2.17-196.el7_4.2
provider: glibc.i686 2.17-196.el7_4.2
依赖:vim-filesystem
provider: vim-filesystem.x86_64 2:7.4.160-2.el7
[root@bogon Packages]#
源码包安装
cd /usr/local/src/ 进入/src/目录,约定俗成的源码安装目录
wget
https://
将源码包下载至此
tar -zxvf httpd-2.4.33.tar.gz 解压源码包
ls 显示解压的源码包目录
cd httpd-2.4.33 进入源码包目录
ls 列出源码包目录里的文件
more README 阅读软件说明
less INSTALL 阅读安装说明,查找安装步骤
https://blog.csdn.net/langyue919/article/details/configure –prefix=/usr/local/apache2 配置环境,生成make文件
echo
\(? 验证配置是否正确 非0皆为错 </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> make 编译过程 </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> echo \)? 验证编译是否正确 非0皆为错
make install 安装过程
echo
\(? 验证安装是否正确 非0皆为错 </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <br /> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="color:#FF0000;">卸载 删除安装的目录和文件</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <br /> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> 例: </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <br /> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon ~]# </span> <span style="color:#df402a;background-color:rgb(197,217,242);">cd /usr/local/src/ </span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 进入源码包目录</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon src]# </span> <span style="color:#df402a;background-color:rgb(197,217,242);">wget https://mirrors.cnnic.cn/apache/httpd/httpd-2.4.33.tar.gz </span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="color:#df402a;background-color:rgb(255,255,255);"> 下载要安装的源码包</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">--2018-04-19 18:42:45-- https://mirrors.cnnic.cn/apache/httpd/httpd-2.4.33.tar.gz</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">正在解析主机 mirrors.cnnic.cn (mirrors.cnnic.cn)... 101.6.8.193, 2402:f000:1:408:8100::1</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">正在连接 mirrors.cnnic.cn (mirrors.cnnic.cn)|101.6.8.193|:443... 已连接。</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">已发出 HTTP 请求,正在等待回应... 200 OK</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">长度:9076901 (8.7M) [application/octet-stream]</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">正在保存至: “httpd-2.4.33.tar.gz”</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">100%[====================================================================>] 9,076,901 5.44MB/s 用时 1.6s </span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">2018-04-19 18:42:48 (5.44 MB/s) - 已保存 “httpd-2.4.33.tar.gz” [9076901/9076901])</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon src]#</span> <span style="color:#df402a;background-color:rgb(197,217,242);"> tar -zxvf httpd-2.4.33.tar.gz </span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 解压源码包</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">httpd-2.4.33/</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">httpd-2.4.33/config.layout</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">httpd-2.4.33/configure.in</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">~</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">~</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">省略</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon httpd-2.4.33]# </span> <span style="color:#df402a;background-color:rgb(197,217,242);">less README</span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 阅读软件说明</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> Apache HTTP Server</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> What is it?</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> -----------</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> The Apache HTTP Server is a powerful and flexible HTTP/1.1 compliant</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> web server. Originally designed as a replacement for the NCSA HTTP</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> Server, it has grown to be the most popular web server on the</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> Internet. As a project of the Apache Software Foundation, the</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> developers aim to collaboratively develop and maintain a robust,</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> commercial-grade, standards-based server with freely available</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> source code.</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> The Latest Version</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> ------------------</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> Details of the latest version can be found on the Apache HTTP</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> server project page under http://httpd.apache.org/.</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> Documentation</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> -------------</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> The documentation available as of the date of this release is</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> included in HTML format in the docs/manual/ directory. The most</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> up-to-date documentation can be found at</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">README</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon httpd-2.4.33]#</span> <span style="color:#df402a;background-color:rgb(197,217,242);"> more INSTALL </span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 阅读安装说明</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> APACHE INSTALLATION OVERVIEW</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> Quick Start - Unix</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> ------------------</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> For complete installation documentation, see [ht]docs/manual/install.html or</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> http://httpd.apache.org/docs/2.4/install.html</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="color:#df402a;background-color:rgb(197,217,242);"> \) https://blog.csdn.net/langyue919/article/details/configure –prefix=PREFIX
这是我们要找的安装步骤
\( make</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="color:#df402a;background-color:rgb(197,217,242);"> \) make install
\( PREFIX/bin/apachectl start</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> NOTES: * Replace PREFIX with the filesystem path under which </span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> Apache should be installed. A typical installation</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> might use "/usr/local/apache2" for PREFIX (without the</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> quotes).</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> * Consider if you want to use a previously installed APR and</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> APR-Util (such as those provided with many OSes) or if you</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> need to use the APR and APR-Util from the apr.apache.org</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> project. If the latter, download the latest versions and</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> unpack them to https://blog.csdn.net/langyue919/article/details/srclib/apr and https://blog.csdn.net/langyue919/article/details/srclib/apr-util (no</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> version numbers in the directory names) and use</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);"> https://blog.csdn.net/langyue919/article/details/configure's --with-included-apr option. This is required</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">--More--(27%)</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon httpd-2.4.33]#</span> <span style="color:#df402a;background-color:rgb(197,217,242);"> https://blog.csdn.net/langyue919/article/details/configure -prefix=/usr/local/apache2</span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 配置环境,生成make文件</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">checking for chosen layout... Apache</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">checking for working mkdir -p... yes</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">checking for grep that handles long lines and -e... /bin/grep</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">checking for egrep... /bin/grep -E</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">checking build system type... x86_64-pc-linux-gnu</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">checking host system type... x86_64-pc-linux-gnu</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">checking target system type... x86_64-pc-linux-gnu</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">configure: </span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">configure: Configuring Apache Portable Runtime library...</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">configure: </span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">checking for</span> <span style="color:#df402a;background-color:rgb(197,217,242);"> APR... no</span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 此处报错,没有APR,开始排错</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">configure: error: APR not found. Please read the documentation.</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon httpd-2.4.33]# </span> <span style="color:#df402a;background-color:rgb(197,217,242);">echo \)?
验证配置报错
1
由于httpd依赖apr和apr-util两个通用函数库,这样httpd就能不依赖平台可自由移植
[root@bogon src]#
wget
https://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz
下载最新的apr
–2018-04-19 20:57:57– https://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz
正在解析主机 mirrors.cnnic.cn (mirrors.cnnic.cn)… 101.6.8.193, 2402:f000:1:408:8100::1
正在连接 mirrors.cnnic.cn (mirrors.cnnic.cn)|101.6.8.193|:443… 已连接。
已发出 HTTP 请求,正在等待回应… 200 OK
长度: (1.0M) [application/octet-stream]
正在保存至: “apr-1.6.3.tar.gz”
100%[====================================================================>] 1,072,661 1.69MB/s 用时 0.6s
2018-04-19 20:57:59 (1.69 MB/s) - 已保存 “apr-1.6.3.tar.gz” [⁄])
[root@bogon src]#
wget https://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gz
下载最新apr-util
–2018-04-19 20:58:37– https://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gz
正在解析主机 mirrors.cnnic.cn (mirrors.cnnic.cn)… 101.6.8.193, 2402:f000:1:408:8100::1
正在连接 mirrors.cnnic.cn (mirrors.cnnic.cn)|101.6.8.193|:443… 已连接。
已发出 HTTP 请求,正在等待回应… 200 OK
长度: (541K) [application/octet-stream]
正在保存至: “apr-util-1.6.1.tar.gz”
100%[====================================================================>] 554,301 1.26MB/s 用时 0.4s
2018-04-19 20:58:38 (1.26 MB/s) - 已保存 “apr-util-1.6.1.tar.gz” [⁄])
[root@bogon src]# ls
apr-1.6.3.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.33 httpd-2.4.33.tar.gz
[root@bogon src]#
tar -zxvf apr-1.6.3.tar.gz
解压apr
省略
[root@bogon src]#
cd apr-1.6.3
[root@bogon apr-1.6.3]#
https://blog.csdn.net/langyue919/article/details/configure –prefix=/usr/local/apr
配置安装环境,生成make文件
checking build system type… x86_64-pc-linux-gnu
checking host system type… x86_64-pc-linux-gnu
checking target system type… x86_64-pc-linux-gnu
Configuring APR library
Platform: x86_64-pc-linux-gnu
checking for working mkdir -p… yes
APR Version: 1.6.3
checking for chosen layout… apr
checking for gcc… no
报错,缺少gcc
checking for cc… no
checking for cl.exe… no
configure: error: in `/usr/local/src/apr-1.6.3‘:
configure: error: no acceptable C compiler found in \(PATH</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">See `config.log' for more details</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon apr-1.6.3]# </span> <span style="color:#df402a;background-color:rgb(197,217,242);">yum install -y gcc </span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 安装gcc</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">~</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">~</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">省略 </span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon apr-1.6.3]#</span> <span style="color:#df402a;background-color:rgb(197,217,242);"> https://blog.csdn.net/langyue919/article/details/configure --prefix=/usr/local/apr</span> <span style="background-color:rgb(197,217,242);"> </span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 再次配置安装环境,生成</span> <span style="color:#df402a;background-color:rgb(144,167,209);">apr</span> <span style="color:#df402a;background-color:rgb(255,255,255);">的make文件</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">~</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">~</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">省略</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon apr-1.6.3]# </span> <span style="color:#df402a;background-color:rgb(197,217,242);">echo \)?
验证配置
0
配置正确
[root@bogon apr-1.6.3]#
make
编译
省略
[root@bogon apr-1.6.3]#
echo \(? </span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 验证编译</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="color:#df402a;background-color:rgb(197,217,242);">0 </span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 编译正确</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon apr-1.6.3]# </span> <span style="color:#df402a;background-color:rgb(197,217,242);">make install</span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 安装</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon apr-1.6.3]#</span> <span style="color:#df402a;background-color:rgb(197,217,242);"> echo \)?
验证安装
0
安装正确
[root@bogon apr-1.6.3]# cd ..
[root@bogon src]#
tar -zxvf apr-util-1.6.1.tar.gz
[root@bogon src]# ls
apr-1.6.3.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.33.tar.gz
apr-1.6.3 apr-util-1.6.1 httpd-2.4.33
三个解压过的源码包目录
[root@bogon src]#
[root@bogon src]#
cd apr-util-1.6.1
进入apr-util,开始安装
[root@bogon apr-util-1.6.1]#
https://blog.csdn.net/langyue919/article/details/configure –prefix=/usr/local/apr-util
–with-apr=/usr/local/apr
配置apr-util的安装环境,生成make文件
省略
[root@bogon apr-util-1.6.1]#
echo \(? </span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 验证配置</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="color:#df402a;background-color:rgb(197,217,242);">0</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon apr-util-1.6.1]# </span> <span style="color:#df402a;background-color:rgb(197,217,242);">make</span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 编译</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">~</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">~</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">省略</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon apr-util-1.6.1]# </span> <span style="color:#df402a;background-color:rgb(197,217,242);">echo \)?
验证编译
0
[root@bogon apr-util-1.6.1]#
make install
安装
省略
[root@bogon apr-util-1.6.1]#
echo \(? </span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 验证安装</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="color:#df402a;background-color:rgb(197,217,242);">0</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon src]#</span> <span style="color:#df402a;background-color:rgb(197,217,242);"> cd httpd-2.4.33</span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 进入httpd,开始安装</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon httpd-2.4.33]#</span> <span style="color:#df402a;background-color:rgb(197,217,242);"> https://blog.csdn.net/langyue919/article/details/configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util </span> <span style="color:#df402a;background-color:rgb(255,255,255);"> <br /> 配置环境,生成make文件</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">~</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">~</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">省略</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon apr-util-1.6.1]#</span> <span style="color:#df402a;background-color:rgb(197,217,242);"> echo \)?
0
验证配置
[root@bogon apr-util-1.6.1]#
make
编译
省略
[root@bogon apr-util-1.6.1]#
echo \(? </span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 验证编译</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="color:#df402a;background-color:rgb(197,217,242);">0</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon apr-util-1.6.1]# </span> <span style="color:#df402a;background-color:rgb(197,217,242);">make install </span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 安装</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">~</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">~</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">省略</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="color:#df402a;background-color:rgb(197,217,242);">configure: summary of build options:</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <br /> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="color:#df402a;background-color:rgb(197,217,242);"> Server Version: 2.4.33</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="color:#df402a;background-color:rgb(197,217,242);"> Install prefix: /usr/local/apache2</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="color:#df402a;background-color:rgb(197,217,242);"> C compiler: gcc -std=gnu99</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="color:#df402a;background-color:rgb(197,217,242);"> CFLAGS: -g -O2 -pthread </span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="color:#df402a;background-color:rgb(197,217,242);"> CPPFLAGS: -DLINUX -D_REENTRANT -D_GNU_SOURCE </span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="color:#df402a;background-color:rgb(197,217,242);"> LDFLAGS: </span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="color:#df402a;background-color:rgb(197,217,242);"> LIBS: </span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="color:#df402a;background-color:rgb(197,217,242);"> C preprocessor: gcc -E</span> <span style="color:#df402a;background-color:rgb(255,255,255);"> 安装成功</span> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <br /> </div> <div style="white-space:pre-wrap;text-align:left;line-height:1.75;font-size:14px;"> <span style="background-color:rgb(197,217,242);">[root@bogon httpd-2.4.33]# </span> <span style="color:#df402a;background-color:rgb(197,217,242);">echo \)?
验证安装
0
yum搭建本地仓库
mount /dev/cdrom /mnt 挂载镜像到/mnt目录
cp -r /etc/yum.repos.d /etc/yum.repos.d.bak 备份原来的配置文件
rm -f /etc/yum.repos.d/* 删除原来的配置文件
vim /etc/yum.repos.d/dvd.repo 新建仓库配置文件
插入如下内容:
[dvd]
name=install dvd
baseurl=file:///mnt
enabled=1
gpgcheck=1
0表示不检查,1表示检查
保存退出
yum clean all 或 yum makecache 清理所有缓存
yum list 查看可装可更新的包文件,
仓库名已变为dvd
例:
[root@bogon Packages]# cp -r /etc/yum.repos.d /etc/yum.repos.d.bak
备份原来的配置文件
[root@bogon Packages]# rm -f /etc/yum.repos.d/*
删除所有原来的配置文件
[root@bogon Packages]# vim /etc/yum.repos.d/dvd.repo
新建dvd.repo配置文件
[dvd]
写入内容并保存退出
name=install dvd
baseurl=file:///mnt
enabled=1
gpgcheck=0
~
~
– 插入 – 5,11 全部
[root@bogon Packages]#
yum clean all
清除所有缓存
已加载插件:fastestmirror
正在清理软件源: dvd
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@bogon Packages]#
[root@bogon Packages]#
yum list |tail
列出后10个可装可更新的包
ypserv.x86_64 2.31-10.el7
dvd
新的软件源已生效,仓库名为dvd
yum-langpacks.noarch 0.4.2-7.el7
dvd
yum-plugin-aliases.noarch 1.1.31-42.el7
dvd
yum-plugin-changelog.noarch 1.1.31-42.el7 dvd
yum-plugin-tmprepo.noarch 1.1.31-42.el7 dvd
yum-plugin-verify.noarch 1.1.31-42.el7 dvd
yum-plugin-versionlock.noarch 1.1.31-42.el7 dvd
zlib-devel.x86_64 1.2.7-17.el7 dvd
zsh.x86_64 5.0.2-28.el7 dvd
zziplib.x86_64 0.13.62-5.el7 dvd
[root@bogon Packages]#
yum更换国内源
cd /etc/yum.repos.d/
rm -f dvd.repo
wget
http://mirrors.163.com/.help/CentOS7-Base-163.repo
或curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo
yum list
例:
[root@bogon httpd-2.4.33]#
cd /etc/yum.repos.d/
[root@bogon yum.repos.d]#
ls
dvd.repo
[root@bogon yum.repos.d]#
rm dvd.repo
rm:是否删除普通文件 “dvd.repo”?
y
[root@bogon yum.repos.d]#
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
–2018-04-20 00:23:35– http://mirrors.163.com/.help/CentOS7-Base-163.repo
正在解析主机 mirrors.163.com (mirrors.163.com)… 59.111.0.251
正在连接 mirrors.163.com (mirrors.163.com)|59.111.0.251|:80… 已连接。
已发出 HTTP 请求,正在等待回应… 200 OK
长度:1572 (1.5K) [application/octet-stream]
正在保存至: “CentOS7-Base-163.repo”
100%[====================================================================>] 1,572 –.-K/s 用时 0s
2018-04-20 00:23:35 (188 MB/s) -
已保存 “CentOS7-Base-163.repo” [1572⁄1572])
[root@bogon yum.repos.d]#
yum list |tail
列出后10个可装可更新包,仓库名已从dvd变为base
zlib-devel.x86_64 1.2.7-17.el7
base
zlib-static.i686 1.2.7-17.el7
base
zlib-static.x86_64 1.2.7-17.el7 base
zsh.x86_64 5.0.2-28.el7 base
zsh-html.x86_64 5.0.2-28.el7 base
zziplib.i686 0.13.62-5.el7 base
zziplib.x86_64 0.13.62-5.el7 base
zziplib-devel.i686 0.13.62-5.el7 base
zziplib-devel.x86_64 0.13.62-5.el7 base
zziplib-utils.x86_64 0.13.62-5.el7 base
[root@bogon yum.repos.d]#
安装扩展源epel
yum install -y epel-release 安装扩展仓库
yum list |grep epel 列出并过滤epel仓库的可装可更新包
例:
[root@bogon yum.repos.d]#
yum install -y epel-release
已加载插件:fastestmirror
省略
完毕!
[root@bogon yum.repos.d]# cd /etc/yum.repos.d
[root@bogon yum.repos.d]# ls
CentOS7-Base-163.repo
epel.repo epel-testing.repo
安装了两个配置文件
[root@bogon yum.repos.d]#
yum list |grep epel |tail
zsh-lovers.noarch 0.9.0-1.el7 epel
zstd.x86_64 1.3.4-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
[root@bogon yum.repos.d]#
yum下载rpm包
yum -y install 包名 –downloadonly 仅下载
ls /var/cache/yum/x86_64/7/base/packages/ 查看下载的包
yum install -y 包名 –downloadonly –downloaddir=/
/ 仅下载,且指定下载位置
yum reinstall -y 包名 –downloadonly –downloaddir=//
用于已安装包的仅下载
例:
[root@bogon ~]#
yum install -y zlib-static –downloadonly
仅下载此包
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* epel: mirrors.ustc.edu.cn
正在解决依赖关系
–> 正在检查事务
—> 软件包 zlib-static.x86_64.0.1.2.7-17.el7 将被 安装
–> 正在处理依赖关系 zlib-devel = 1.2.7-17.el7,它被软件包 zlib-static-1.2.7-17.el7.x86_64 需要
–> 正在检查事务
—> 软件包 zlib-devel.x86_64.0.1.2.7-17.el7 将被 安装
–> 解决依赖关系完成
依赖关系解决
==============================================================================================================
Package 架构 版本 源 大小
==============================================================================================================
正在安装:
zlib-static x86_64 1.2.7-17.el7 base 58 k
为依赖而安装:
zlib-devel x86_64 1.2.7-17.el7 base 50 k
事务概要
==============================================================================================================
安装 1 软件包 (+1 依赖软件包)
总下载量:108 k
安装大小:254 k
Background downloading packages, then exiting:
(1⁄2): zlib-static-1.2.7-17.el7.x86_64.rpm | 58 kB 00:00:00
(2⁄2): zlib-devel-1.2.7-17.el7.x86_64.rpm | 50 kB 00:00:00
————————————————————————————————————–
总计 276 kB/s | 108 kB 00:00:00
exiting because “Download Only” specified
[root@bogon ~]#
ls /var/cache/yum/x86_64/7/base/packages/
查看已下载的包,依赖关系包也被下载了
zlib-devel-1.2.7-17.el7.x86_64.rpm
zlib-static-1.2.7-17.el7.x86_64.rpm
[root@bogon ~]#
yum install zstd –downloadonly –downloaddir=/home/
指定下载,指定位置
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* epel: mirrors.ustc.edu.cn
正在解决依赖关系
–> 正在检查事务
—> 软件包 zstd.x86_64.0.1.3.4-1.el7 将被 安装
–> 解决依赖关系完成
依赖关系解决
==============================================================================================================
Package 架构 版本 源 大小
==============================================================================================================
正在安装:
zstd x86_64 1.3.4-1.el7 epel 308 k
事务概要
==============================================================================================================
安装 1 软件包
总下载量:308 k
安装大小:1.1 M
Background downloading packages, then exiting:
exiting because “Download Only” specified
[root@bogon ~]#
ls /home 查看下载的包
AA BB CC DD ELON
zstd-1.3.4-1.el7.x86_64.rpm
在指定下载的位置查找到下载的包
[root@bogon ~]#
yum install vim –downloadonly –downloaddir=/home/
仅下载并指定下载位置
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* epel: mirrors.ustc.edu.cn
软件包 2:vim-enhanced-7.4.160-2.el7.x86_64 已安装并且是最新版本
已安装的包,下载不成功
无须任何处理
[root@bogon ~]#
yum
reinstall
vim –downloadonly –downloaddir=/home/
用reinstall下载已安装包
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* epel: mirrors.ustc.edu.cn
正在解决依赖关系
–> 正在检查事务
—> 软件包 vim-enhanced.x86_64.2.7.4.160-2.el7 将被 已重新安装
–> 解决依赖关系完成
依赖关系解决
==============================================================================================================
Package 架构 版本 源 大小
==============================================================================================================
重新安装:
vim-enhanced x86_64 2:7.4.160-2.el7 base 1.0 M
事务概要
==============================================================================================================
重新安装 1 软件包
总下载量:1.0 M
安装大小:2.2 M
Background downloading packages, then exiting:
vim-enhanced-7.4.160-2.el7.x86_64.rpm | 1.0 MB 00:00:00
exiting because “Download Only” specified
[[root@bogon ~]#
ls /home
查看,下载成功
AA BB CC DD ELON
vim-enhanced-7.4.160-2.el7.x86_64.rpm
zstd-1.3.4-1.el7.x86_64.rpm
[root@bogon ~]#

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/170257.html