apache安装首先肯定要有安装包,下载地址 http://download.chinaunix.net/这里可以自己搜索到想要的软件一般情况下,这里的软件足够使用,下载完安装包需要解压
[root@localhost 123]# tar jxvf httpd-2.4.1.tar.bz2
[root@localhost 123]# cd httpd-2.4.1
[root@localhost httpd-2.4.1]# ./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... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
Configuring Apache Portable Runtime library ...
checking for APR... yes
setting CC to "gcc"
setting CPP to "gcc -E"
setting CFLAGS to " -g -O2 -pthread"
setting CPPFLAGS to " -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE"
setting LDFLAGS to " "
Configuring Apache Portable Runtime Utility library...
checking for APR-util... no
configure: error: APR-util not found. Please read the documentation.
提示很明显是因为没有安装apr、apr-util(同一个网站下载apr、apr-util安装包)
[root@localhost 123]# tar jxvf apr-1.4.6.tar.bz2
[root@localhost 123]# cd apr-1.4.6 [root@localhost apr-1.4.6]# ./configure --prefix=/usr/local/apr && make && make install
(首先安装的是apr)
安装apr-util的时候有点不同 需要添加一个--with参数
[root@localhost 123]# tar zxvf apr-util-1.3.8.tar.gz
[root@localhost 123]# cd apr-util-1.3.8
[root@localhost apr-util-1.3.8]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && make && make install
接下来要安装apache的时候还会提示安装PCRE 安装方法:
[root@localhost 123]# tar jxvf pcre-8.31.tar.bz2
[root@localhost 123]# cd pcre-8.31
[root@localhost pcre-8.31]# ./configure --prefix=/usr/local/pcre && make && make install
在安装PCRE的时候出现错误参考 http://songjingang.blog.51cto.com/4151716/1107887
安装之后就可以来安装apache了
[root@localhost 123]# tar jxvf httpd.2.4.1.tar.bz2
[root@localhost 123]# cd httpd.2.4.1
[root@localhost httpd-2.4.1]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/ -enable-dav -enable-so -enable-maintainer-mode -enable-rewrite && make && make install
(对于里面的选项我就不多介绍了)
[root@localhost httpd-2.4.1]# cd /usr/local/apache2/
[root@localhost apache2]# ls
bin build cgi-bin conf error htdocs icons include logs man manual modules
[root@localhost apache2]# cd bin/
[root@localhost bin]# ./apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
出现这样的图就安装完成了
8202698**流嵌入式Linux、Linux系统管理、Linux服务器技术、Linux系统开发,Linux架构---群社区xiangruyi.net