10.2.0: 软件安装-源码安装



1. 源码包安装

1) 安装条件:

2) 安装语法:

下载源码包,解压,进入解压出来的目录

参数:

3) 用法举例(源码安装apache):

# 安装wget,为下载源码包准备工具
yum install wget


# 下载apache源码包,"./configure"报错关键字"APR"

# 习惯将源码包放在约定的目录
cd /usr/local/src
wget http://mirror.nus.edu.sg/apache/httpd/httpd-2.4.10.tar.bz2
tar -xjf httpd-2.4.10.tar.bz2
cd httpd-2.4.10
./configure --prefix=/usr/local/apache2
...省略...
checking for APR... no
configure: error: APR not found.  Please read the documentation.


# 按提示下载并安装APR

cd /usr/local/src
wget http://mirror.nus.edu.sg/apache/apr/apr-1.5.1.tar.bz2
tar -xjf apr-1.5.1.tar.bz2
cd apr-1.5.1
./configure
make
make install


# 再次安装apache,保存提示关键词"APR-util"

cd /usr/local/src/httpd-2.4.10
./configure
...省略...
checking for APR-util... no
configure: error: APR-util not found.  Please read the documentation.


# 按提示下载并安装"APR-util"

cd /usr/local/src
wget http://mirror.nus.edu.sg/apache/apr/apr-util-1.5.4.tar.bz2
tar -xjf apr-util-1.5.4.tar.bz2
cd apr-util-1.5.4
./configure --with-apr=/usr/local/apr
make
make install


## 再次安装apache,报错关键字"pcre"

# cd /usr/local/src/httpd-2.4.10
# ./configure
...省略...
checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/


# 按提示下载安装pcre,错误提示缺少c++

cd /usr/local/src
wget http://sourceforge.net/projects/pcre/files/pcre/8.36/pcre-8.36.tar.bz2
tar -xjf pcre-8.36.tar.bz2
cd pcre-8.36
./configure
configure: error: You need a C++ compiler for C++ support.


# 查询gcc安装情况,用yum安装gcc-c++

# 查看目前gcc版本
rpm -qf $(which gcc)
gcc-4.4.7-4.el6.i686
# gcc包依赖太多,选择yum安装
yum install gcc-c++


# 安装pcre

./configure
make
make install

# 再次安装apache
cd /usr/local/src/httpd-2.4.10
./configure --prefix=/usr/local/apache2
make
make install