dream789 发表于 2018-11-25 11:25:45

rhel5.4 源文件安装apache

  本文为记录提醒之用。
之前用ubuntu,安装什么都是apt-get install搞定。现在申请到了新的实验节点,都是rhel5.4,而且不能连接外网,不能用yum安装。因此,只能下载源码,在节点上安装。
1、下载apache,访问官网http://httpd.apache.org/download.cgi,我们可以下到最新的版本。现在版本都是以这样的方式表达的:httpd-*.*.*.tar.gz
我下载的版本是:httpd-2.2.23.tar.gz。
2、下载之后scp到实验节点的/root目录下,然后ssh登录到需要安装apache的实验节点。
3、解压安装包。在目录/root下,运行tar –zxvfhttpd-2.2.23.tar.gz,解压后为目录httpd-2.2.23
4、为了便于管理,将解压后安装文件移动到目录/usr/local/src/下。在root目录下,运行 mv httpd-2.2.23 /usr/local/src/。
5、为了便于管理,建立目录/usr/local/web/apache/,用于安装apache。在任意目录下,运行mkdir –p /usr/local/web/apache/。
6、进入apache安装源文件目录,准备安装。运行cd /usr/local/src/httpd-2.2.23。
7、配置。在目录/usr/local/src/httpd-2.2.23下,运行./configure--prefix=/usr/local/web/apache --enable-shared=max --enable-module=rewirte --enable-module=so
8、编译。依次运行make、make install
9、启动httpd(apache)服务。运行service httpd start。
10、访问apache。打开浏览器,输入apache服务器所在节点的ip地址,看到apache的test page,证明安装成功。
备注:如果想自己写个测试页面,可以到/var/www/html目录下,新建一个index.html文件,在里面写一些简单语句。再次访问时,就能看到这个页面了。
  
附录 RedHat 9.0 and older中apache各种默认配置文件目录:
ServerRoot: /etc/httpd
Primary Config Fle:/etc/httpd/conf/httpd.conf
DocumentRoot:      /var/www/html
ErrorLog:               /var/log/httpd/error_log
AccessLog:            /var/log/httpd/access_log
cgi-bin:               /var/www/cgi-bin (empty and disabled by default)
binary:                  /usr/sbin/httpd
start/stop:            /sbin/service httpd {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}





页: [1]
查看完整版本: rhel5.4 源文件安装apache