时间:2021-07-01 10:21:17 帮助过:14人阅读
- 11.6 MariaDB安装 - 11.7/11.8/11.9 Apache安装 - 扩展 - 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 # 11.6 MariaDB 安装 - 先进入到/usr/local/src 目录下 - 下载包mariadb包,因为这个是国外的包 所以网速慢,需要提前准备好,需要下50分钟多 ``` [root@aminglinux-001 ~]# cd /usr/local/src [root@aminglinux-001 src]# ls httpd-2.4.27 httpd-2.4.27.tar.gz mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz [root@aminglinux-001 src]# [root@aminglinux-001 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 --2017-09-24 21:17:43-- 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 正在解析主机 downloads.mariadb.com (downloads.mariadb.com)... 51.255.94.155, 2001:41d0:1004:249b:: 正在连接 downloads.mariadb.com (downloads.mariadb.com)|51.255.94.155|:443... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:541295045 (516M) [application/octet-stream] 正在保存至: “mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz” 100%[=====================================================>] 541,295,045 185KB/s 用时 68m 38s 2017-09-24 22:26:27 (128 KB/s) - 已保存 “mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz” [541295045/541295045]) [root@aminglinux-001 src]# ``` - 下载好了压缩包,首先是解压tar -zxvf 解压 ``` [root@aminglinux-001 src]# tar -zxvf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz mariadb-10.2.6-linux-glibc_214-x86_64/support-files/policy/selinux/mariadb-server.te mariadb-10.2.6-linux-glibc_214-x86_64/support-files/policy/selinux/README mariadb-10.2.6-linux-glibc_214-x86_64/support-files/policy/selinux/mariadb.te mariadb-10.2.6-linux-glibc_214-x86_64/support-files/mysql.server [root@aminglinux-001 src]# [root@aminglinux-001 src]# ls httpd-2.4.27 mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz httpd-2.4.27.tar.gz mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz mariadb-10.2.6-linux-glibc_214-x86_64 [root@aminglinux-001 src]# ``` - 把这个解压出来的文件 移到这个目录下并且改名为 mariadb mv /usr/local/mariadb ``` [root@aminglinux-001 src]# mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb [root@aminglinux-001 src]# ``` ``` [root@aminglinux-001 src]# cd /usr/local/mariadb [root@aminglinux-001 mariadb]# [root@aminglinux-001 mariadb]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb/ --datadir=/data/mariadb Installing MariaDB/MySQL system tables in ‘/data/mariadb‘ ... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER ! To do so, start the server, then issue the following commands: ‘/usr/local/mariadb//bin/mysqladmin‘ -u root password ‘new-password‘ ‘/usr/local/mariadb//bin/mysqladmin‘ -u root -h aminglinux-001 password ‘new-password‘ Alternatively you can run: ‘/usr/local/mariadb//bin/mysql_secure_installation‘ which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the MariaDB Knowledgebase at http://mariadb.com/kb or the MySQL manual for more instructions. You can start the MariaDB daemon with: cd ‘/usr/local/mariadb/‘ ; /usr/local/mariadb//bin/mysqld_safe --datadir=‘/data/mariadb‘ You can test the MariaDB daemon with mysql-test-run.pl cd ‘/usr/local/mariadb//mysql-test‘ ; perl mysql-test-run.pl Please report any problems at http://mariadb.org/jira The latest information about MariaDB is available at http://mariadb.org/. You can find additional information about the MySQL part at: http://dev.mysql.com Consider joining MariaDB‘s strong and vibrant community: https://mariadb.org/get-involved/ [root@aminglinux-001 mariadb]# echo $? 0 [root@aminglinux-001 mariadb]# [root@aminglinux-001 mariadb]# ls /data/mariadb/ aria_log.00000001 ib_buffer_pool ib_logfile0 mysql test aria_log_control ibdata1 ib_logfile1 performance_schema [root@aminglinux-001 mariadb]# ls /data/mysql aminglinux-001.err auto.cnf ib_logfile0 mysql test aminglinux-001.pid ibdata1 ib_logfile1 performance_schema [root@aminglinux-001 mariadb]# ``` - 下面拷贝配置文件,定义启动脚本 ``` [root@aminglinux-001 mariadb]# ls support-files/ binary-configure my-large.cnf mysql-log-rotate wsrep_notify magic my-medium.cnf mysql.server my-huge.cnf my-small.cnf policy my-innodb-heavy-4G.cnf mysqld_multi.server wsrep.cnf [root@aminglinux-001 mariadb]# [root@aminglinux-001 mariadb]# vim support-files/my-small.cnf [root@aminglinux-001 mariadb]# free total used free shared buff/cache available Mem: 999936 562720 126040 9440 311176 251040 Swap: 2097148 19476 2077672 [root@aminglinux-001 mariadb]# ``` - 拷贝一个配置文件,再拷贝一个启动脚本 ``` [root@aminglinux-001 mariadb]# cp support-files/my-small.cnf /usr/local/mariadb/my.cnf [root@aminglinux-001 mariadb]# cp support-files/mysql.server /etc/init.d/mariadb [root@aminglinux-001 mariadb]# ``` - 可以看下里面的内容 ``` [root@aminglinux-001 mariadb]# vim /usr/local/mariadb/my.cnf # The following options will be passed to all MySQL clients [client] #password = your_password port = 3306 socket = /tmp/mysql.sock # Here follows entries for some specific programs # The MySQL server [mysqld] port = 3306 socket = /tmp/mysql.sock skip-external-locking key_buffer_size = 16K max_allowed_packet = 1M table_open_cache = 4 sort_buffer_size = 64K read_buffer_size = 256K read_rnd_buffer_size = 256K net_buffer_length = 2K thread_stack = 240K # Don‘t listen on a TCP/IP port at all. This can be a security enhancement, # if all processes that need to connect to mysqld run on the same host. # All interaction with mysqld must be made via Unix sockets or named pipes. # Note that using this option without enabling named pipes on Windows # (using the "enable-named-pipe" option) will render mysqld useless! 43,1 24% [root@aminglinux-001 mariadb]# ``` - /usr/local/mariadb/my.cnf这个文件基本上不用改,要改的是启动脚本 ``` [root@aminglinux-001 mariadb]# vim /etc/init.d/mariadb # If you want to affect other MySQL variables, you should make your changes # in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files. # If you change base dir, you must also change datadir. These may get # overwritten by settings in the MySQL configuration files. basedir= datadir= # Default value, in seconds, afterwhich the script should timeout waiting # for server start. # Value here is overridden by value in my.cnf. # 0 means don‘t wait at all # Negative numbers mean to wait indefinitely service_startup_timeout=900 ``` - 把这个上面的 - basedir= datadir= 改下 ``` # If you change base dir, you must also change datadir. These may get # overwritten by settings in the MySQL configuration files. basedir=/usr/local/mariadb datadir=/data/mariadb conf=$basedir/my.cnf # Default value, in seconds, afterwhich the script should timeout waiting # for server start. # Value here is overridden by value in my.cnf. # 0 means don‘t wait at all # Negative numbers mean to wait indefinitely -- 插入 -- 48,21 6% $bindir/mysqld_safe --defaults-file="$conf" --datadir="$datadir" --pid-file="$mysqld_pid_file_path" "$@" & wait_for_ready; return_value=$? -- 插入 -- 300,51 65% ``` - 接下来可以尝试启动mariadb服务,启动之前可以先看下 mysqld 服务有没有启动 ``` [root@aminglinux-001 mariadb]# vim /etc/init.d/mariadb [root@aminglinux-001 mariadb]# ps aux |grep mysql root 1172 0.0 0.0 115376 632 ? S 9月24 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/aminglinux-001.pid mysql 1686 0.0 44.6 981248 446560 ? Sl 9月24 0:15 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/aminglinux-001.err --pid-file=/data/mysql/aminglinux-001.pid --socket=/tmp/mysql.sock --port=3306 root 4645 0.0 0.0 112664 976 pts/0 S+ 00:20 0:00 grep --color=automysql ``` - 有了先关闭下mysqld 服务 ``` [root@aminglinux-001 mariadb]# service mysqld stop Shutting down MySQL.. SUCCESS! [root@aminglinux-001 mariadb]# ps aux |grep mysql root 4677 0.0 0.0 112664 976 pts/0 R+ 00:21 0:00 grep --color=automysql ``` - 再来尝试下启动mariadb 服务 ``` [root@aminglinux-001 mariadb]# /etc/init.d/mariadb start Reloading systemd: [ 确定 ] Starting mariadb (via systemctl): [ 确定 ] [root@aminglinux-001 mariadb]# ps aux |grep mariadb root 4721 0.2 0.1 115376 1684 ? S 00:22 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mariadb/my.cnf --datadir=/data/mysql --pid-file=/data/mysql/aminglinux-001.pid mysql 4957 4.4 10.2 684592 102452 ? Sl 00:22 0:00 /usr/local/mysql/bin/mysqld --defaults-file=/usr/local/mariadb/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/aminglinux-001.err --pid-file=/data/mysql/aminglinux-001.pid --socket=/tmp/mysql.sock --port=3306 root 4986 0.0 0.0 112664 976 pts/0 S+ 00:22 0:00 grep --color=automariadb [root@aminglinux-001 mariadb]# ``` - 服务启动了,看看端口 ``` [root@aminglinux-001 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 1143/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1969/master tcp6 0 0 :::3306 :::* LISTEN 4957/mysqld tcp6 0 0 :::22 :::* LISTEN 1143/sshd tcp6 0 0 ::1:25 :::* LISTEN 1969/master [root@aminglinux-001 mariadb]# ``` - 实际上应该这样 ``` [root@aminglinux-001 mariadb]# vi /usr/local/mariadb/my.cnf # The following options will be passed to all MySQL clients [client] #password = your_password port = 3306 socket = /tmp/mysql.sock # Here follows entries for some specific programs # The MySQL server [mysqld] datadir = /data/mariadb port = 3306 socket = /tmp/mysql.sock skip-external-locking -- INSERT -- [root@aminglinux-001 mariadb]# vi /usr/local/mariadb/my.cnf [root@aminglinux-001 mariadb]# /etc/init.d/mariadb restart Restarting mariadb (via systemctl): [ 确定 ] [root@aminglinux-001 mariadb]# ps aux |grep mariadb root 9920 0.0 0.1 115380 1736 ? S 23:16 0:00 /bin/sh /usr/local/mariadb/bin/mysqld_safe --datadir=/data/mariadb --pid-file=/data/mariadb/aminglinux-001.pid mysql 10072 1.0 6.1 1125020 61912 ? Sl 23:17 0:00 /usr/local/mariadb/bin/mysqld --basedir=/usr/local/mariadb --datadir=/data/mariad --plugin-dir=/usr/local/mariadb/lib/plugin --user=mysql --log-error=/data/mariadb/aminglinux-001.err --pid-file=/data/mariadb/aminglinux-001.pid --socket=/tmp/mysql.sock --port=3306 root 10119 0.0 0.0 112664 976 pts/0 R+ 23:17 0:00 grep --color=auto mariadb [root@aminglinux-001 mariadb]# [root@aminglinux-001 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 1127/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1865/master tcp6 0 0 :::3306 :::* LISTEN 10072/mysqld tcp6 0 0 :::22 :::* LISTEN 1127/sshd tcp6 0 0 ::1:25 :::* LISTEN 1865/master [root@aminglinux-001 mariadb]# ``` # 11.7Apache安装 上 - Apache是一个基金会的名字,httpd才是我们要安装的软件包,早期它的名字就叫apache - Apache官网www.apache.org - Apache 2.4源码包:wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.27.tar.gz - apr: wget wget http://mirrors.hust.edu.cn/apache/apr/apr-1.6.2.tar.gz - apr-util: wget wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.6.0.tar.bz2 - 先下载httpd包、 apr 、apr-util ``` [root@aminglinux-001 ~]# wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.27.tar.gz --2017-09-26 23:29:15-- http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.27.tar.gz 正在解析主机 mirrors.cnnic.cn (mirrors.cnnic.cn)... 101.6.6.177, 2402:f000:1:416:101:6:6:177 正在连接 mirrors.cnnic.cn (mirrors.cnnic.cn)|101.6.6.177|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:8603417 (8.2M) [application/octet-stream] 正在保存至: “httpd-2.4.27.tar.gz” 100%[=========================================================>] 8,603,417 1.30MB/s 用时 7.6s 2017-09-26 23:29:23 (1.07 MB/s) - 已保存 “httpd-2.4.27.tar.gz” [8603417/8603417]) [root@aminglinux-001 ~]# wget http://mirrors.hust.edu.cn/apache/apr/apr-1.6.2.tar.gz --2017-09-26 23:38:13-- http://mirrors.hust.edu.cn/apache/apr/apr-1.6.2.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 长度:1071074 (1.0M) [application/octet-stream] 正在保存至: “apr-1.6.2.tar.gz” 100%[=========================================================>] 1,071,074 63.4KB/s 用时 14s 2017-09-26 23:38:27 (74.3 KB/s) - 已保存 “apr-1.6.2.tar.gz” [1071074/1071074]) [root@aminglinux-001 ~]# wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.6.0.tar.bz2 --2017-09-26 23:38:42-- http://mirrors.hust.edu.cn/apache/apr/apr-util-1.6.0.tar.bz2 正在解析主机 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 长度:428750 (419K) [application/octet-stream] 正在保存至: “apr-util-1.6.0.tar.bz2” 100%[=========================================================>] 428,750 512KB/s 用时 0.8s 2017-09-26 23:38:43 (512 KB/s) - 已保存 “apr-util-1.6.0.tar.bz2” [428750/428750]) [root@aminglinux-001 ~]# [root@aminglinux-001 ~]# ls 111 1.txt~ 3.txt apr-1.6.2.tar.gz get-pip.py 123 1.txt.bak 4.txt apr-util-1.6.0.tar.bz2 grep 1_heard.txt 234 99 awk httpd-2.4.27.tar.gz 1_sorft.txt 2.txt aminglinux bb.txt sed 1.txt 2.txt.bak anaconda-ks.cfg.1 biji.txt test [root@aminglinux-001 ~]# ``` - 再把这些包apr包移到/usr/local/src/ 下 ``` [root@aminglinux-001 ~]# mv apr-* /usr/local/src/ [root@aminglinux-001 ~]# cd /usr/local/src/ [root@aminglinux-001 src]# ls apr-1.6.2.tar.gz httpd-2.4.27 mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz apr-util-1.6.0.tar.bz2 httpd-2.4.27.tar.gz mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz [root@aminglinux-001 src]# ``` - 准备工作就做完了 # 11.8 Apache安装 中 - apr和apr-util是一个通用的函数库,它让httpd可以不关心底层的操作系统平台,可以很方便地移植(从linux移植到windows) - tar zxvf httpd-2.4.27.tar.gz - tar zxvf apr-1.6.2.tar.gz - tar jxvf apr-util-1.6.0.tar.bz2 - 下载完之后分别把他们解压 ``` [root@aminglinux-001 src]# tar zxvf httpd-2.4.27.tar.gz httpd-2.4.27/test/test_select.c httpd-2.4.27/test/time-sem.c httpd-2.4.27/VERSIONING [root@aminglinux-001 src]# [root@aminglinux-001 src]# tar zxvf apr- apr-1.6.2.tar.gz apr-util-1.6.0.tar.bz2 [root@aminglinux-001 src]# tar zxvf apr-1.6.2.tar.gz apr-1.6.2/apr.dsw apr-1.6.2/libapr.dep [root@aminglinux-001 src]# 解压这个bz2 包的时候需要 用tar jxvf 而不是 上面的 gz包的格式tar zxvf [root@aminglinux-001 src]# tar jxvf apr-util-1.6.0.tar.bz2 apr-util-1.6.0/dbm/apr_dbm_gdbm.c apr-util-1.6.0/dbm/NWGNUdbmgdbm apr-util-1.6.0/libaprutil.dsp [root@aminglinux-001 src]# [root@aminglinux-001 src]# ls apr-1.6.2 apr-util-1.6.0.tar.bz2 mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz apr-1.6.2.tar.gz httpd-2.4.27 mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz apr-util-1.6.0 httpd-2.4.27.tar.gz [root@aminglinux-001 src]# ``` - 1. 首先安装apr - cd /usr/local/src/apr-1.6.2 - ./configure --prefix=/usr/local/apr - make && make install ``` [root@aminglinux-001 src]# cd apr-1.6.2/ [root@aminglinux-001 apr-1.6.2]# ./configure --prefix=/usr/local/apr 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@aminglinux-001 apr-1.6.2]# echo $? 0 [root@aminglinux-001 apr-1.6.2]# [root@aminglinux-001 apr-1.6.2]# make && make install done /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.2/build/apr_common.m4 /usr/local/apr/build-1 /usr/bin/install -c -m 644 /usr/local/src/apr-1.6.2/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@aminglinux-001 apr-1.6.2]# ``` - 安装好后 查看下,下面会有四个目录 ``` [root@aminglinux-001 apr-1.6.2]# ls /usr/local/apr/ bin build-1 include lib [root@aminglinux-001 apr-1.6.2]# ``` - 2.安装apr-util - cd /usr/local/src/apr-util-1.6.0/ ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make && make install ``` [root@aminglinux-001 apr-1.6.2]# cd ../apr-util-1.6.0/ [root@aminglinux-001 apr-util-1.6.0]#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr config.status: creating test/Makefile config.status: creating include/private/apu_config.h config.status: executing default commands [root@aminglinux-001 apr-util-1.6.0]# [root@aminglinux-001 apr-util-1.6.0]# make && make install See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- /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 [root@aminglinux-001 apr-util-1.6.0]# [root@aminglinux-001 apr-util-1.6.0]# ls /usr/local/apr-util/ bin include lib [root@aminglinux-001 apr-util-1.6.0]# ``` - 3.安装htppd - cd /usr/local/src/httpd-2.4.27 ./configure \ //这里的反斜杠是脱义字符,加上它我们可以把一行命令写成多行 --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 ls /usr/local/apache2.4/modules /usr/local/apache2.4/bin/httpd -M //查看加载的模块 ``` [root@aminglinux-001 apr-util-1.6.0]# cd .. [root@aminglinux-001 src]# cd httpd-2.4.27/ [root@aminglinux-001 httpd-2.4.27]# ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most config.status: executing default commands configure: summary of build options: Server Version: 2.4.27 Install prefix: /usr/local/apache2.4 C compiler: gcc -std=gnu99 CFLAGS: -g -O2 -pthread LDFLAGS: LIBS: CPPFLAGS: -DLINUX -D_REENTRANT -D_GNU_SOURCE C preprocessor: gcc -E [root@aminglinux-001 httpd-2.4.27]# echo $? 0 [root@aminglinux-001 httpd-2.4.27]# ``` - make ``` [root@aminglinux-001 httpd-2.4.27]# make make[4]: 进入目录“/usr/local/src/httpd-2.4.27/modules/mappers” make[4]: 对“local-shared-build”无需做任何事。 make[4]: 离开目录“/usr/local/src/httpd-2.4.27/modules/mappers” make[3]: 离开目录“/usr/local/src/httpd-2.4.27/modules/mappers” make[2]: 离开目录“/usr/local/src/httpd-2.4.27/modules” make[2]: 进入目录“/usr/local/src/httpd-2.4.27/support” make[2]: 离开目录“/usr/local/src/httpd-2.4.27/support” make[1]: 离开目录“/usr/local/src/httpd-2.4.27” [root@aminglinux-001 httpd-2.4.27]# ``` - make install ``` [root@aminglinux-001 httpd-2.4.27]# make install Installing man pages and online manual mkdir /usr/local/apache2.4/man mkdir /usr/local/apache2.4/man/man1 mkdir /usr/local/apache2.4/man/man8 mkdir /usr/local/apache2.4/manual make[1]: 离开目录“/usr/local/src/httpd-2.4.27” [root@aminglinux-001 httpd-2.4.27]# ``` # 11.9Apache 安装 下 - 进入到apache2.4 目录下 ``` [root@aminglinux-001 httpd-2.4.27]# cd /usr/local/apache2.4/ [root@aminglinux-001 apache2.4]# ls bin build cgi-bin conf error htdocs icons include logs man manual modules [root@aminglinux-001 apache2.4]# ls bin/ht htcacheclean htdbm htdigest htpasswd httpd httxt2dbm ``` - 接触到的目录是bin ,bin下面是一个可执行文件,启动服务下面有个文件httpd ,这是它的核心二进制文件 ``` [root@aminglinux-001 apache2.4]# ls bin/httpd bin/httpd [root@aminglinux-001 apache2.4]# ls -l bin/httpd -rwxr-xr-x 1 root root 1111680 9月 27 00:37 bin/httpd [root@aminglinux-001 apache2.4]# du -sh !$ du -sh bin/httpd 1.1M bin/httpd [root@aminglinux-001 apache2.4]# ls bin build cgi-bin conf error htdocs icons include logs man manual modules ``` - conf目录 是配置文件所在目录 ``` [root@aminglinux-001 apache2.4]# ls conf/ extra httpd.conf magic mime.types original ``` - htdocs 存放了一个访问页,默认网站会放到这个目录下 ``` [root@aminglinux-001 apache2.4]# ls htdocs/ index.html ``` - 日志 错误日志,访问日志 帮助文档 ``` [root@aminglinux-001 apache2.4]# ls logs/ ``` ``` [root@aminglinux-001 apache2.4]# ls man man1 man8 ``` - 扩展模块,模块就在这个目录下 - 每一个模块会代表一个功能 ``` [root@aminglinux-001 apache2.4]# ls modules/ httpd.exp mod_authz_groupfile.so mod_ext_filter.so mod_proxy_balancer.so mod_session_cookie.so mod_access_compat.so mod_authz_host.so mod_file_cache.so mod_proxy_connect.so mod_session_dbd.so mod_actions.so mod_authz_owner.so mod_filter.so mod_proxy_express.so mod_session.so mod_alias.so mod_authz_user.so mod_headers.so mod_proxy_fcgi.so mod_setenvif.so mod_allowmethods.so mod_autoindex.so mod_include.so mod_proxy_fdpass.so mod_slotmem_shm.so mod_auth_basic.so mod_buffer.so mod_info.so mod_proxy_ftp.so mod_socache_dbm.so mod_auth_digest.so mod_cache_disk.so mod_lbmethod_bybusyness.so mod_proxy_hcheck.so mod_socache_memcache.so mod_auth_form.so mod_cache.so mod_lbmethod_byrequests.so mod_proxy_http.so mod_socache_shmcb.so mod_authn_anon.so mod_cache_socache.so mod_lbmethod_bytraffic.so mod_proxy_scgi.so mod_speling.so mod_authn_core.so mod_cgid.so mod_lbmethod_heartbeat.so mod_proxy.so mod_status.so mod_authn_dbd.so mod_dav_fs.so mod_log_config.so mod_proxy_wstunnel.so mod_substitute.so mod_authn_dbm.so mod_dav.so mod_log_debug.so mod_ratelimit.so mod_unique_id.so mod_authn_file.so mod_dbd.so mod_logio.so mod_remoteip.so mod_unixd.so mod_authn_socache.so mod_dir.so mod_macro.so mod_reqtimeout.so mod_userdir.so mod_authz_core.so mod_dumpio.so mod_mime.so mod_request.so mod_version.so mod_authz_dbd.so mod_env.so mod_negotiation.so mod_rewrite.so mod_vhost_alias.so mod_authz_dbm.so mod_expires.so mod_proxy_ajp.so mod_sed.so mod_watchdog.so [root@aminglinux-001 apache2.4]# du -sh modules/ 2.8M modules/ [root@aminglinux-001 apache2.4]# ``` - 怎么查看apache 都加载了哪些模块呢 - 用命令/usr/local/apache2.4/bin/apachectl -M - 或者 /usr/local/apache2.4/bin/httpd -M ``` [root@aminglinux-001 apache2.4]# /usr/local/apache2.4/bin/httpd -M AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using fe80::a152:bbdf:8b2b:db9b. 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) [root@aminglinux-001 apache2.4]# /usr/local/apache2.4/bin/apachectl -M AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using fe80::a152:bbdf:8b2b:db9b. 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) [root@aminglinux-001 apache2.4]# ``` - 安装完成了 现在启动httpd服务 使用命令/usr/local/apache2.4/bin/apachectl start ``` [root@aminglinux-001 apache2.4]# /usr/local/apache2.4/bin/apachectl start AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using fe80::a152:bbdf:8b2b:db9b. Set the ‘ServerName‘ directive globally to suppress this message [root@aminglinux-001 apache2.4]# ps aux |grep httpd root 37616 0.0 0.2 95656 2600 ? Ss 00:45 0:00 /usr/local/apache2.4/bin/httpd -k start daemon 37617 0.0 0.4 382484 4432 ? Sl 00:45 0:00 /usr/local/apache2.4/bin/httpd -k start daemon 37618 0.0 0.4 382484 4432 ? Sl 00:45 0:00 /usr/local/apache2.4/bin/httpd -k start daemon 37619 0.0 0.4 382484 4432 ? Sl 00:45 0:00 /usr/local/apache2.4/bin/httpd -k start root 37702 0.0 0.0 112664 972 pts/0 R+ 00:45 0:00 grep --color=auto httpd [root@aminglinux-001 apache2.4]# netstat -lntp 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 1127/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1865/master tcp6 0 0 :::3306 :::* LISTEN 10072/mysqld tcp6 0 0 :::80 :::* LISTEN 37616/httpd tcp6 0 0 :::22 :::* LISTEN 1127/sshd tcp6 0 0 ::1:25 :::* LISTEN 1865/master [root@aminglinux-001 apache2.4]# ``` - 看看端口号80 httpd默认监听80端口 - mysqld 默认监听3306 端口 - 25端口是发邮件的 master - 22端口是远程登录的 sshd ## - 扩展 - 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
11.6 -11.9 MariaDB,Apache 安装
标签:11.6 -11.9 mariadb apache 安装