ITPub博客

首页 > Linux操作系统 > Linux操作系统 > apache httpd-2.4.18 安装教程

apache httpd-2.4.18 安装教程

原创 Linux操作系统 作者:呱呱牛 时间:2016-05-26 13:05:38 0 删除 编辑

    在安装过程中需要提前安装apache需要的依赖关系服务分别是pcre、apr和apr-util,这里我们选择稳定版本进行安装,httpd选择2.4.18版本,具体如下

点击(此处)折叠或打开

  1. [root@xxt02 ~]# ll
  2. apr-1.5.2.tar.gz
  3. apr-util-1.5.4.tar.gz
  4. httpd-2.4.18.tar.gz
  5. pcre-8.36.tar.gz    
1.apr安装,选择安装目录为/usr/local/apr。在安装过程中遇到 rm: cannot remove `libtoolT': No such file or directory 问题,通过修改configure文件的解决,方式: $RM "$cfgfile" 修改为 $RM  -f "$cfgfile"

点击(此处)折叠或打开

  1. cd apr-1.5.2
  2. ./configure --prefix=/usr/local/apr
  3. make
  4. make install

2.apr-util安装,选择安装目录/usr/local/apr-util,指定apr

点击(此处)折叠或打开

  1. cd apr-util-1.5.4
  2. ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
  3. make
  4. make install
3.pce安装,选择安装目录/usr/local/pcre

点击(此处)折叠或打开

  1. cd pcre-8.37
  2. ./configure --prefix=/usr/local/pcre
  3. make
  4. make install
4.安装http服务,这是最关键的服务

点击(此处)折叠或打开

  1. cd httpd-2.4.18
  2. ./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
  3. make
  4. make install
4.1修改httpd.conf 参数文件,修改ServerName参数

点击(此处)折叠或打开

  1. ServerName localhost:80  或是  ServerName 127.0.0.1:80
4.2添加服务启动脚本 

点击(此处)折叠或打开

  1. cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
  2. chkconfig --add httpd
  3. chkconfig httpd on

  4. httpd服务管理

  5. service httpd {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}
4.3 也可以把httpd服务添加到系统环境变量中,通过httpd命令管理服务

点击(此处)折叠或打开

  1. echo 'export PATH=$PATH:/usr/local/httpd/bin' >> /etc/profile.d/httpd.sh
  2. chmod +x /etc/profile.d/httpd.sh
  3. source /etc/profile.d/httpd.sh

点击(此处)折叠或打开

  1. ----------------------
  2. httpd -k start 启动
  3. httpd -k restart 重启
  4. httpd -k graceful 重读配置文件
  5. httpd -k stop 停止
  6. ----------------------
5. 服务验证,打开浏览器显示 It's work! 表示成功。


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/27039319/viewspace-2107306/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-05-29

  • 博文量
    96
  • 访问量
    286810