赞
踩
- [root@localhost yum.repos.d]# rm dvd.repo
- rm:是否删除普通文件 "dvd.repo"?y
- [root@localhost yum.repos.d]# cp -r /etc/yum.repos.d.bak/* ./
- [root@localhost yum.repos.d]# ls
- CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
- CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo
-
[root@linux-128 yum.repos.d]# mv CentOS-Base.repo Centos-Base.repo.bak
- [root@localhost yum.repos.d]# curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo
- % Total % Received % Xferd Average Speed Time Time Time Current
- Dload Upload Total Spent Left Speed
- 100 1572 100 1572 0 0 7651 0 --:--:-- --:--:-- --:--:-- 7820
-
- [root@localhost yum.repos.d]# ls
- CentOS7-Base-163.repo CentOS-Debuginfo.repo CentOS-Sources.repo
- CentOS-Base.repo.bak CentOS-fasttrack.repo CentOS-Vault.repo
- CentOS-CR.repo CentOS-Media.repo
-
[root@localhost yum.repos.d]# vim CentOS7-Base-163.repo
- [root@localhost yum.repos.d]# yum clean all
- 已加载插件:fastestmirror
- 正在清理软件源: base extras updates
- Cleaning up everything
- Cleaning up list of fastest mirrors
-
- [root@localhost yum.repos.d]# yum install -y zsh
- 已加载插件:fastestmirror
- Loading mirror speeds from cached hostfile
- 正在解决依赖关系
- --> 正在检查事务
- ---> 软件包 zsh.x86_64.0.5.0.2-28.el7 将被 安装
- --> 解决依赖关系完成
-
- 依赖关系解决
-
- =================================================================================
- Package 架构 版本 源 大小
- =================================================================================
- 正在安装:
- zsh x86_64 5.0.2-28.el7 base 2.4 M
-
- 事务概要
- =================================================================================
- 安装 1 软件包
-
- 总下载量:2.4 M
- 安装大小:5.6 M
- Downloading packages:
- zsh-5.0.2-28.el7.x86_64.rpm | 2.4 MB 00:00:02
- Running transaction check
- Running transaction test
- Transaction test succeeded
- Running transaction
- 正在安装 : zsh-5.0.2-28.el7.x86_64 1/1
- 验证中 : zsh-5.0.2-28.el7.x86_64 1/1
-
- 已安装:
- zsh.x86_64 0:5.0.2-28.el7
-
- 完毕!
-
- [root@localhost yum.repos.d]# yum list |grep epel|head -15
- * epel: ftp.cuhk.edu.hk
- epel-release.noarch 7-9 @extras
- 0ad.x86_64 0.0.22-1.el7 epel
- 0ad-data.noarch 0.0.22-1.el7 epel
- 0install.x86_64 2.11-1.el7 epel
- 2048-cli.x86_64 0.9.1-1.el7 epel
- 2048-cli-nocurses.x86_64 0.9.1-1.el7 epel
- 2ping.noarch 3.2.1-2.el7 epel
- 389-admin.x86_64 1.1.46-1.el7 epel
- 389-admin-console.noarch 1.1.12-1.el7 epel
- 389-admin-console-doc.noarch 1.1.12-1.el7 epel
- 389-adminutil.x86_64 1.1.21-2.el7 epel
- 389-adminutil-devel.x86_64 1.1.21-2.el7 epel
- 389-console.noarch 1.1.18-1.el7 epel
- 389-ds.noarch 1.2.2-6.el7 epel
-
有时候我们需要下载rpm包,而仅仅是复制给其他机器使用,yum工具安装rpm包时,首先下载这个rpm包,然后再去安装,所以我们可以做到只下载而不安装。
- [root@localhost yum.repos.d]# yum install -y 2ping.noarch --downloadonly
- 已加载插件:fastestmirror
- Loading mirror speeds from cached hostfile
- * epel: ftp.cuhk.edu.hk
- 正在解决依赖关系
- --> 正在检查事务
- ---> 软件包 2ping.noarch.0.3.2.1-2.el7 将被 安装
- --> 解决依赖关系完成
-
- 依赖关系解决
-
- =================================================================================
- Package 架构 版本 源 大小
- =================================================================================
- 正在安装:
- 2ping noarch 3.2.1-2.el7 epel 62 k
-
- 事务概要
- =================================================================================
- 安装 1 软件包
-
- 总下载量:62 k
- 安装大小:204 k
- Background downloading packages, then exiting:
- 警告:/var/cache/yum/x86_64/7/epel/packages/2ping-3.2.1-2.el7.noarch.rpm.2289.tmp: 头V3 RSA/SHA256 Signature, 密钥 ID 352c64e5: NOKEY
- 2ping-3.2.1-2.el7.noarch.rpm.2289.tmp 的公钥尚未安装
- 2ping-3.2.1-2.el7.noarch.rpm | 62 kB 00:00:01
- exiting because "Download Only" specified
-
yum默认下载到/var/cache/yum/x86_64/7/XXX/packages/ 下面;这里的XXX指的是base,updates,epel等,它跟yum list最右侧的字符串一致。
- [root@localhost yum.repos.d]# ls /var/cache/yum/x86_64/7/epel/packages/
- 2ping-3.2.1-2.el7.noarch.rpm zmap-2.1.1-1.el7.x86_64.rpm
- hiredis-0.12.1-1.el7.x86_64.rpm
- [root@localhost yum.repos.d]# yum install -y zmap --downloadonly --downloaddir=/tmp/
- 已加载插件:fastestmirror
- Loading mirror speeds from cached hostfile
- * epel: ftp.cuhk.edu.hk
- 正在解决依赖关系
- --> 正在检查事务
- ---> 软件包 zmap.x86_64.0.2.1.1-1.el7 将被 安装
- --> 正在处理依赖关系 libhiredis.so.0.12()(64bit),它被软件包 zmap-2.1.1-1.el7.x86_64 需要
- --> 正在检查事务
- ---> 软件包 hiredis.x86_64.0.0.12.1-1.el7 将被 安装
- --> 解决依赖关系完成
-
- 依赖关系解决
-
- ================================================================================================
- Package 架构 版本 源 大小
- ================================================================================================
- 正在安装:
- zmap x86_64 2.1.1-1.el7 epel 124 k
- 为依赖而安装:
- hiredis x86_64 0.12.1-1.el7 epel 29 k
-
- 事务概要
- ================================================================================================
- 安装 1 软件包 (+1 依赖软件包)
-
- 总下载量:154 k
- 安装大小:378 k
- Background downloading packages, then exiting:
- exiting because "Download Only" specified
- [root@linux-128 yum.repos.d]# ls /tmp
- 1.txt.bz2
- 1.txt.gz
- 1.txt.xz
- 222
- hiredis-0.12.1-1.el7.x86_64.rpm
- systemd-private-7d28b5738df345b0bb18e85cef932021-vmtoolsd.service-43orfA
- test
- yum_save_tx.2017-11-14.23-50.Av9TET.yumtx
- yum_save_tx.2017-11-14.23-50.ClMWHy.yumtx
- yum_save_tx.2017-11-14.23-56.v0Q9N8.yumtx
- zmap-2.1.1-1.el7.x86_64.rpm
-
如果已经安装过的包使用—downloadnoly就不起作用了,他会提示这个包已经安装过了,根本下载不下来:
- [root@localhost yum.repos.d]# yum install -y tree --downloadonly --downloaddir=/tmp/
- 已加载插件:fastestmirror
- Loading mirror speeds from cached hostfile
- * epel: ftp.cuhk.edu.hk
- 软件包 tree-1.6.0-10.el7.x86_64 已安装并且是最新版本
- 无须任何处理
-
- [root@localhost yum.repos.d]# yum reinstall -y tree --downloadonly --downloaddir=/tmp/
- 已加载插件:fastestmirror
- Loading mirror speeds from cached hostfile
- * epel: ftp.cuhk.edu.hk
- 正在解决依赖关系
- --> 正在检查事务
- ---> 软件包 tree.x86_64.0.1.6.0-10.el7 将被 已重新安装
- --> 解决依赖关系完成
-
- 依赖关系解决
-
- ================================================================================================
- Package 架构 版本 源 大小
- ================================================================================================
- 重新安装:
- tree x86_64 1.6.0-10.el7 base 46 k
-
- 事务概要
- ================================================================================================
- 重新安装 1 软件包
-
- 总下载量:46 k
- 安装大小:87 k
- Background downloading packages, then exiting:
- tree-1.6.0-10.el7.x86_64.rpm | 46 kB 00:00:00
- exiting because "Download Only" specified
- [root@linux-128 yum.repos.d]# ls /tmp/
- 1.txt.bz2
- 1.txt.gz
- 1.txt.xz
- 222
- hiredis-0.12.1-1.el7.x86_64.rpm
- systemd-private-7d28b5738df345b0bb18e85cef932021-vmtoolsd.service-43orfA
- test
- tree-1.6.0-10.el7.x86_64.rpm
-
解包后,我们开始安装前要查看 INSTALL ;REDME 两个安装指导文件,查看怎么安装, 安装源码包通常有3个步骤:
./configure //这一步可以定制功能,./configure --prefix=/usr/local/apache2 定义安装目录
make //编译成电脑识别的二进制文件
make install //用于创建相关软件的存放目录和配置文件
- [root@localhost yum.repos.d]# cd /usr/local/src/
- [root@linux-128 src]# wget https://mirrors.cnnic.cn/apache/httpd/httpd-2.2.34.tar.gz
- --2017-11-15 00:26:41-- https://mirrors.cnnic.cn/apache/httpd/httpd-2.2.34.tar.gz
- 正在解析主机 mirrors.cnnic.cn (mirrors.cnnic.cn)... 101.6.6.177, 2402:f000:1:416:101:6:6:177
- 正在连接 mirrors.cnnic.cn (mirrors.cnnic.cn)|101.6.6.177|:443... 已连接。
- 已发出 HTTP 请求,正在等待回应... 200 OK
- 长度:7684419 (7.3M) [application/octet-stream]
- 正在保存至: “httpd-2.2.34.tar.gz”
-
- 100%[======================================================>] 7,684,419 1.20MB/s 用时 7.3s
-
- 2017-11-15 00:26:49 (1.00 MB/s) - 已保存 “httpd-2.2.34.tar.gz” [7684419/7684419])
-
- [root@localhost src]# ls
- httpd-2.2.34.tar.gz
-
注意:将源码包移动到/usr/local/src 下;约定,将源码包都放在这个文件下
- [root@localhost httpd-2.2.34]# tar -zxvf httpd-2.2.34.tar.gz
- [root@linux-128 src]# ls
- httpd-2.2.34 httpd-2.2.34.tar.gz
- [root@linux-128 src]# cd httpd-2.2.34
- [root@linux-128 httpd-2.2.34]# ls
- ABOUT_APACHE CHANGES httpd.dsp libhttpd.dep NOTICE server
- acinclude.m4 config.layout httpd.mak libhttpd.dsp NWGNUmakefile srclib
- Apache.dsw configure httpd.spec libhttpd.mak os support
- build configure.in include LICENSE README test
- BuildAll.dsp docs INSTALL Makefile.in README.platforms VERSIONING
- BuildBin.dsp emacs-style InstallBin.dsp Makefile.win README-win32.txt
- buildconf httpd.dep LAYOUT modules ROADMAP
-
- [root@localhost httpd-2.2.34]# ./configure --prefix=/usr/local/apache2
- checking for chosen layout... Apache
- checking for working mkdir -p... yes
- checking build system type... x86_64-unknown-linux-gnu
- checking host system type... x86_64-unknown-linux-gnu
- checking target system type... x86_64-unknown-linux-gnu
-
- Configuring Apache Portable Runtime library ...
-
- checking for APR... reconfig
- configuring package in srclib/apr now
- checking build system type... x86_64-unknown-linux-gnu
- checking host system type... x86_64-unknown-linux-gnu
- checking target system type... x86_64-unknown-linux-gnu
- Configuring APR library
- Platform: x86_64-unknown-linux-gnu
- checking for working mkdir -p... yes
- APR Version: 1.5.2
- checking for chosen layout... apr
- checking for gcc... no
- checking for cc... no
- checking for cl.exe... no
- configure: error: in `/usr/local/src/httpd-2.2.34/srclib/apr':
- configure: error: no acceptable C compiler found in $PATH
- See `config.log' for more details
- configure failed for srclib/apr
-
注意: checking for gcc... no;没有安装gcc编译器
- [root@localhost httpd-2.2.34]# yum install -y gcc
- [root@localhost httpd-2.2.34]# ./configure --prefix=/usr/local/apache2
-
- [root@localhost httpd-2.2.34]# echo $?
- 0
-
- [root@localhost httpd-2.2.34]# make
-
- [root@localhost httpd-2.2.34]# echo $?
- 0
-
[root@localhost httpd-2.2.34]# make install
- [root@localhost httpd-2.2.34]# echo $?
- 0
-
查看apache2目录
- [root@localhost httpd-2.2.34]# ls /usr/local/apache2/
- bin build cgi-bin conf error htdocs icons include lib logs man manual modules
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。