centos7源码编译安装httpd、加入systemctl并设置开机自启动
2018-02-01 07:09
741 查看
所需软件:
安装编译环境:
安装apr:
安装apr-util:
安装httpd:
编写启动脚本:vim myhttpd
加入系统服务:
启动自己编写的服务:
设置开机自启动:
apr-1.6.3.tar.gz (下载地址:http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.3.tar.gz) apr-util-1.6.1.tar.gz (下载地址:http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz) httpd-2.4.29.tar.gz (下载地址:http://mirrors.shu.edu.cn/apache//httpd/httpd-2.4.29.tar.gz)
安装编译环境:
yum -y install gcc pcre pcre-devel libtool
安装apr:
tar -xzf apr-1.6.3.tar.gz cd apr-1.6.3/ ./configure && make && make install
安装apr-util:
tar -xzf apr-util-1.6.1.tar.gz cd apr-util-1.6.1/ ./configure --with-apr=/usr/local/apr/ make && make install
安装httpd:
tar httpd-2.4.29.tar.gz cd httpd-2.4.29/ ./configure && make && make install
编写启动脚本:vim myhttpd
#!/bin/bash # chkconfig: 12345 80 90 function start_http() { /usr/local/apache2/bin/apachectl start } function stop_http() { /usr/local/apache2/bin/apachectl stop } case "$1" in start) start_http ;; stop) stop_http ;; restart) stop_http start_http ;; *) echo "Usage : start | stop | restart" ;; esac
加入系统服务:
chmod a+x myhttpd cp -arf myhttpd /etc/init.d/
启动自己编写的服务:
systemctl start myhttpd
设置开机自启动:
chkconfig --add myhttpd
相关文章推荐
- CentOS7,安装Tomcat8.5、JDK1.8,并设置开机启动(Linux CentOS Tomcat、JDK+Tomcat、Tomcat开机自启动)
- CentOS7 安装tomcat为系统服务器 Systemctl管理Tomcat,并设置开机启动
- PostgreSQL 之 源码安装设置开机自启动
- CentOS7安装redis,并设置开机自启动(Redis安装、Redis自启动、Redis设置开机自启动)
- postgres源码安装并设置开机自启动
- centos7安装mysql5.7并设置开机自启动详细步骤
- 源码编译安装Apache开机自启动
- Centos7安装、配置SVN服务,并设置开机自启动
- centos7安装nginx并设置开机自启动
- centos7安装docker并设置开机启动
- centos7系统下nginx安装并配置开机自启动操作
- MySQL代理Atlas在CentOS7.0中的源码安装实践(设置开机自启)
- CentOS7安装redis,并设置开机自启动
- centos7基于源码编译安装LAMP的wordpress应用的实现
- 编译安装web服务httpd及https设置
- 源码编译安装 httpd2.4+MariaDB5.5+php5.4 全新的LAMP
- linux下将编译安装的服务设置为开机启动
- CentOS6.8下安装memcached并设置开机自启动
- redis安装、设置密码及开机自启动
- Linux下将自己安装的Apache(httpd)新增为系统服务,开机自启动