源码安装apache后将其设置为开机启动

从网上下载apache的源码包,例如/usr/local/src/httpd-2.2.34.tar.gz,解压到目录/usr/local/src/httpd-2.2.34,编译并安装,假如安装到/usr/local/apache目录中,将其设置为开机启动,并且可以使用service启动和关闭。

1.找到httpd-2.2.34/build/rpm/httpd.init并移动:mv /usr/local/src/httpd-2.2.34/build/rpm/httpd.init /etc/rc.d/init.d/httpd

2.打开/etc/rc.d/init.d/httpd并修改:

httpd=${HTTPD-/usr/local/apache/bin/httpd} #红色部分原为/usr/sbin

pidfile=${PIDFILE-/usr/local/apache/logs/${prog}.pid} #红色部分原为/var/logs/

CONFFILE=/usr/local/apache/conf/httpd.conf #红色部分原为/etc/httpd/conf

3.运行:

chkconfig --add httpd #注意要在/etc/rc.d/init.d目录下运行

chkconfig –level 2345 httpd on #设置为开机启动,

chkconfg –list #可以看到httpd已经添加到开机启动,且2345为on

4.分别运行service httpd start和service httpd stop,如果能够正常启动/关闭httpd并没有错误提示说明设置正确,重新启动linux系统检测httpd是否正常运行

时间: 2024-08-28 01:40:07

源码安装apache后将其设置为开机启动的相关文章

烂泥:源码安装apache

本文由秀依林枫提供友情赞助,首发于烂泥行天下. 最近要开始学习nagios监控方面的知识了,但是nagios与apache结合的比较紧密,所以本篇文章就先把apache的源码安装学习下. 我们现在分以下步骤进行安装apache: 1. 安装编译环境 2. 卸载原有apache 3. 下载解压源码包 4. 安装apache 5. 测试apache 6. 查看apache安装生成的目录 7. 查看apache的配置文件 8. apache加入系统服务 一.安装编译环境 在安装apache之前,我们需

LAMP配置笔记之源码安装apache

下载Apache源码: http://httpd.apache.org/(当前最新版本为2.4.12) tar -xf http-xx.tar cd http-xx ./configure --enable-so          //另外还可以使用 --prefix=path 指定安装位置,默认安装位置为: /usr/local/apache2/ ,完整的配置选项参考官方文档:http://httpd.apache.org/docs/2.4/programs/configure.html ma

CentOS 7.4下源码安装 Apache HTTP Server(httpd-2.4.35)

CentOS 7.4下源码安装 Apache HTTP Server(httpd-2.4.35) 前提:确保安装了expat-devel, APR包 (apr-1.6.3.tar.gz 和 apr-util-1.6.1.tar.gz); 用YUM方式安装expat-devel 和 apr-util-devel yum -y install expat-devel yum -y install apr-util-devel 解压apr-1.6.3.tar.gz后进入该目录下,执行: ./confi

Centos7源码安装Apache和PHP

源码安装Apache 安装需要的依赖 yum -y install gcc autoconf automake make pcre pcre-devel openssl openssl-devel?#pcre是正则表达式库#openssl是安全通信的库 安装apr和apr-until #apr是Apache可移植运行时#apr-until是Apache可移植运行时实用程序库?wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.7

源码安装Apache,报错:Cannot use an external APR with the bundled APR-util和httpd: Could not reliably determine the server's fully qualified domain name

一.解决APR和APR-util错误: 1.1.安装APR: [[email protected] httpd-2.2.23]# cd srclib/apr [[email protected] apr]# ./configure --prefix=/usr/local/apr root@ganglia apr]# make && make install 1.2.安装APR-util: [[email protected] apr]# cd ../apr-util/ [[email pr

CentOS 64-bit下安装JDK和Tomcat并设置Tomcat开机启动操作步骤

准备文件如下: 1.CentOS-6.4-x86_64-bin-DVD1.iso 2.jdk-7u67-linux-x64.rpm 3.apache-tomcat-7.0.55.tar.gz 安装步骤如下: 一.安装JDK [[email protected] /]# java -versionbash: java: command not found [[email protected] /]# rpm -ivh /soft/jdk-7u67-linux-x64.rpmPreparing...

Linux 源码安装apache 与常见错误解决

文档原位置 一.编译安装apache 1.解决依赖关系 httpd-2.4.4需要较新版本的apr和apr-util,因此需要事先对其进行升级. 升级方式有两种,一种是通过源代码编译安装,一种是直接升级rpm包(谨慎!小心).下面是使用源代码的方式行,它们的下载路径为:(~_~)这里不再说到那里下载了,相信你有能力找的到的,呵呵 2.安装依赖的软件包(当然这里可以认为成需要的编译环境咯!) yum -y install pcre-devel yum -y install  "Developmen

Centos 7.0 编译安装LAMP(Linxu+apache+mysql+php)之源码安装Apache (一)

Apache 简介: Apache是世界使用排名第一的Web服务器软件.它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件之一.它快速.可靠并且可通过简单的API扩充,将Perl/Python等解释器编译到服务器中. 安装环境: 系统: centos 7.0 最小化安装 软件:httpd-2.4.26 依赖包:apr .apr-util .pcre .gcc .gcc-c++ .perl-dvel.perl.openssl .openssl-

源码安装 apache 2.4.27

登陆apache官网下载源码安装包 http://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.27.tar.gz 下载所需软件源码包 § Apache Apr: http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.2.tar.gz Apr-Util: http://mirror.bit.edu.cn/apache//apr/apr-util-1.6.0.tar.gz (或者点