7.6 yum更换国内源 7.7 yum下载rpm包 7.8/7.9 源码包安装
2018-06-27 17:48
731 查看
7.6.yum更换国内源
自定义yum源:
其镜像文件地址更换为:“baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/”。
7.7 yum下载rpm包
先恢复之前的yum源。
下载RPM包而不安装的命令如下所示:
下载到指定目录命令如下所示:
下载RPM包到/usr/local/src/目录下。
如果包已经安装了,使用以下命令:
7.8/7.9 安装源码包
安装gcc编译器
安装源码包通常需要以下3个步骤。
.configure。这一步可以定制功能,加上相应的选项即可。可以通过./configure --help来查看。这一步会自动检测你的linux系统与相关的套件是否有编译改源码包时所需要的库,因为一旦缺少某个库,就不能完成编译了。只有通过检测后,才会生成Makefile文件。
make。会根据Makefile文件中预设的参数进行编译,这一步就是gcc在工作了。
make install。这一步是安装步骤,用于创建相关软件的存放目录和配置文件。
下载源码包
先切换到 cd /usr/local/src/目录
解压源码包
tar -zxvf httpd-2.4.33.tar.gz
配置相关的选项并生成
进入解压后的源码目录,查看可用的配置参数。
cd httpd-2.4.33
./configure --help |less
--prefix=PREFIX,定义软件包的安装路径
--prefix=/usr/local/ apache2 把Apache安装在/usr/local/apache2目录下。
返回值是0,说明成功。成功生成Makefile。
生成Makefile后,需要进行编译。
make
输入echo $? 查看结果为0,进行下一步。
安装
make install
ls命令查看该目录。
自定义yum源:
[root@bogon ~]# cd /etc/yum.repos.d [root@bogon 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@bogon yum.repos.d]# rm -f CentOS-Base.repo [root@bogon yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo --2018-06-27 17:41:45-- 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-06-27 17:41:45 (46.7 MB/s) - 已保存 “CentOS7-Base-163.repo” [1572/1572]) [root@bogon yum.repos.d]# ls CentOS7-Base-163.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo
[root@bogon yum.repos.d]# vim CentOS7-Base-163.repo # CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 "CentOS7-Base-163.repo" 41L, 1572C
其镜像文件地址更换为:“baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/”。
7.7 yum下载rpm包
先恢复之前的yum源。
[root@bogon ~]# rm -rf /etc/yum.repos.d
[root@bogon ~]# mv /etc/yum.repos.d_bak /etc/yum.repos.d
yum list
下载RPM包而不安装的命令如下所示:
yum install 包名 -y --downloadonly
下载到指定目录命令如下所示:
[root@bogon ~]# yum install 包名 -y --downloadonly --downloaddir=/usr/local/src
下载RPM包到/usr/local/src/目录下。
[root@bogon ~]# yum install -y ypbind --downloadonly --downloaddir=/usr/local/src 已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.njupt.edu.cn * updates: mirrors.163.com base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 正在解决依赖关系 --> 正在检查事务 ---> 软件包 ypbind.x86_64.3.1.37.1-9.el7 将被 安装 --> 正在处理依赖关系 yp-tools,它被软件包 3:ypbind-1.37.1-9.el7.x86_64 需要 --> 正在检查事务 ---> 软件包 yp-tools.x86_64.0.2.14-5.el7 将被 安装 --> 解决依赖关系完成 依赖关系解决 =============================================================================================================================================================================================== Package 架构 版本 源 大小 =============================================================================================================================================================================================== 正在安装: ypbind x86_64 3:1.37.1-9.el7 base 62 k 为依赖而安装: yp-tools x86_64 2.14-5.el7 base 79 k 事务概要 =============================================================================================================================================================================================== 安装 1 软件包 (+1 依赖软件包) 总下载量:142 k 安装大小:299 k Background downloading packages, then exiting: (1/2): yp-tools-2.14-5.el7.x86_64.rpm | 79 kB 00:00:00 (2/2): ypbind-1.37.1-9.el7.x86_64.rpm | 62 kB 00:00:01 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 总计 83 kB/s | 142 kB 00:00:01 exiting because "Download Only" specified
如果包已经安装了,使用以下命令:
[root@bogon ~]# yum reinstall -y bash --downloadonly 已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.njupt.edu.cn * updates: mirrors.163.com 正在解决依赖关系 --> 正在检查事务 ---> 软件包 bash.x86_64.0.4.2.46-30.el7 将被 已重新安装 --> 解决依赖关系完成 依赖关系解决 =============================================================================================================================================================================================== Package 架构 版本 源 大小 =============================================================================================================================================================================================== 重新安装: bash x86_64 4.2.46-30.el7 base 1.0 M 事务概要 =============================================================================================================================================================================================== 重新安装 1 软件包 总下载量:1.0 M 安装大小:3.5 M Background downloading packages, then exiting: bash-4.2.46-30.el7.x86_64.rpm | 1.0 MB 00:00:02 exiting because "Download Only" specified
7.8/7.9 安装源码包
安装gcc编译器
[root@bogon ~]# yum install -y gcc 已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.njupt.edu.cn * updates: mirrors.163.com 正在解决依赖关系 --> 正在检查事务 ---> 软件包 gcc.x86_64.0.4.8.5-28.el7_5.1 将被 安装 --> 正在处理依赖关系 libgomp = 4.8.5-28.el7_5.1,它被软件包 gcc-4.8.5-28.el7_5.1.x86_64 需要 --> 正在处理依赖关系 cpp = 4.8.5-28.el7_5.1,它被软件包 gcc-4.8.5-28.el7_5.1.x86_64 需要 --> 正在处理依赖关系 libgcc >= 4.8.5-28.el7_5.1,它被软件包 gcc-4.8.5-28.el7_5.1.x86_64 需要 --> 正在处理依赖关系 glibc-devel >= 2.2.90-12,它被软件包 gcc-4.8.5-28.el7_5.1.x86_64 需要 --> 正在处理依赖关系 libmpc.so.3()(64bit),它被软件包 gcc-4.8.5-28.el7_5.1.x86_64 需要 --> 正在检查事务 ---> 软件包 cpp.x86_64.0.4.8.5-28.el7_5.1 将被 安装 ---> 软件包 glibc-devel.x86_64.0.2.17-222.el7 将被 安装 --> 正在处理依赖关系 glibc-headers = 2.17-222.el7,它被软件包 glibc-devel-2.17-222.el7.x86_64 需要 --> 正在处理依赖关系 glibc-headers,它被软件包 glibc-devel-2.17-222.el7.x86_64 需要 ---> 软件包 libgcc.x86_64.0.4.8.5-28.el7 将被 升级 ---> 软件包 libgcc.x86_64.0.4.8.5-28.el7_5.1 将被 更新 ---> 软件包 libgomp.x86_64.0.4.8.5-28.el7 将被 升级 ---> 软件包 libgomp.x86_64.0.4.8.5-28.el7_5.1 将被 更新 ---> 软件包 libmpc.x86_64.0.1.0.1-3.el7 将被 安装 --> 正在检查事务 ---> 软件包 glibc-headers.x86_64.0.2.17-222.el7 将被 安装 --> 正在处理依赖关系 kernel-headers >= 2.2.1,它被软件包 glibc-headers-2.17-222.el7.x86_64 需要 --> 正在处理依赖关系 kernel-headers,它被软件包 glibc-headers-2.17-222.el7.x86_64 需要 --> 正在检查事务 ---> 软件包 kernel-headers.x86_64.0.3.10.0-862.3.3.el7 将被 安装 --> 解决依赖关系完成 依赖关系解决 =============================================================================================================================================================================================== Package 架构 版本 源 大小 =============================================================================================================================================================================================== 正在安装: gcc x86_64 4.8.5-28.el7_5.1 updates 16 M 为依赖而安装: cpp x86_64 4.8.5-28.el7_5.1 updates 5.9 M glibc-devel x86_64 2.17-222.el7 base 1.1 M glibc-headers x86_64 2.17-222.el7 base 678 k kernel-headers x86_64 3.10.0-862.3.3.el7 updates 7.1 M libmpc x86_64 1.0.1-3.el7 base 51 k 为依赖而更新: libgcc x86_64 4.8.5-28.el7_5.1 updates 101 k libgomp x86_64 4.8.5-28.el7_5.1 updates 156 k 事务概要 =============================================================================================================================================================================================== 安装 1 软件包 (+5 依赖软件包) 升级 ( 2 依赖软件包) 总下载量:31 M Downloading packages: Not downloading deltainfo for upd 3ff0 ates, MD is 259 k and rpms are 257 k (1/8): glibc-headers-2.17-222.el7.x86_64.rpm | 678 kB 00:00:11 (2/8): libgcc-4.8.5-28.el7_5.1.x86_64.rpm | 101 kB 00:00:00 (3/8): libgomp-4.8.5-28.el7_5.1.x86_64.rpm | 156 kB 00:00:05 (4/8): libmpc-1.0.1-3.el7.x86_64.rpm | 51 kB 00:00:00 (5/8): kernel-headers-3.10.0-862.3.3.el7.x86_64.rpm | 7.1 MB 00:00:26 (6/8): glibc-devel-2.17-222.el7.x86_64.rpm | 1.1 MB 00:00:39 (7/8): cpp-4.8.5-28.el7_5.1.x86_64.rpm | 5.9 MB 00:00:45 (8/8): gcc-4.8.5-28.el7_5.1.x86_64.rpm | 16 MB 00:01:29 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 总计 357 kB/s | 31 MB 00:01:29 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安装 : libmpc-1.0.1-3.el7.x86_64 1/10 正在安装 : cpp-4.8.5-28.el7_5.1.x86_64 2/10 正在更新 : libgcc-4.8.5-28.el7_5.1.x86_64 3/10 正在安装 : kernel-headers-3.10.0-862.3.3.el7.x86_64 4/10 正在安装 : glibc-headers-2.17-222.el7.x86_64 5/10 正在安装 : glibc-devel-2.17-222.el7.x86_64 6/10 正在更新 : libgomp-4.8.5-28.el7_5.1.x86_64 7/10 正在安装 : gcc-4.8.5-28.el7_5.1.x86_64 8/10 清理 : libgcc-4.8.5-28.el7.x86_64 9/10 清理 : libgomp-4.8.5-28.el7.x86_64 10/10 验证中 : libgomp-4.8.5-28.el7_5.1.x86_64 1/10 验证中 : kernel-headers-3.10.0-862.3.3.el7.x86_64 2/10 验证中 : libgcc-4.8.5-28.el7_5.1.x86_64 3/10 验证中 : gcc-4.8.5-28.el7_5.1.x86_64 4/10 验证中 : glibc-devel-2.17-222.el7.x86_64 5/10 验证中 : cpp-4.8.5-28.el7_5.1.x86_64 6/10 验证中 : glibc-headers-2.17-222.el7.x86_64 7/10 验证中 : libmpc-1.0.1-3.el7.x86_64 8/10 验证中 : libgomp-4.8.5-28.el7.x86_64 9/10 验证中 : libgcc-4.8.5-28.el7.x86_64 10/10 已安装: gcc.x86_64 0:4.8.5-28.el7_5.1 作为依赖被安装: cpp.x86_64 0:4.8.5-28.el7_5.1 glibc-devel.x86_64 0:2.17-222.el7 glibc-headers.x86_64 0:2.17-222.el7 kernel-headers.x86_64 0:3.10.0-862.3.3.el7 libmpc.x86_64 0:1.0.1-3.el7 作为依赖被升级: libgcc.x86_64 0:4.8.5-28.el7_5.1 libgomp.x86_64 0:4.8.5-28.el7_5.1 完毕!
安装源码包通常需要以下3个步骤。
.configure。这一步可以定制功能,加上相应的选项即可。可以通过./configure --help来查看。这一步会自动检测你的linux系统与相关的套件是否有编译改源码包时所需要的库,因为一旦缺少某个库,就不能完成编译了。只有通过检测后,才会生成Makefile文件。
make。会根据Makefile文件中预设的参数进行编译,这一步就是gcc在工作了。
make install。这一步是安装步骤,用于创建相关软件的存放目录和配置文件。
下载源码包
先切换到 cd /usr/local/src/目录
[root@bogon src]# wget https://cfhcable.dl.sourceforge.net/project/apachehttpserver/httpd-2.2.27.tar.gz --2018-06-27 13:24:06-- https://cfhcable.dl.sourceforge.net/project/apachehttpserver/httpd-2.2.27.tar.gz 正在解析主机 cfhcable.dl.sourceforge.net (cfhcable.dl.sourceforge.net)... 146.71.73.6 正在连接 cfhcable.dl.sourceforge.net (cfhcable.dl.sourceforge.net)|146.71.73.6|:443... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:8350426 (8.0M) [application/x-gzip] 正在保存至: “httpd-2.2.27.tar.gz” 100%[=====================================================================================================================================================>] 8,350,426 56.1KB/s 用时 3m 34s 2018-06-27 13:27:42 (38.1 KB/s) - 已保存 “httpd-2.2.27.tar.gz” [8350426/8350426])
解压源码包
tar -zxvf httpd-2.4.33.tar.gz
配置相关的选项并生成
进入解压后的源码目录,查看可用的配置参数。
cd httpd-2.4.33
./configure --help |less
`configure' configures this package to adapt to many kinds of systems. Usage: ./configure [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print `checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for `--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or `..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [/usr/local/apache2] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, `make install' will install all the files in `/usr/local/apache2/bin', `/usr/local/apache2/lib' etc. You can specify an installation prefix other than `/usr/local/apache2' using `--prefix', for instance `--prefix=$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] :
--prefix=PREFIX,定义软件包的安装路径
--prefix=/usr/local/ apache2 把Apache安装在/usr/local/apache2目录下。
返回值是0,说明成功。成功生成Makefile。
[root@bogon httpd-2.4.33]# echo $? 0 [root@bogon httpd-2.4.33]# ls -l Makefile -rw-r--r-- 1 root dip 11110 6月 27 16:39 Makefile
生成Makefile后,需要进行编译。
make
输入echo $? 查看结果为0,进行下一步。
安装
make install
ls命令查看该目录。
[root@bogon ~]# ls /usr/local/apache2 bin build-1 include lib
相关文章推荐
- 五周第二次课(11月14日) 7.6 yum更换国内源 7.7 yum下载rpm包 7.8/7.9 源码包安装
- 7.6 yum更换国内源 7.7 yum下载rpm包 7.8/7.9 源码包安装
- 7.6 yum更换国内源 7.7 yum下载rpm包 7.8/7.9 源码包安装
- 7.6 yum更换国内源;7.7 yum下载rpm包;7.8 -7.9 源码包安装
- 7.6 yum更换国内源 7.7 yum下载rpm包 7.8/7.9 源码包安装
- 7.6 yum更换国内源 7.7 yum下载rpm包 7.8/7.9 源码包安装
- 7.6 yum更换国内源 7.7 yum下载rpm包 7.8/7.9 源码包安装
- 7.6 yum更换国内源 7.7 yum下载rpm包 7.8/7.9 源码包安装
- yum更换国内源,yum下载rpm包,源码包安装7.6-7.9
- yum更换国内源/yum下载rpm包/源码包安装
- yum更换国内源和下载rpm包及源码包安装
- 5-2 7 yum更换国内源 下载rpm包 源码安装
- yum更换国内源、下载rpm包、源码包安装
- yum更换国内源、下载rpm包,源码包安装
- yum更换国内源,yum下载rpm包,源码包安装
- yum更换国内源 yum下载rpm包 源码包安装
- yum更换国内源、yum下载rpm包 源码包安装
- yum更换国内源、下载rmp包,源码包安装
- 第5周第2课:yum更换源、下载rpm包、源码包安装
- yum更换国内源、yum下载rpm包、 源码包安装