接上期,我们部署完了MySQL服务,接下来开始不是Apache服务。
四、部署Apache服务
1、安装Apache所必须的依赖包
[root@Mail ~]# yum -y install libtool-libs autoconf freetype-devel gd libjpeg-devel libpng-devel libxml2-devel zlib-devel zip unzip curl-devel crontabs file patch mlocate flex diffutils automake kernel-devel cpp readline-devel openssl vim-minimal glibc-devel glib2-devel bzip2-devel e2fsprogs-devel libidn-devel gettext-devel expat-devel libcap-devel libtool-ltdl-devel pam-devel pcre-devel pcre
2、下载Apache及依赖安装包
[root@Mail ~]# wget -c http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.37.tar.gz
[root@Mail ~]# wget -c http://mirror.bit.edu.cn/apache/apr/apr-1.6.5.tar.gz
[root@Mail ~]# wget -c http://mirror.bit.edu.cn/apache/apr/apr-iconv-1.2.2.tar.gz
[root@Mail ~]# wget -c http://mirror.bit.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
3、安装apr
[root@Mail ~]# tar -zxvf apr-1.6.5.tar.gz
[root@Mail ~]# cd apr-1.6.5
[root@Mail apr-1.6.5]# CC="gcc -m64" ./configure --prefix=/usr/local/apr
[root@Mail apr-1.6.5]# make -j `grep processor /proc/cpuinfo | wc -l`
[root@Mail apr-1.6.5]# make install
4、安装apr-util
[root@Mail ~]# tar -zxvf apr-util-1.6.1.tar.gz
[root@Mail ~]# cd apr-util-1.6.1
[root@Mail apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@Mail apr-util-1.6.1]# make -j `grep processor /proc/cpuinfo | wc -l`
[root@Mail apr-util-1.6.1]# make install
5、安装apr-iconv
[root@Mail ~]# tar -zxvf apr-iconv-1.2.2.tar.gz
[root@Mail ~]# cd apr-iconv-1.2.2
[root@Mail apr-iconv-1.2.2]# ./configure --prefix=/usr/local/apr-iconv --with-apr=/usr/local/apr
[root@Mail apr-iconv-1.2.2]# make -j `grep processor /proc/cpuinfo | wc -l`
[root@Mail apr-iconv-1.2.2]# make install
5、安装Apache服务
a、创建Apache用户和用户组
[root@Mail ~]# groupadd www
[root@Mail ~]# useradd -s /sbin/nologin -g www www
b、解压Apache安装包,并进入目录
[root@Mail ~]# tar -zxvf httpd-2.4.37.tar.gz
[root@Mail ~]# cd httpd-2.4.37
c、编译Apache
[root@Mail httpd-2.4.37]# ./configure --prefix=/usr/local/apache --sysconfdir=/wdata/apache/conf --enable-cgi --enable-mods-shared=most --enable-headers --enable-mime-magic --enable-proxy --enable-so --enable-rewrite --enable-ssl --enable-deflate --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-mpms-shared=all --with-mpm=prefork --enable-remoteip
说明:可以用 --with-ssl 参数来指定 openssl 安装目录,也可以用 --with-pcre=PATH 参数来指定 pcre 安装目录
d、安装Apache
[root@Mail httpd-2.4.37]# make -j `grep processor /proc/cpuinfo | wc -l`
[root@Mail httpd-2.4.37]# make install
到此,Apache服务安装完成,至于Apache服务配置,将在其他章节进行解析。
未完待续。。。。。。
转载于:https://blog.51cto.com/4746316/2313671