通常yum下載包的地址都是外國的地址,爲了防止網址沒法訪問的事情發生,因此就給他換一個國內的地址mysql
[root@centos001 yum.repos.d]# yum list //上次作實驗時在本地搭建了域名倉庫 [root@centos001 yum.repos.d]# ls dvd.repo [root@centos001 yum.repos.d]# rm -f dvd.repo //刪除倉庫 [root@centos001 yum.repos.d]# cp ../yum.repos.d.bak/* . //從新複製一遍 cp: 略過目錄"../yum.repos.d.bak/yum.repos.d" [root@centos001 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@centos001 yum.repos.d]# rm -f CentOS-Base.repo //刪除這個文件 [root@centos001 yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo bash: wget: 未找到命令 //設置國內地址 可是剛纔給刪掉 一個東西 就值能用下面這個 [root@centos001 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 6811 0 --:--:-- --:--:-- --:--:-- 6834 [root@centos001 yum.repos.d]# ls //這裏能看到 已經有個咱們設置的網易的地址了 CentOS7-Base-163.repo CentOS-fasttrack.repo CentOS-Vault.repo CentOS-CR.repo CentOS-Media.repo CentOS-Debuginfo.repo CentOS-Sources.repo [root@centos001 yum.repos.d]# vi CentOS7-Base-163.repo [root@centos001 yum.repos.d]# yum lixt //看一看 能用的源文件
[root@centos001 yum.repos.d]# ls CentOS7-Base-163.repo CentOS-fasttrack.repo CentOS-Vault.repo CentOS-CR.repo CentOS-Media.repo CentOS-Debuginfo.repo CentOS-Sources.repo //在更名後清除緩存報錯 [root@centos001 yum.repos.d]# mv CentOS7-Base-163.repo CentOS7-Base-163.repo.123 [root@centos001 yum.repos.d]# yum clean all 已加載插件:fastestmirror Loading mirror speeds from cached hostfile There are no enabled repos. Run "yum repolist all" to see the repos you have. To enable Red Hat Subscription Management repositories: subscription-manager repos --enable <repo> To enable custom repositories: yum-config-manager --enable <repo> [root@centos001 yum.repos.d]# yum repolist all //根據提示的輸入命令 已加載插件:fastestmirror Loading mirror speeds from cached hostfile 源標識 源名稱 狀態 C7.0.1406-base/x86_64 CentOS-7.0.1406 - Base 禁用 [root@centos001 yum.repos.d]# ls CentOS7-Base-163.repo.123 CentOS-fasttrack.repo CentOS-Vault.repo //把名字換回去 再從新清除緩存就能使用國內的源了 CentOS-CR.repo CentOS-Media.repo CentOS-Debuginfo.repo CentOS-Sources.repo [root@centos001 yum.repos.d]# mv CentOS7-Base-163.repo.123 CentOS7-Base-163.repo [root@centos001 yum.repos.d]# yum clean all
當安裝的源不夠時,就須要擴展了linux
[root@centos001 yum.repos.d]# yum install -y epel-release
主要用來下載互聯網上的包,至關於下個軟件包
注:下載的包是需是未安裝的包sql
[root@centos001 yum.repos.d]# yum install zsh --downloadonly //最後表示只下載不安裝
[root@centos001 ~]# yum install zsh --downloadonly --downloaddir=/tmp/ [root@centos001 ~]# ls /tmp/ zsh-5.0.2-28.el7.x86_64.rpm
[root@centos001 ~]# yum reinstall vim-enhanced --downloadonly --downloaddir=/tmp/ //下載時從新安裝
安裝源碼包是最經常使用的。安裝時須要吧源代碼編譯成可執行的二進制文件。能夠修改源代碼的自定義設定,再按需求編譯。apache
[root@centos001 ~]# cd [root@centos001 ~]# cd /usr/local/src/ //路徑名
echo $?:用於檢查上一步操做是否出錯,非零就是有錯誤 1.下載:vim
[root@centos001 src]# wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.34.tar.gz [root@centos001 src]# tar -zxvf httpd-2.2.34.tar.gz // 加文件名 [root@centos001 src]# ls httpd-2.2.34 mysql-5.1.73-linux-x86_64-glibc23.tar.gz httpd-2.2.34.tar.gz mysql-5.1.73-linux-x86_64-glibc23.tar.gz.1 [root@centos001 src]# cd httpd-2.2.34 [root@centos001 httpd-2.2.34]# ls ABOUT_APACHE config.layout httpd.spec LICENSE README.platforms acinclude.m4 configure include Makefile.in README-win32.txt Apache.dsw configure.in INSTALL Makefile.win ROADMAP build docs InstallBin.dsp modules server BuildAll.dsp emacs-style LAYOUT NOTICE srclib BuildBin.dsp httpd.dep libhttpd.dep NWGNUmakefile support buildconf httpd.dsp libhttpd.dsp os test CHANGES httpd.mak libhttpd.mak README VERSIONING
2.安裝:centos
[root@centos001 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 [root@centos001 httpd-2.2.34]# echo $? //檢查 1 [root@centos001 httpd-2.2.34]# yum install gcc //安裝 [root@centos001 httpd-2.2.34]# ./configure --prefix=/usr/local/apache2 //從新安裝 源碼包 [root@centos001 httpd-2.2.34]# make [root@centos001 httpd-2.2.34]# make install
http://ask.apelearn.com/question/7168緩存