Syntax: Chkconfig--list [name]chkconfig--add namechkconfig--del namechkconfig [--level levels] name <on|off|reset> Chkconfig [--level levels] Name
Reference article http://www.cnblogs.com/jipeng87/p/6308725.html
Objective
Apache requires at least the support of APR, Apr-util, pcre components.
The APR (Apache portable run-time Libraries,apache Portable runtime) is designed to provide an underlying support interface library that can be used across multiple operating system platforms, as its name would be, primarily for upper-level applications. In earlier versions of Apache, the application itself must be able to handle the details of a variety of specific operating system platforms and invoke different processing functions for different platforms. With the further development of Apache, the Apache organization decided to separate and develop these universal functions into a new project. In this way, the development of APR is isolated from Apache, and Apache uses only Apr. Currently APR is mostly used by Apache, but due to the good portability of APR, some C programs that need to be ported are also starting to use Apr.
Apr-util provides more data structures and operating system encapsulation interfaces on an APR basis. Apr-util dependent on APR, you must install APR before installing Apr-util.
PCRE (perl Compatible Regular Expressions) is a Perl library that includes a Perl-compatible regular expression library.
The installation of the source code generally consists of 3 steps: configuration (Configure), compile (make), install (makes install).
1. Check if the Apache server is installed httpd
[Email protected] src]# Rpm-qa|grep httpd
Httpd-2.4.6-45.el7.centos.x86_64
Httpd-tools-2.4.6-45.el7.centos.x86_64
2. Uninstall the system automatically installed Apache server httpd
[Email protected] src]# httpd-k stop #停止httpd服务器
[Root[email protected] src]# yum remove httpd #卸载httpd服务器
4 Downloads httpd-2.4.25 apr-1.5.2 apr-util-1.5.4 pcre-8.40
[Email protected] src]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.25.tar.gz
[Email protected] src]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.5.2.tar.gz
[Email protected] src]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.5.4.tar.gz
[Email protected] src]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
5 Check if GCC is installed on the system
[Email protected] src]# gcc
BASH:GCC: Command not found ... #出现未找到命令提示, stating that GCC is not installed
6 Installing GCC and gcc-c++
[[email protected] src]# yum-y install GCC
[Email protected] pcre-8.40]# yum-y install gcc-c++
Note: If gcc-c++ is not installed, it will be reported Configure:error:You need a C + + compiler for C + + support when executing./configure-prefix=/usr/local/pcre. Error
7 Copy the downloaded compressed files to the/usr/local directory
[email protected] src]# CP apr-1.5.2.tar.gz/usr/local
[email protected] src]# CP apr-uril-1.5.4.tar.gz/usr/local
[email protected] src]# CP httpd-2.4.25.tar.gz/usr/local
8 Compiling and installing apr-1.5.2
#解压缩apr文件
[Email protected] local]# TAR-ZXVF apr-1.5.2.tar.gz
#改变目录到 apr-1.5.2
[Email protected] local]# cd apr-1.5.2
#指定apr的安装目录为/USR/LOCAL/APR Configuration
[Email protected] apr-1.5.2]#./configure-prefix=/usr/local/apr
#编译安装
[[email protected] apr-1.5.2]# make && make install
9 Compiling and installing apr-uril-1.5.4
#解压缩apr-util File
[Email protected] local]# TAR-ZXVF apr-util-1.5.4.tar.gz
#改变目录到apr-util-1.5.4/
[Email protected] local]# CD apr-util-1.5.4/
#指定apr the-util installation path, specify the APR for the Apr-util
[Email protected] apr-util-1.5.4]#./configure-prefix=/usr/local/apr-util-with-apr=/usr/local/apr
#编译安装
[[email protected] apr-util-1.5.4]# make && make install
10 Compiling and installing Pcre
#卸载系统自带的pcre
[Email protected] apr-util-1.5.4]# Rpm-qa pcre
Pcre-8.32-15.el7_2.1.x86_64
#解压缩apr-util File
[Email protected] local]# TAR-ZXVF pcre-8.40.tar.gz
#改变目录到pcre -8.40/
[Email protected] local]# CD pcre-8.40/
#指定prce的安装路径, specify the APR that corresponds to the Apr-util
[Email protected] pcre-8.40]#./configure-prefix=/usr/local/pcre
#编译安装 (make is compiled make install is installed)
[[email protected] pcre-8.40]# make && make install
11 Compiling and installing Apache
Compiling and installing Apache is divided into dynamic, static two ways. Dynamic compilation means that the module can be loaded at any time after the configuration file is adjusted in the future use, and the corresponding module is determined at compile time by static instead.
#解压缩httpd-2.4.25 file
[Email protected] local]# TAR-ZXVF httpd-2.4.25.tar.gz
#改变目录到httpd -2.4.25/
[Email protected] local]# CD httpd-2.4.25/
#配置
[Email protected] httpd-2.4.25]#/configure-prefix=/usr/local/apache-sysconfdir=/etc/httpd-enable-so- Enable-rewrite-with-apr=/usr/local/apr-with-apr-util=/usr/local/apr-util-with-pcre=/usr/local/pcre
#编译安装
[[email protected] httpd-2.4.25]#make && make install
12 Configuring the Apache Fire gun
#永久开放http服务
[Email protected] httpd-2.4.25]# firewall-cmd--permanent--add-service=http
Success
#重新加载防火墙
[Email protected] httpd-2.4.25]# Firewall-cmd--reload
Success
12 Start, stop Apache service
#编辑httpd. conf file
[email protected] httpd-2.4.25]#vi/etc/httpd/httpd.conf
Add the following statement under #servername www.example.com:80
ServerName localhost:80
#使用脚本控制Apache, start the service
[[email protected] ~]#/usr/local/apache/bin/apachectl start
#使用脚本控制Apache, stop the service
[[email protected] ~]#/usr/local/apache/bin/apachectl stop
#服务启动后, http://localhost browser content in the browser input displays the IT works
13 Setting Apache boot up
1, copy the Apachectl command to the/ETC/INIT.D directory, renamed to HTTPD
# CP/USR/LOCAL/APACHE/BIN/APACHECTL/ETC/INIT.D/HTTPD
2, edit the/etc/init.d/httpd file, add the following two lines after the 1th line #!/bin/sh
# VI/ETC/INIT.D/HTTPD
# chkconfig:2345 70 30
# Description:apache
where three digits in the second row are added, the first indicates that Apache is started at run level 2345, and the second to third is the priority configuration for start and stop.
3, Apache service has not been added to the Chkconfig list, you need to use the –add parameter to add it in
[Email protected] init.d]# chkconfig--add httpd
[Email protected] init.d]# chkconfig--list httpd
With the above settings, the Apache service starts automatically every time you boot
Note: This output shows only the SysV service and does not contain the native SYSTEMD service. SysV configuration data may be overwritten by native SYSTEMD configuration.
If you would like to list the SYSTEMD service, please do ' systemctl list-unit-files '.
To view services enabled for a specific target, perform
' Systemctl list-dependencies [target] '.
httpd 0: Off 1: Off 2: Open 3: Open 4: Open 5: Open 6: Off
Note: CHKCONFG is a variety of services for checking and setting up the system.
The CHKCONFG syntax is as follows:
Chkconfig--list [Name]
Chkconfig--add namechkconfig--del namechkconfig [--level levels] name <on|off|reset>chkconfig [--level levels] Na Me
Centos7 under the source code compilation method installs the httpd