linux 学习笔记-038-MariaDB 安装,Apache 安装

发布于 2018-02-27  524 次阅读


MariaDB 安装

二进制免编译包安装:

[root@am-01:~#] cd /usr/local/src/
[root@am-01:/usr/local/src#] wget https://downloads.mariadb.com/MariaDB/mariadb-10.2.6/bintar-linux-glibc_214-x86_64/mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
[root@am-01:/usr/local/src#] tar zxvf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
[root@am-01:/usr/local/src#] mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb
[root@am-01:/usr/local/src#] cd /usr/local/mariadb
[root@am-01:/usr/local/mariadb#] useradd mysql
[root@am-01:/usr/local/mariadb#] mkdir /data/mysql
[root@am-01:/usr/local/mariadb#] ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb/ --datadir=/data/mariadb

#初始化,--basedir 是为了指定 mariadb 的安装目录的路径
#因官方下载速度较慢,这里提供百度云分享链接,下载完成后用 WinSCP 软件把包传送到服务器即可
#链接:https://pan.baidu.com/s/1bqou4iF  密码:rgl5
[root@am-01:/usr/local/mariadb#] echo $?
0

#测试是否安装成功
[root@am-01:/usr/local/mariadb#] ls support-files/
binary-configure  my-innodb-heavy-4G.cnf  my-small.cnf         mysql.server  wsrep_notify
magic             my-large.cnf            mysqld_multi.server  policy
my-huge.cnf       my-medium.cnf           mysql-log-rotate     wsrep.cnf

#mariadb 的模板配置文件有多个,分别针对内存大小而做了相对应优化
[root@am-01:/usr/local/mariadb#] cp support-files/my-small.cnf /usr/local/mariadb/my.cnf
[root@am-01:/usr/local/mariadb#] cp support-files/mysql.server /etc/init.d/mariadb

#拷贝模板配置文件到/usr/local/mariadb/目录下并改名为 my.cnf,同时拷贝启动脚本到系统启动项
[root@am-01:/usr/local/mariadb#] vim /usr/local/mariadb/my.cnf

#主要修改[mysqld]模块,server-id 是用来做主从复制的,最后几个参数模块主要跟备份相关
[root@am-01:/usr/local/mariadb#] vim /etc/init.d/mariadb
  basedir=/usr/local/mariadb
  datadir=/data/mariadb
  conf=/usr/local/mariadb/my.cnf
  $bindir/mysqld_safe --defaults-file="$conf" --datadir="$datadir" --pid-file="$mysqld_pid_file_path" "$@" &

#修改 basedir 和 datadir,定义自定义变量 conf,在启动语句中引用新变量--defaults-file="$conf"
[root@am-01:/usr/local/mariadb#] ps -aux | grep mysqld
root      58310  0.0  0.0 112672   980 pts/0    S+   23:12   0:00 grep --color=auto mysqld

#确认 mysql 并没有运行,因为 mysql 和 mariadb 占用的端口一样,会产生冲突
[root@am-01:/usr/local/mariadb#] service mariadb start
Starting mariadb (via systemctl):                          [  确定  ]
[root@am-01:/usr/local/mariadb#] ps -aux | grep mariadb
root      58342  0.0  0.1 115392  1724 ?        S    23:13   0:00 /bin/sh /usr/local/mariadb/bin/mysqld_safe --defaults-file=/usr/local/mariadb/my.cnf --datadir=/data/mysql --pid-file=/data/mysql/am-01.pid
mysql     58458  4.3  5.1 1583876 51736 ?       Sl   23:13   0:02 /usr/local/mariadb/bin/mysqld --defaults-file=/usr/local/mariadb/my.cnf --basedir=/usr/local/mariadb --datadir=/data/mysql --plugin-dir=/usr/local/mariadb/lib/plugin --user=mysql --log-error=/data/mysql/am-01.err --pid-file=/data/mysql/am-01.pid --socket=/tmp/mysql.sock --port=3306
root      58512  0.0  0.0 112672   980 pts/0    S+   23:14   0:00 grep --color=auto mariadb
[root@am-01:/usr/local/mariadb#] netstat -ltnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1471/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2080/master         
tcp6       0      0 :::3306                 :::*                    LISTEN      58458/mysqld        
tcp6       0      0 :::22                   :::*                    LISTEN      1471/sshd           
tcp6       0      0 ::1:25                  :::*                    LISTEN      2080/master   
      
#启动 mariadb,并检查下是否成功启动,grep mysql 也能看到有没有启动,因为 mariadb 是 mysql 的分支
[root@am-01:/usr/local/mariadb#] /etc/init.d/mariadb start

#也可以使用这个命令启动 mariadb

问题点:

[root@am-01:~#] ps -aux | grep mariadb
root      58342  0.0  0.1 115392  1724 ?        S    23:13   0:00 /bin/sh /usr/local/mariadb/bin/mysqld_safe --defaults-file=/usr/local/mariadb/my.cnf --datadir=/data/mysql --pid-file=/data/mysql/am-01.pid
mysql     58458  0.6  5.1 1583876 51832 ?       Sl   23:13   0:02 /usr/local/mariadb/bin/mysqld --defaults-file=/usr/local/mariadb/my.cnf --basedir=/usr/local/mariadb --datadir=/data/mysql --plugin-dir=/usr/local/mariadb/lib/plugin --user=mysql --log-error=/data/mysql/am-01.err --pid-file=/data/mysql/am-01.pid --socket=/tmp/mysql.sock --port=3306
root      58524  0.0  0.0 112672   980 pts/0    S+   23:18   0:00 grep --color=auto mariadb

#当 mysql 和 mariadb 在同一台机器的时候,mariadb 启动的时候会调用 mysql 的--datadir=/data/mysql 参数

解决方法:

[root@am-01:~#] vim /usr/local/mariadb/my.cnf 
 [mysqld]
 datadir = /data/mariadb

#修改/usr/local/mariadb/my.cnf 的[mysqld]模块

测试:

[root@am-01:~#] killall mysqld
[root@am-01:~#] ps -aux | grep mariadb
root      58919  0.0  0.0 112672   980 pts/0    S+   23:26   0:00 grep --color=auto mariadb
[root@am-01:/data/mariadb#] service mariadb start
Starting mariadb (via systemctl):                          [  确定  ]
[root@am-01:/data/mariadb#] ps -aux | grep mariadb
root      59022  0.2  0.1 115392  1724 ?        S    23:29   0:00 /bin/sh /usr/local/mariadb/bin/mysqld_safe --defaults-file=/usr/local/mariadb/my.cnf --datadir=/data/mariadb --pid-file=/data/mariadb/am-01.pid
mysql     59141  2.8  5.5 1583776 55848 ?       Sl   23:29   0:00 /usr/local/mariadb/bin/mysqld --defaults-file=/usr/local/mariadb/my.cnf --basedir=/usr/local/mariadb --datadir=/data/mariadb --plugin-dir=/usr/local/mariadb/lib/plugin --user=mysql --log-error=/data/mariadb/am-01.err --pid-file=/datamariadb/am-01.pid --socket=/tmp/mysql.sock --port=3306
root      59181  0.0  0.0 112672   980 pts/0    S+   23:29   0:00 grep --color=auto mariadb

遇到的问题:

在修改/usr/local/mariadb/my.cnf 之后无法重启 mariadb,使用 killall 杀死进程后启动 mariadb 会提示启动成功,但使用 ps -aux | grep mariadb 却发现并没有成功,检查/data/mariadb 下的错误日志也没见到错误提示,此时有两个解决方法,重启系统或者使用 service mariadb restart,我这里是用 service mariadb restart 解决了问题

Apache 安装

Apache 是一个基金会的名字,httpd 才是我们要安装的软件包,早期它的名字就叫 apache

Apache 官网:http://www.apache.org/

编译安装:

[root@am-01:~#] wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.gz
--2018-02-27 23:54:24--  http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.gz
正在解析主机 mirrors.cnnic.cn (mirrors.cnnic.cn)... 101.6.6.178, 2402:f000:1:416:101:6:6:177
正在连接 mirrors.cnnic.cn (mirrors.cnnic.cn)|101.6.6.178|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:8638793 (8.2M) [application/octet-stream]
正在保存至: “httpd-2.4.29.tar.gz”

100%[==========================================================>] 8,638,793   1.51MB/s 用时 4.3s   

2018-02-27 23:54:34 (1.90 MB/s) - 已保存 “httpd-2.4.29.tar.gz” [8638793/8638793])
[root@am-01:~#] wget http://mirrors.hust.edu.cn/apache/apr/apr-1.6.3.tar.gz
--2018-02-27 23:55:34--  http://mirrors.hust.edu.cn/apache/apr/apr-1.6.3.tar.gz
正在解析主机 mirrors.hust.edu.cn (mirrors.hust.edu.cn)... 202.114.18.160
正在连接 mirrors.hust.edu.cn (mirrors.hust.edu.cn)|202.114.18.160|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1072661 (1.0M) [application/octet-stream]
正在保存至: “apr-1.6.3.tar.gz”

100%[==========================================================>] 1,072,661    426KB/s 用时 2.5s   

2018-02-27 23:55:37 (426 KB/s) - 已保存 “apr-1.6.3.tar.gz” [1072661/1072661])
[root@am-01:~#] wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
--2018-02-27 23:55:52--  http://mirrors.hust.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
正在解析主机 mirrors.hust.edu.cn (mirrors.hust.edu.cn)... 202.114.18.160
正在连接 mirrors.hust.edu.cn (mirrors.hust.edu.cn)|202.114.18.160|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:554301 (541K) [application/octet-stream]
正在保存至: “apr-util-1.6.1.tar.gz”

100%[==========================================================>] 554,301      263KB/s 用时 2.1s   

2018-02-27 23:56:00 (263 KB/s) - 已保存 “apr-util-1.6.1.tar.gz” [554301/554301])

#这里下载的是 httpd-2.4.29.tar.gz,apr-1.6.3.tar.gz,apr-util-1.6.1.tar.gz,因为版本变更比较快,实际应用的时候请注意下
#apr 和 apr-util 是一个通用的函数库,它让 httpd 可以不关心底层的操作系统平台,可以很方便地移植(从 linux 移植到 windows)
[root@am-01:/usr/local/src#] tar zxvf httpd-2.4.29.tar.gz
[root@am-01:/usr/local/src#] tar zxvf apr-util-1.6.1.tar.gz
[root@am-01:/usr/local/src#] tar zxvf apr-1.6.3.tar.gz

#把包解压出来
[root@am-01:/usr/local/src#] cd apr-1.6.3/
[root@am-01:/usr/local/src/apr-1.6.3#] ./configure --prefix=/usr/local/apr

#指定安装路径

checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
Configuring APR library
Platform: x86_64-pc-linux-gnu
checking for working mkdir -p... yes
APR Version: 1.6.3
checking for chosen layout... apr
checking for gcc... gcc
………………省略部分输出信息………………
configure: creating ./config.status
config.status: creating Makefile
config.status: creating include/apr.h
config.status: creating build/apr_rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating apr-1-config
config.status: creating apr.pc
config.status: creating test/Makefile
config.status: creating test/internal/Makefile
config.status: creating include/arch/unix/apr_private.h
config.status: executing libtool commands
rm: cannot remove 'libtoolT': No such file or directory
config.status: executing default commands

#对即将安装的软件进行配置,检查当前的环境是否满足要安装软件的依赖关系
[root@am-01:/usr/local/src/apr-1.6.3#] echo $?
0

#检查是否运行成功,有没有错误
[root@am-01:/usr/local/src/apr-1.6.3#] make && make install
make[1]: 进入目录“/usr/local/src/apr-1.6.3”
/usr/local/src/apr-1.6.3/build/mkdir.sh tools
/bin/sh /usr/local/src/apr-1.6.3/libtool --silent --mode=compile gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I./include -I/usr/local/src/apr-1.6.3/include/arch/unix -I./include/arch/unix -I/usr/local/src/apr-1.6.3/include/arch/unix -I/usr/local/src/apr-1.6.3/include -I/usr/local/src/apr-1.6.3/include/private -I/usr/local/src/apr-1.6.3/include/private  -o tools/gen_test_char.lo -c tools/gen_test_char.c && touch tools/gen_test_char.lo
………………省略部分输出信息………………
/usr/bin/install -c -m 644 build/apr_rules.out /usr/local/apr/build-1/apr_rules.mk
/usr/bin/install -c -m 644 /usr/local/src/apr-1.6.3/build/apr_common.m4 /usr/local/apr/build-1
/usr/bin/install -c -m 644 /usr/local/src/apr-1.6.3/build/find_apr.m4 /usr/local/apr/build-1
/usr/bin/install -c -m 755 apr-config.out /usr/local/apr/bin/apr-1-config

#编译安装
[root@am-01:/usr/local/src/apr-1.6.3#] echo $?
0

#检查是否运行成功,有没有错误,至此,apr 安装完成
[root@am-01:/usr/local/src/apr-1.6.3#] cd ../apr-util-1.6.1/
[root@am-01:/usr/local/src/apr-util-1.6.1#] ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

#指定安装路径及 apr 的安装目录

checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
………………省略部分输出信息………………
config.status: creating include/apu_want.h
config.status: creating test/Makefile
config.status: creating include/private/apu_config.h
config.status: executing default commands

#对即将安装的软件进行配置,检查当前的环境是否满足要安装软件的依赖关系
[root@am-01:/usr/local/src/apr-util-1.6.1#] echo $?
0

#检查是否运行成功,有没有错误
[root@am-01:/usr/local/src/apr-util-1.6.1#] make && make install
xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录

#我这里提示这个错误
[root@am-01:/usr/local/src/apr-util-1.6.1#] yum list | grep expat
expat.x86_64                              2.1.0-8.el7                  @anaconda
expat.i686                                2.1.0-10.el7_3               base     
expat.x86_64                              2.1.0-10.el7_3               base     
expat-devel.i686                          2.1.0-10.el7_3               base     
expat-devel.x86_64                        2.1.0-10.el7_3               base     
expat-static.i686                         2.1.0-10.el7_3               base     
expat-static.x86_64                       2.1.0-10.el7_3               base     
lua-expat.x86_64                          1.3.0-4.el7                  epel     
mingw32-expat.noarch                      2.1.0-4.el7                  epel     
mingw32-expat-static.noarch               2.1.0-4.el7                  epel     
mingw64-expat.noarch                      2.1.0-4.el7                  epel     
mingw64-expat-static.noarch               2.1.0-4.el7                  epel     
nodejs-node-expat.x86_64                  2.1.4-5.el7                  epel   

#按关键字搜索,从网上得知,安装 expat-devel.x86_64
[root@am-01:/usr/local/src/apr-util-1.6.1#] yum -y install expat-devel.x86_64
已加载插件:fastestmirror
base                                                                        | 3.6 kB  00:00:00     
epel/x86_64/metalink                                                        | 6.6 kB  00:00:00     
extras                                                                      | 3.4 kB  00:00:00     
updates                                                                     | 3.4 kB  00:00:00     
………………省略部分输出信息………………
已安装:
  expat-devel.x86_64 0:2.1.0-10.el7_3                                                              

作为依赖被升级:
  expat.x86_64 0:2.1.0-10.el7_3                                                                    

完毕!
[root@am-01:/usr/local/src/apr-util-1.6.1#] make && make install
make[1]: 进入目录“/usr/local/src/apr-util-1.6.1”
/bin/sh /usr/local/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I/usr/local/src/apr-util-1.6.1/include -I/usr/local/src/apr-util-1.6.1/include/private  -I/usr/local/apr/include/apr-1    -o xml/apr_xml.lo -c xml/apr_xml.c && touch xml/apr_xml.lo
………………省略部分输出信息………………
/usr/bin/install -c -m 644 aprutil.exp /usr/local/apr-util/lib
/usr/bin/install -c -m 755 apu-config.out /usr/local/apr-util/bin/apu-1-config

#重新 make && make install,没错误提示
[root@am-01:/usr/local/src/apr-util-1.6.1#] echo $?
0

#检查是否运行成功,有没有错误,至此,apr-util 安装完成
[root@am-01:/usr/local/src/apr-util-1.6.1#] cd ../httpd-2.4.29/
[root@am-01:/usr/local/src/httpd-2.4.29#] ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most

#定安装路径及 apr 和 apr-util 的安装目录,--enable-so 让 apache 加载模块,--enable-mods-shared=most 加载大部分模块

configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

#这里提示这个错误,pcre 是正则表达式的一个驱动库
[root@am-01:/usr/local/src/httpd-2.4.29#] yum list | grep pcre
pcre.x86_64                               8.32-14.el7                  @anaconda
ghc-pcre-light.x86_64                     0.4-13.el7                   epel     
ghc-pcre-light-devel.x86_64               0.4-13.el7                   epel     
mingw32-pcre.noarch                       8.38-1.el7                   epel     
mingw32-pcre-static.noarch                8.38-1.el7                   epel     
mingw64-pcre.noarch                       8.38-1.el7                   epel     
mingw64-pcre-static.noarch                8.38-1.el7                   epel     
pcre.i686                                 8.32-17.el7                  base     
pcre.x86_64                               8.32-17.el7                  base     
pcre-devel.i686                           8.32-17.el7                  base     
pcre-devel.x86_64                         8.32-17.el7                  base     
pcre-static.i686                          8.32-17.el7                  base     
pcre-static.x86_64                        8.32-17.el7                  base     
pcre-tools.x86_64                         8.32-17.el7                  base     
pcre2.i686                                10.23-2.el7                  base     
pcre2.x86_64                              10.23-2.el7                  base     
pcre2-devel.i686                          10.23-2.el7                  base     
pcre2-devel.x86_64                        10.23-2.el7                  base     
pcre2-static.i686                         10.23-2.el7                  base     
pcre2-static.x86_64                       10.23-2.el7                  base     
pcre2-tools.x86_64                        10.23-2.el7                  base     
pcre2-utf16.i686                          10.23-2.el7                  base     
pcre2-utf16.x86_64                        10.23-2.el7                  base     
pcre2-utf32.i686                          10.23-2.el7                  base     
pcre2-utf32.x86_64                        10.23-2.el7                  base     

#按关键字搜索,从网上得知,安装 pcre-devel.x86_64
[root@am-01:/usr/local/src/httpd-2.4.29#] yum -y install pcre-devel.x86_64
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * epel: mirror01.idc.hinet.net
………………省略部分输出信息………………
已安装:
  pcre-devel.x86_64 0:8.32-17.el7                                                                  

作为依赖被升级:
  pcre.x86_64 0:8.32-17.el7                                                                        

完毕!
[root@am-01:/usr/local/src/httpd-2.4.29#] ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
………………省略部分输出信息………………
    Server Version: 2.4.29
    Install prefix: /usr/local/apache2.4
    C compiler:     gcc -std=gnu99
    CFLAGS:          -g -O2 -pthread  
    CPPFLAGS:        -DLINUX -D_REENTRANT -D_GNU_SOURCE  
    LDFLAGS:           
    LIBS:             
    C preprocessor: gcc -E

#重新对即将安装的软件进行配置,检查当前的环境是否满足要安装软件的依赖关系
[root@am-01:/usr/local/src/httpd-2.4.29#] echo $?
0

#检查是否运行成功,有没有错误
[root@am-01:/usr/local/src/httpd-2.4.29#] make && make install
collect2: error: ld returned 1 exit status
make[2]: *** [htpasswd] 错误 1
make[2]: 离开目录“/usr/local/src/httpd-2.4.29/support”
make[1]: *** [all-recursive] 错误 1
make[1]: 离开目录“/usr/local/src/httpd-2.4.29/support”
make: *** [all-recursive] 错误 1

#报以上错误,经查询,有几种解决方案:
#第一:把 apr 和 apr-util 重新编译安装
#第二:重现下载 apr-util 1.5 版本,重新编译安装
#第三:把/usr/local/src 下的 apr 和 apr-util 拷贝到/usr/local/src/httpd-2.4.29/srclib 下,重新对 apache 编译安装,命令如下
#cd /usr/local/src/
#cp -r apr-1.6.3  /usr/local/src/httpd-2.4.29/srclib/apr
#cp -r apr-util-1.6.1  /usr/local/src/httpd-2.4.29/srclib/apr-util
#./configure --with-included-apr --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
#make &&make install
[root@am-01:/usr/local/src/httpd-2.4.29#] ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
[root@am-01:/usr/local/src/httpd-2.4.29#] make && make install
………………此处省略输出信息………………

#apache 也需要重新编译安装一次
[root@am-01:/usr/local/src/httpd-2.4.29#] echo $?
0

#检查是否运行成功,有没有错误,至此,apache 安装完成
[root@am-01:~#] cd /usr/local/apache2.4/
[root@am-01:/usr/local/apache2.4#] ls
bin  build  cgi-bin  conf  error  htdocs  icons  include  logs  man  manual  modules

#bin 为程序命令目录,conf 为配置文件目录,htdocs 为默认的站点存放目录,logs 为日志相关的目录,modules 为扩展模块的存放目录
[root@am-01:/usr/local/apache2.4#] /usr/local/apache2.4/bin/httpd -M
AH00557: httpd: apr_sockaddr_info_get() failed for am-01
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
mpm_event_module (static)
authn_file_module (shared)
authn_core_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_user_module (shared)
authz_core_module (shared)
access_compat_module (shared)
auth_basic_module (shared)
reqtimeout_module (shared)
filter_module (shared)
mime_module (shared)
log_config_module (shared)
env_module (shared)
headers_module (shared)
setenvif_module (shared)
version_module (shared)
unixd_module (shared)
status_module (shared)
autoindex_module (shared)
dir_module (shared)
alias_module (shared)

#查看加载的模块,static 表示静态模块,是指直接把模块编译进主脚本 httpd 中,shared 表示扩展的模块,是一个叫.so 的文件,保存在 modules 目录下
[root@am-01:/usr/local/apache2.4#] /usr/local/apache2.4/bin/apachectl start
AH00557: httpd: apr_sockaddr_info_get() failed for am-01
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
httpd (pid 60820) already running

#启动 httpd,这里的提示暂时不用管
[root@am-01:/usr/local/apache2.4#] ps -aux|grep httpd
root      60820  0.0  0.2  75168  2296 ?        Ss   05:09   0:00 /usr/local/apache2.4/bin/httpd
daemon    60821  0.0  0.4 364132  4280 ?        Sl   05:09   0:00 /usr/local/apache2.4/bin/httpd
daemon    60822  0.0  0.4 364132  4284 ?        Sl   05:09   0:00 /usr/local/apache2.4/bin/httpd
daemon    60824  0.0  0.4 364132  4284 ?        Sl   05:09   0:00 /usr/local/apache2.4/bin/httpd
root      60959  0.0  0.0 112676   980 pts/0    S+   05:51   0:00 grep --color=auto httpd
[root@am-01:/usr/local/apache2.4#] netstat -lnpt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1111/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1837/master         
tcp6       0      0 :::3306                 :::*                    LISTEN      60767/mysqld        
tcp6       0      0 :::80                   :::*                    LISTEN      60820/httpd         
tcp6       0      0 :::22                   :::*                    LISTEN      1111/sshd           
tcp6       0      0 ::1:25                  :::*                    LISTEN      1837/master   

#测试可见,httpd 已经启动成功

扩展

apache dso:

https://yq.aliyun.com/articles/6298

apache apxs:

http://man.chinaunix.net/newsoft/ApacheMenual_CN_2.2new/programs/apxs.html

apache 工作模式:

http://www.cnblogs.com/fnng/archive/2012/11/20/2779977.html