通常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缓存