yum源默认从国外网站下载,速度相对较慢。能够更换成内容源。html
步骤:ls /etc/yum.repos.d ,将CentOS-Base.repo移走或更名。linux
[root@glinux-01 ~]# ls /etc/yum.repos.d CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo
下载CentOS7-Base-163.repo文件,命令:wget http://mirrors.163.com/.help/CentOS7-Base-163.repoapache
该命令会将文件下载到当前目录下,移动至/etc/yum.repos.d缓存
[root@glinux-01 ~]# ls 1.txt anaconda-ks.cfg bad boduo.av CentOS7-Base-163.repo cuowu test.sh zhengque
注意:最好先安装wget包,在移走CentOS-Base.repo。要不无法运行wget命令curl
也能够用curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo下载CentOS7-Base-163.repo文件。网站
yum clean all 清除缓存。ui
有些源颇有用,可是自带源没有,须要安装扩展源url
方法:spa
下载的包保存目录,从哪一个仓库下载的就在哪一个文件夹下。.net
[root@glinux-01 ~]# ls /var/cache/yum/x86_64/7/ base extras timedhosts timedhosts.txt updates
示例:Apache源码包安装步骤
下载后解压 tar -zxvf httpd-2.4.29.tar.gz
[root@glinux-01 src]# ls httpd-2.4.29 httpd-2.4.29.tar.gz
[root@glinux-01 httpd-2.4.29]# ls ABOUT_APACHE BuildBin.dsp emacs-style LAYOUT NOTICE srclib acinclude.m4 buildconf httpd.dep libhttpd.dep NWGNUmakefile support Apache-apr2.dsw CHANGES httpd.dsp libhttpd.dsp os test Apache.dsw CMakeLists.txt httpd.mak libhttpd.mak README VERSIONING apache_probes.d config.layout httpd.spec LICENSE README.cmake ap.d configure include Makefile.in README.platforms build configure.in INSTALL Makefile.win ROADMAP BuildAll.dsp docs InstallBin.dsp modules server
目录中文件README,INSTALL通常是安装信息
[root@glinux-01 httpd-2.4.29]# cat INSTALL APACHE INSTALLATION OVERVIEW Quick Start - Unix ------------------ For complete installation documentation, see [ht]docs/manual/install.html or http://httpd.apache.org/docs/2.4/install.html $ ./configure --prefix=PREFIX //指定安装路径 $ make //译成电脑识别的二进制文件 $ make install //用于建立相关软件的存放目录和配置文件 $ PREFIX/bin/apachectl start //启动方法
./configure --prefix=/usr/local/apache2 (还有不少选项,能够./configure --help查看)指定路径
[root@glinux-01 httpd-2.4.29]# ./configure --prefix=/usr/local/apache2 checking for chosen layout... Apache checking for working mkdir -p... yes checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E 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 configure: configure: Configuring Apache Portable Runtime library... configure: checking for APR... no configure: error: APR not found. Please read the documentation. [root@glinux-01 httpd-2.4.29]# echo $? 1
竟然报错。。。configure: error: APR not found. Please read the documentation.
网上搜索的解决方案:https://www.cnblogs.com/visec479/p/5160297.html
echo $? 能够检测上一条命令执行正确(0)仍是错误(1)
下载apr软件包:wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
又报错!
[root@glinux-01 apr-1.4.5]# ./configure --prefix=/usr/local/apr 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.4.5 checking for chosen layout... apr checking for gcc... no checking for cc... no checking for cl.exe... no configure: error: in `/usr/local/src/apr-1.4.5': configure: error: no acceptable C compiler found in $PATH See `config.log' for more details.
安装gcc yum install gcc
从新安装 :[root@xt apr-1.4.5]# ./configure --prefix=/usr/local/apr 安装
从新安装 ./configure --prefix=/usr/local/apache2 成功
make
make install