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