11.6 -11.9 MariaDB,Apache 安裝
阿新 • • 發佈:2017-09-28
11.6 -11.9 mariadb apache 安裝
- 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分鐘多 ``` [[email protected] ~]# cd /usr/local/src [[email protected] src]# ls httpd-2.4.27 httpd-2.4.27.tar.gz mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz [[email protected] src]# [[email protected] 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]) [[email protected] src]# ``` - 下載好了壓縮包,首先是解壓tar -zxvf 解壓 ``` [[email protected] 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 [[email protected] src]# [[email protected] 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 [[email protected] src]# ``` - 把這個解壓出來的文件 移到這個目錄下並且改名為 mariadb mv /usr/local/mariadb ``` [[email protected] src]# mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb [[email protected] src]# ``` ``` [[email protected] src]# cd /usr/local/mariadb [[email protected] mariadb]# [[email protected] 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/ [[email protected] mariadb]# echo $? 0 [[email protected] mariadb]# [[email protected] mariadb]# ls /data/mariadb/ aria_log.00000001 ib_buffer_pool ib_logfile0 mysql test aria_log_control ibdata1 ib_logfile1 performance_schema [[email protected] mariadb]# ls /data/mysql aminglinux-001.err auto.cnf ib_logfile0 mysql test aminglinux-001.pid ibdata1 ib_logfile1 performance_schema [[email protected] mariadb]# ``` - 下面拷貝配置文件,定義啟動腳本 ``` [[email protected] 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 [[email protected] mariadb]# [[email protected] mariadb]# vim support-files/my-small.cnf [[email protected] mariadb]# free total used free shared buff/cache available Mem: 999936 562720 126040 9440 311176 251040 Swap: 2097148 19476 2077672 [[email protected] mariadb]# ``` - 拷貝一個配置文件,再拷貝一個啟動腳本 ``` [[email protected] mariadb]# cp support-files/my-small.cnf /usr/local/mariadb/my.cnf [[email protected] mariadb]# cp support-files/mysql.server /etc/init.d/mariadb [[email protected] mariadb]# ``` - 可以看下裏面的內容 ``` [[email protected] 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% [[email protected] mariadb]# ``` - /usr/local/mariadb/my.cnf這個文件基本上不用改,要改的是啟動腳本 ``` [[email protected] 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" "[email protected]" & wait_for_ready; return_value=$? -- 插入 -- 300,51 65% ``` - 接下來可以嘗試啟動mariadb服務,啟動之前可以先看下 mysqld 服務有沒有啟動 ``` [[email protected] mariadb]# vim /etc/init.d/mariadb [[email protected] 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 服務 ``` [[email protected] mariadb]# service mysqld stop Shutting down MySQL.. SUCCESS! [[email protected] mariadb]# ps aux |grep mysql root 4677 0.0 0.0 112664 976 pts/0 R+ 00:21 0:00 grep --color=automysql ``` - 再來嘗試下啟動mariadb 服務 ``` [[email protected] mariadb]# /etc/init.d/mariadb start Reloading systemd: [ 確定 ] Starting mariadb (via systemctl): [ 確定 ] [[email protected] 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 [[email protected] mariadb]# ``` - 服務啟動了,看看端口 ``` [[email protected] 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 [[email protected] mariadb]# ``` - 實際上應該這樣 ``` [[email protected] 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 -- [[email protected] mariadb]# vi /usr/local/mariadb/my.cnf [[email protected] mariadb]# /etc/init.d/mariadb restart Restarting mariadb (via systemctl): [ 確定 ] [[email protected] 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 [[email protected] mariadb]# [[email protected] 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 [[email protected] 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 ``` [[email protected] ~]# 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]) [[email protected] ~]# 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]) [[email protected] ~]# 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]) [[email protected] ~]# [[email protected] ~]# 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 [[email protected] ~]# ``` - 再把這些包apr包移到/usr/local/src/ 下 ``` [[email protected] ~]# mv apr-* /usr/local/src/ [[email protected] ~]# cd /usr/local/src/ [[email protected] 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 [[email protected] 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 - 下載完之後分別把他們解壓 ``` [[email protected] 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 [[email protected] src]# [[email protected] src]# tar zxvf apr- apr-1.6.2.tar.gz apr-util-1.6.0.tar.bz2 [[email protected] src]# tar zxvf apr-1.6.2.tar.gz apr-1.6.2/apr.dsw apr-1.6.2/libapr.dep [[email protected] src]# 解壓這個bz2 包的時候需要 用tar jxvf 而不是 上面的 gz包的格式tar zxvf [[email protected] 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 [[email protected] src]# [[email protected] 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 [[email protected] src]# ``` - 1. 首先安裝apr - cd /usr/local/src/apr-1.6.2 - ./configure --prefix=/usr/local/apr - make && make install ``` [[email protected] src]# cd apr-1.6.2/ [[email protected] 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 [[email protected] apr-1.6.2]# echo $? 0 [[email protected] apr-1.6.2]# [[email protected] 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 [[email protected] apr-1.6.2]# ``` - 安裝好後 查看下,下面會有四個目錄 ``` [[email protected] apr-1.6.2]# ls /usr/local/apr/ bin build-1 include lib [[email protected] 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 ``` [[email protected] apr-1.6.2]# cd ../apr-util-1.6.0/ [[email protected] 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 [[email protected] apr-util-1.6.0]# [[email protected] 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 [[email protected] apr-util-1.6.0]# [[email protected] apr-util-1.6.0]# ls /usr/local/apr-util/ bin include lib [[email protected] 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 //查看加載的模塊 ``` [[email protected] apr-util-1.6.0]# cd .. [[email protected] src]# cd httpd-2.4.27/ [[email protected] 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 [[email protected] httpd-2.4.27]# echo $? 0 [[email protected] httpd-2.4.27]# ``` - make ``` [[email protected] 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” [[email protected] httpd-2.4.27]# ``` - make install ``` [[email protected] 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” [[email protected] httpd-2.4.27]# ``` # 11.9Apache 安裝 下 - 進入到apache2.4 目錄下 ``` [[email protected] httpd-2.4.27]# cd /usr/local/apache2.4/ [[email protected] apache2.4]# ls bin build cgi-bin conf error htdocs icons include logs man manual modules [[email protected] apache2.4]# ls bin/ht htcacheclean htdbm htdigest htpasswd httpd httxt2dbm ``` - 接觸到的目錄是bin ,bin下面是一個可執行文件,啟動服務下面有個文件httpd ,這是它的核心二進制文件 ``` [[email protected] apache2.4]# ls bin/httpd bin/httpd [[email protected] apache2.4]# ls -l bin/httpd -rwxr-xr-x 1 root root 1111680 9月 27 00:37 bin/httpd [[email protected] apache2.4]# du -sh !$ du -sh bin/httpd 1.1M bin/httpd [[email protected] apache2.4]# ls bin build cgi-bin conf error htdocs icons include logs man manual modules ``` - conf目錄 是配置文件所在目錄 ``` [[email protected] apache2.4]# ls conf/ extra httpd.conf magic mime.types original ``` - htdocs 存放了一個訪問頁,默認網站會放到這個目錄下 ``` [[email protected] apache2.4]# ls htdocs/ index.html ``` - 日誌 錯誤日誌,訪問日誌 幫助文檔 ``` [[email protected] apache2.4]# ls logs/ ``` ``` [[email protected] apache2.4]# ls man man1 man8 ``` - 擴展模塊,模塊就在這個目錄下 - 每一個模塊會代表一個功能 ``` [[email protected] 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 [[email protected] apache2.4]# du -sh modules/ 2.8M modules/ [[email protected] apache2.4]# ``` - 怎麽查看apache 都加載了哪些模塊呢 - 用命令/usr/local/apache2.4/bin/apachectl -M - 或者 /usr/local/apache2.4/bin/httpd -M ``` [[email protected] 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) [[email protected] 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) [[email protected] apache2.4]# ``` - 安裝完成了 現在啟動httpd服務 使用命令/usr/local/apache2.4/bin/apachectl start ``` [[email protected] 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 [[email protected] 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 [[email protected] 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 [[email protected] 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 安裝