[root@hf-01 ~]# cd /usr/local/src [root@hf-01 src]#
[root@yong-01 src]# ls mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
[root@yong-01 src]# tar zxvf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
[root@yong-01 src]# mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb
[root@yong-01 src]# cd /usr/local/mariadb/ [root@yong-01 mariadb]# ls bin docs mariadb-10.2.6-linux-glibc_214-x86_64 share COPYING EXCEPTIONS-CLIENT my.cnf sql-bench COPYING.thirdparty include mysql-test support-files CREDITS INSTALL-BINARY README.md data lib README-wsrep DESTINATION man scripts
[root@yong-01 mariadb]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb/ --datadir=/data/mariadb
[root@yong-01 mariadb]# echo $? 0
[root@yong-01 mariadb]# ls /data/mariadb/ aria_log.00000001 ib_buffer_pool ib_logfile0 mysql test aria_log_control ibdata1 ib_logfile1 performance_schema
[root@yong-01 mariadb]# cd /usr/local/mariadb/ [root@yong-01 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
[root@hf-01 mariadb]# vim support-files/my-small.cnf 其中下面的配置文件 [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
[root@yong-01 mariadb]# cp support-files/my-small.cnf /usr/local/mariadb/my.cnf cp:是否覆蓋"/usr/local/mariadb/my.cnf"? y
[root@hf-01 mariadb]# vim /usr/local/mariadb/my.cnf 配置參數在[mysqld]這一塊 server-id = 1 //這是作主從複製的
[root@hf-01 mariadb]# cp support-files/mysql.server /etc/init.d/mariadb [root@hf-01 mariadb]#
[root@yong-01 mariadb]# vim /etc/init.d/mariadb 定義 basedir=/usr/local/mariadb 定義 datadir=/data/mariadb 自定義參數 conf=$basedir/my.cnf 在定義conf後,還須要在 啓動命令下面指定下——>在通常模式下,搜索 /start 啓動命令 在 $bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" "$@" & 中,增長--defaults-file="$conf",最後爲 $bindir/mysqld_safe --defaults-file="$conf" --datadir="$datadir" --pid-file="$mysqld_pid_file_path" "$@" & 並保存退出
[root@yong-01 mariadb]# ps aux |grep mysql root 3190 0.0 0.0 112676 984 pts/1 R+ 22:14 0:00 grep --color=auto mysql
[root@yong-01 mariadb]# /etc/init.d/mariadb start Reloading systemd: [ 肯定 ] Starting mariadb (via systemctl): [ 肯定 ] [root@yong-01 mariadb]# ps aux |grep mariadb root 4197 0.0 0.0 115388 1748 ? S 22:39 0:00 /bin/sh /usr/local/mariadb/bin/mysqld_safe --defaults-file=/usr/local/mariadb/my.cnf --datadir=/data/mysql --pid-file=/data/mysql/yong-01.pid mysql 4313 1.5 3.0 1125056 57848 ? Sl 22:39 0:00 /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/yong-01.err --pid-file=/data/mysql/yong-01.pid --socket=/tmp/mysql.sock --port=3306 root 4349 0.0 0.0 112676 980 pts/1 R+ 22:39 0:00 grep --color=auto mariadb [root@yong-01 mariadb]# 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 1124/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1467/master tcp6 0 0 :::22 :::* LISTEN 1124/sshd tcp6 0 0 ::1:25 :::* LISTEN 1467/master tcp6 0 0 :::3306 :::* LISTEN 4747/mysqld
[root@yong-01 mariadb]# ps aux |grep mysql root 4631 0.0 0.0 115388 1740 ? S 22:40 0:00 /bin/sh /usr/local/mariadb/bin/mysqld_safe --defaults-file=/usr/local/mariadb/my.cnf --datadir=/data/mysql --pid-file=/data/mysql/yong-01.pid mysql 4747 0.1 3.5 1125056 66980 ? Sl 22:40 0:00 /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/yong-01.err --pid-file=/data/mysql/yong-01.pid --socket=/tmp/mysql.sock --port=3306 root 4830 0.0 0.0 112676 984 pts/1 R+ 22:46 0:00 grep --color=auto mysql
[root@yong-01 ~]# cd /usr/local/src
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.33.tar.gz wget http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.bz2
[root@yong-01 src]# tar zxvf httpd-2.4.29.tar.gz [root@yong-01 src]# tar zxvf apr-1.6.3.tar.gz [root@yong-01 src]# tar xjvf apr-util-1.6.1.tar.bz2 [root@yong-01 src]# ls apr-1.6.3 apr-util-1.6.1 httpd-2.4.33 mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz php-5.6.30 apr-1.6.3.tar.gz apr-util-1.6.1.tar.bz2 httpd-2.4.33.tar.gz mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz php-5.6.30.tar.gz
[root@yong-01 src]# cd apr-1.6.3 [root@yong-01 apr-1.6.3]# ./configure --prefix=/usr/local/apr
[root@yong-01 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... no checking for cc... no checking for cl.exe... no configure: error: in `/usr/local/src/apr-1.6.3': configure: error: no acceptable C compiler found in $PATH See `config.log' for more details [root@yong-01 apr-1.6.3]# yum install -y gcc
[root@yong-01 apr-1.6.3]# echo $? 0
[root@yong-01 apr-1.6.3]# make && make install
[root@yong-01 apr-1.6.3]# ls /usr/local/apr/ bin build-1 include lib
[root@yong-01 apr-1.6.3]# cd /usr/local/src/apr-util-1.6.1
[root@yong-01 apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@yong-01 apr-util-1.6.1]# echo $? 0
[root@yong-01 apr-util-1.6.1]# make && make install
xml/apr_xml.c:35:19: 致命錯誤:expat.h:沒有那個文件或目錄 #include <expat.h> ^ 編譯中斷。 make[1]: *** [xml/apr_xml.lo] 錯誤 1 make[1]: 離開目錄「/usr/local/src/apr-util-1.6.1」 make: *** [all-recursive] 錯誤 1
[root@yong-01 apr-util-1.6.1]# yum -y install expat-devel
[root@yong-01 apr-util-1.6.1]# ls /usr/local/apr-util/ bin include lib
[root@yong-01 apr-util-1.6.1]# cd /usr/local/src/httpd-2.4.33/
[root@yong-01 httpd-2.4.33]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
[root@yong-01 httpd-2.4.33]# yum list |grep pcre pcre.x86_64 8.32-17.el7 @base pcre-devel.x86_64 8.32-17.el7 @base pcre.i686 8.32-17.el7 base pcre-devel.i686 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
[root@yong-01 httpd-2.4.33]# yum install -y pcre-devel
[root@yong-01 httpd-2.4.33]# echo $? 0
[root@yong-01 httpd-2.4.33]# 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
[root@yong-01 httpd-2.4.33]# cd /usr/local/apache2/ [root@yong-01 apache2.4]# ls bin build cgi-bin conf error htdocs icons include logs man manual modules
[root@yong-01 apache2]# ls bin/httpd bin/httpd [root@yong-01 apache2]# ls -l bin/httpd -rwxr-xr-x 1 root root 2348432 5月 24 23:05 bin/httpd [root@yong-01 apache2]# du -sh bin/httpd 2.3M bin/httpd
[root@yong-01 apache2]# ls conf/ extra httpd.conf magic mime.types original
[root@yong-01 apache2]# ls htdocs/ index.html
每個模塊都表明着一個功能php
[root@yong-01 apache2]# ls modules httpd.exp mod_dbd.so mod_proxy_http.so mod_access_compat.so mod_dir.so mod_proxy_scgi.so mod_actions.so mod_dumpio.so mod_proxy.so mod_alias.so mod_env.so mod_proxy_wstunnel.so mod_allowmethods.so mod_expires.so mod_ratelimit.so mod_auth_basic.so mod_ext_filter.so mod_remoteip.so mod_auth_digest.so mod_file_cache.so mod_reqtimeout.so mod_auth_form.so mod_filter.so mod_request.so mod_authn_anon.so mod_headers.so mod_rewrite.so mod_authn_core.so mod_include.so mod_sed.so mod_authn_dbd.so mod_info.so mod_session_cookie.so mod_authn_dbm.so mod_lbmethod_bybusyness.so mod_session_dbd.so mod_authn_file.so mod_lbmethod_byrequests.so mod_session.so mod_authn_socache.so mod_lbmethod_bytraffic.so mod_setenvif.so mod_authz_core.so mod_lbmethod_heartbeat.so mod_slotmem_shm.so mod_authz_dbd.so mod_log_config.so mod_socache_dbm.so mod_authz_dbm.so mod_log_debug.so mod_socache_memcache.so mod_authz_groupfile.so mod_logio.so mod_socache_shmcb.so mod_authz_host.so mod_macro.so mod_speling.so mod_authz_owner.so mod_mime.so mod_status.so mod_authz_user.so mod_negotiation.so mod_substitute.so mod_autoindex.so mod_proxy_ajp.so mod_unique_id.so mod_buffer.so mod_proxy_balancer.so mod_unixd.so mod_cache_disk.so mod_proxy_connect.so mod_userdir.so mod_cache.so mod_proxy_express.so mod_version.so mod_cache_socache.so mod_proxy_fcgi.so mod_vhost_alias.so mod_cgid.so mod_proxy_fdpass.so mod_watchdog.so mod_dav_fs.so mod_proxy_ftp.so mod_dav.so mod_proxy_hcheck.so [root@yong-02 apache2]# du -sh modules/ 6.3M modules/
[root@yong-01 apache2]# /usr/local/apache2/bin/httpd -M AH00557: httpd: apr_sockaddr_info_get() failed for yong-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 //這裏僅僅是一個提示,提示你要去定義ServerName——>不用去管 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@yong-01 apache2]# /usr/local/apache2/bin/apachectl -M AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.0.104. 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@yong-01 apache2]# /usr/local/apache2/bin/apachectl start AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::8004:45b5:96c5:3ca5. Set the 'ServerName' directive globally to suppress this message
[root@yong-01 apache2]# ps aux |grep httpd root 56203 0.0 0.1 95536 2520 ? Ss 23:38 0:00 /usr/local/apache2/bin/httpd -k start daemon 56204 0.0 0.2 382364 4424 ? Sl 23:38 0:00 /usr/local/apache2/bin/httpd -k start daemon 56205 0.0 0.2 382364 4424 ? Sl 23:38 0:00 /usr/local/apache2/bin/httpd -k start daemon 56206 0.0 0.2 382364 4424 ? Sl 23:38 0:00 /usr/local/apache2/bin/httpd -k start root 56291 0.0 0.0 112676 980 pts/0 R+ 23:38 0:00 grep --color=auto httpd
[root@yong-01 apache2]# 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 1124/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1467/master tcp6 0 0 :::80 :::* LISTEN 56203/httpd tcp6 0 0 :::22 :::* LISTEN 1124/sshd tcp6 0 0 ::1:25 :::* LISTEN 1467/master tcp6 0 0 :::3306 :::* LISTEN 4747/mysqld