11月12日任务
11.6 MariaDB安装
11.7/11.8/11.9 Apache安装
11.6、 MariaDB安装
#安装方法和详细步骤。
• cd /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
• tar zxvf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
• mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb
• cd /usr/local/mariadb
• ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb/ --datadir=/data/mariadb
• cp support-files/my-small.cnf /usr/local/mariadb/my.cnf
• vi /usr/local/mariadb/my.cnf //定义basedir和datadir
• cp support-files/mysql.server /etc/init.d/mariadb
• vim /etc/init.d/mariadb //定义basedir、datadir、conf以及启动参数
• /etc/init.d/mariadb start
#安装过程跟MySQL差不多。配置文件和启动脚本要和MySQL区分。
[root@zgxlinux-01 src]# mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb [root@zgxlinux-01 ~]# cd /usr/local/mariadb/ [root@zgxlinux-01 mariadb]# ls bin COPYING.thirdparty data docs include lib mysql-test README-wsrep share support-files COPYING CREDITS DESTINATION EXCEPTIONS-CLIENT INSTALL-BINARY man README.md scripts sql-bench [root@zgxlinux-01 mariadb]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mariadb [root@zgxlinux-01 mariadb]# echo $? 0 [root@zgxlinux-01 mariadb]# vim /etc/init.d/mariadb #修改一下两处
[root@zgxlinux-01 mariadb]# /etc/init.d/mariadb start Reloading systemd: [ 确定 ] Starting mariadb (via systemctl): [ 确定 ] [root@zgxlinux-01 mariadb]# ps aux |grep mariadb root 16967 0.0 0.2 152008 2308 ? S 07:19 0:00 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 20555 0.0 0.1 115432 1748 ? S 17:24 0:00 /bin/sh /usr/local/mariadb/bin/mysqld_safe --defaults-file=/usr/local/mariadb/my.cnf --datadir=/data/mariadb --pid-file=/datamariadb/zgxlinux-01.pid mysql 20671 0.2 4.9 1125076 49656 ? Sl 17:24 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/zgxlinux-01.err --pid-file=/data/mariadb/zgxlinux-01.pid --socket=/tmp/mysql.sock --port=3306 root 20722 0.0 0.0 112720 976 pts/2 R+ 17:27 0:00 grep --color=auto mariadb [root@zgxlinux-01 mariadb]# netstat -ltnp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 192.168.56.128:873 0.0.0.0:* LISTEN 1885/rsync tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 952/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1114/master tcp6 0 0 :::3306 :::* LISTEN 20671/mysqld tcp6 0 0 :::22 :::* LISTEN 952/sshd tcp6 0 0 ::1:25 :::* LISTEN 1114/master
11.7、安装Apache
•Apache是一个基金会的名字,httpd才是我们要安装的软件包,早期它的名字就叫apache
• Apache官网www.apache.org
• wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.37.tar.gz
• wget http: //mirrors.cnnic.cn/apache/apr/apr-1.6.5.tar.gz
• wget http: //mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gz
• apr和apr-util是一个通用的函数库,它让httpd可以不关心底层的操作系统平台,可以很方便地移植(从linux移植到windows)
• tar zxvf httpd-2.4.27.tar.gz
• tar zxvf apr-util-1.5.4.tar.gz
• tar zxvf apr-1.5.2.tar.gz
• cd /usr/local/src/apr-1.5.2
• ./configure --prefix=/usr/local/apr
• make && make install
•cd /usr/local/src/apr-util-1.5.4
• ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
• make && make install
• 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@zgxlinux-01 src]# ls apr-1.6.5 apr-util-1.6.1 httpd-2.4.37 maria apr-1.6.5.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.37.tar.gz mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz pcre-8.10.zip [root@zgxlinux-01 apr-1.6.5]# ./configure --prefix=/usr/local/apr [root@zgxlinux-01 apr-1.6.5]# echo $? 0 [root@zgxlinux-01 apr-1.6.5]# make && make install [root@zgxlinux-01 apr-1.6.5]# echo $? 0 [root@zgxlinux-01 apr-1.6.5]# ls /usr/local/apr/ bin build-1 include lib [root@zgxlinux-01 apr-1.6.5]# cd ../apr-util-1.6.1/ [root@zgxlinux-01 apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr [root@zgxlinux-01 apr-util-1.6.1]# echo $? 0 [root@zgxlinux-01 apr-util-1.6.1]# ls /usr/local/apr-util/ bin include lib [root@zgxlinux-01 httpd-2.4.37]# ./configure --prefix=/usr/local/apache2.4.37 --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 configure: configure: Configuring Apache Portable Runtime library... configure: checking for APR... yes setting CC to "gcc" setting CPP to "gcc -E" setting CFLAGS to " -g -O2 -pthread" setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE" setting LDFLAGS to " " configure: configure: Configuring Apache Portable Runtime Utility library... configure: checking for APR-util... yes checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -E checking for gcc option to accept ISO C99... -std=gnu99 checking for pcre-config... false configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/ [root@zgxlinux-01 httpd-2.4.37]# yum list |grep pcre pcre.x86_64 8.32-17.el7 @anaconda Hghc-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-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 [root@zgxlinux-01 httpd-2.4.37]# yum install -y pcre-devel [root@zgxlinux-01 httpd-2.4.37]# ./configure --prefix=/usr/local/apache2.4.37 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most [root@zgxlinux-01 httpd-2.4.37]# echo $? 0 [root@zgxlinux-01 httpd-2.4.37]# make && make install [root@zgxlinux-01 httpd-2.4.37]# echo $? 0 [root@zgxlinux-01 httpd-2.4.37]# cd /usr/local/apache2.4.37/ [root@zgxlinux-01 apache2.4.37]# ls bin cgi-bin error icons logs manual build conf htdocs include man modules [root@zgxlinux-01 apache2.4.37]# ls conf/ extra httpd.conf magic mime.types original [root@zgxlinux-01 apache2.4.37]# ls htdocs/ index.html [root@zgxlinux-01 apache2.4.37]# /usr/local/apache2.4.37/bin/httpd -M #或者用/usr/local/apache2.4.37/bin/apachectl -M这个命令查看加载的模块。 AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::8309:40e5:5360:fcbd. 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)
#启动Apache
[root@zgxlinux-01 apache2.4.37]# /usr/local/apache2.4.37/bin/apachectl start AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::8309:40e5:5360:fcbd. Set the 'ServerName' directive globally to suppress this message [root@zgxlinux-01 apache2.4.37]# ps aux |grep httpd root 53311 0.0 0.2 97704 2608 ? Ss 21:01 0:00 /usr/local/apache2.4.37/bin/httpd -k start daemon 53312 0.0 0.2 384532 2352 ? Sl 21:01 0:00 /usr/local/apache2.4.37/bin/httpd -k start daemon 53313 0.0 0.2 384532 2352 ? Sl 21:01 0:00 /usr/local/apache2.4.37/bin/httpd -k start daemon 53314 0.0 0.2 384532 2352 ? Sl 21:01 0:00 /usr/local/apache2.4.37/bin/httpd -k start root 53397 0.0 0.0 112720 984 pts/2 R+ 21:01 0:00 grep --color=auto httpd [root@zgxlinux-01 apache2.4.37]# netstat -lntp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 192.168.56.128:873 0.0.0.0:* LISTEN 1885/rsync tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 952/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1114/master tcp6 0 0 :::3306 :::* LISTEN 20671/mysqld tcp6 0 0 :::80 :::* LISTEN 53311/httpd tcp6 0 0 :::22 :::* LISTEN 952/sshd tcp6 0 0 ::1:25 :::* LISTEN 1114/master