7.6 yum更换国内源
7.7 yum下载rpm包
7.8/7.9 源码包安装
7.6 yum更换国内源
为什么要更换国内原?
自带的yum源(yum仓库)的网址是国外的网站,从国内下载国外的网站速度会有点慢,影响效率。所以更改国内源就会快很多,提高效率,例如更改国内163的yum源。
操作步骤
先把之前做的dvd.repo删掉。恢复之前备份的yum源。
#cd /etc/yum.repos.d/ [root@centos7 yum.repos.d]# rm -f dvd.repo [root@centos7 yum.repos.d]# cp ../yum.repos.d.bak/* . [root@centos7 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
删掉刚刚cp过来的CentOS-Base.repo,然后改163的yum源(wget或者curl -O获取并下载资源)
# rm -f CentOS-Base.repo #wget http://mirrors.163.com/.help/CentOS7-Base-163.repo # wget http://mirrors.163.com/.help/CentOS7-Base-163.repo -bash: wget: 未找到命令
因为原本的CentOS-Base.repo已被删除,所以没办法安装wget命令,所以用curl -O来获取
#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 13996 0 --:--:-- --:--:-- --:--:-- 14162 # ls CentOS-CR.repo CentOS-Media.repo CentOS-Vault.repo CentOS7-Base-163.repo CentOS-Debuginfo.repo CentOS-Sources.repo CentOS-fasttrack.repo # vim CentOS7-Base-163.repo
#yum list
#安装一个命令试试
# yum install -y wget Failed to set locale, defaulting to C Loaded plugins: fastestmirror base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 (1/4): base/7/x86_64/group_gz | 156 kB 00:00:00 (2/4): extras/7/x86_64/primary_db | 166 kB 00:00:00 (3/4): base/7/x86_64/primary_db | 5.7 MB 00:00:03 (4/4): updates/7/x86_64/primary_db | 6.0 MB 00:00:03 Determining fastest mirrors Resolving Dependencies --> Running transaction check ---> Package wget.x86_64 0:1.14-15.el7_4.1 will be installed --> Finished Dependency Resolution Dependencies Resolved =================================================================================================== Package Arch Version Repository Size =================================================================================================== Installing: wget x86_64 1.14-15.el7_4.1 updates 547 k Transaction Summary =================================================================================================== Install 1 Package Total download size: 547 k Installed size: 2.0 M Downloading packages: wget-1.14-15.el7_4.1.x86_64.rpm | 547 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : wget-1.14-15.el7_4.1.x86_64 1/1 Verifying : wget-1.14-15.el7_4.1.x86_64 1/1 Installed: wget.x86_64 0:1.14-15.el7_4.1 Complete!
7.7 yum下载rpm包
有时候163的yum源的base基础源不够用,有时候好多rpm包,这个base里没有。例如需要安装别的非系统的有用的包,这时候需要 用到扩展源来解决这个问题。
#yum install -y epel-release # ls CentOS-CR.repo CentOS-Sources.repo CentOS7-Base-163.repo CentOS-Debuginfo.repo CentOS-Vault.repo epel-testing.repo CentOS-Media.repo CentOS-fasttrack.repo epel.repo
多了两个epel相关的repo文件,其中epel.repo为核心文件。
# cat epel.repo
#yum list |grep epel
yum下载rpm包
#yum install -y 包名 --downloadonly
发现只是下载了,没有被安装
#ls /var/cache/yum/x86_64/7/ 被下载了的文件地址,刚刚截图处可以看到下载到了base里面,所以我们可以/base进去看。 # ls /var/cache/yum/x86_64/7/base/packages/ zsh-5.0.2-28.el7.x86_64.rpm
指定下载到某目录
#yum install -y 包名 --downloadonly --downloaddir=路径
指定下载到/tmp下
#yum install -y zsh --downloadonly --downloaddir=/tmp
# ls /tmp/zsh-5.0.2-28.el7.x86_64.rpm /tmp/zsh-5.0.2-28.el7.x86_64.rpm
高亮记住,包被安装过的话,文件将不会被下载。除非用这条命令:
#yum reinstall -y 包名 --downloadonly --downloaddir=路径
# yum reinstall -y vim-enhanced --downloadonly --downloaddir=/tmp/ # ls /tmp/vim-enhanced-7.4.160-2.el7.x86_64.rpm /tmp/vim-enhanced-7.4.160-2.el7.x86_64.rpm
7.8/7.9 源码包安装
本课介绍
源码包安装
#cd /usr/local/src/ 约定:以后的源码包放在这目录里。
安装2.2Apache源码包
#wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.34.tar.gz # ls httpd-2.2.34.tar.gz #tar zxvf httpd-2.2.34.tar.gz #ls 蓝色httpd-2.2.34 httpd-2.2.34.tar.gz #cd httpd-2.2.34 [root@centos7 httpd-2.2.34]# ls ABOUT_APACHE InstallBin.dsp NWGNUmakefile acinclude.m4 docs include server Apache.dsw LAYOUT README build emacs-style libhttpd.dep srclib BuildAll.dsp LICENSE README-win32.txt buildconf httpd.dep libhttpd.dsp support BuildBin.dsp Makefile.in README.platforms config.layout httpd.dsp libhttpd.mak test CHANGES Makefile.win ROADMAP configure httpd.mak modules INSTALL NOTICE VERSIONING configure.in httpd.spec os
#more
INSTALL查看安装步骤,标出的安装步骤。
#./configure --prefix=/usr/local/apache2
(一般prefix=后接绝对路径,格式:prefix=/usr/local/apache2)(#./configure --help 查看相关功能)
安装步骤1
#./configure --prefix=/usr/local/apache2
检查到有3个no
测试一条命令输出结果是否错误
#echo $? 如果非0,代表是错误 1 安装第一个no(gcc), #yum install -y gcc #echo $? 检查结果有无错误,0表示正常。 0
安装步骤2
#make
#echo $? 检查结果有无错误,0表示正常。 0
安装步骤3
#make install
#echo $? 检查结果有无错误,0表示正常。 0
源码包最好在官网下载。