[TOC]
MARIADB Installing 11.6 mariadb installation 1. Download the installation package to the Unified directory/usr/local/src/
[[email protected] ~]# cd /usr/local/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
Because the MARIADB binary package image source is in a foreign address, the package is pre-downloaded to the local physical machine, and the package is uploaded to the virtual machine/USR/LOCAL/SRC directory for installation using the Lrzsz tool.
[[email protected] src]# yum install -y lrzsz [[email protected] src]# rz
2. Unzip the binary installation package and move to/usr/local
[[email protected] src]# tar zxvf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz[[email protected] src]# mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb
3. Initialize, specify Basedir and datadir3.1 here are the three ways to enter/usr/local/mariadb/
①.cd/usr/local/mariadb/
②.CD $! The location where the previous instruction was moved is the path, all of which can be implemented
③.cd. /MARIAB//The path of the current SRC is the same as the MARIAB so it can be implemented
[[email protected] src]# cd /usr/local/mariadb/ [[email protected] mariadb]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb --datadir=/data/mariadb
3.2 After initialization, see if it is successful, only 1 OK, then use echo $? To confirm the error
[[email protected] mariadb]# echo $?0
3.3 Comparing data storage directories for MARIADB and MySQL
[[email protected] mariadb]# ls /data/mariadb/aria_log.00000001 ibdata1 mysqlaria_log_control ib_logfile0 performance_schemaib_buffer_pool ib_logfile1 test[[email protected] mariadb]# ls /data/mysql/auto.cnf localhost.localdomain.err xavi.erribdata1 mysql xavi.pidib_logfile0 performance_schemaib_logfile1 test
4. Copy the configuration file and edit (MY-SMALL.CNF) 4.1 to see what files are under the path/support-files/find my-small.cnf
[[email protected] mariadb]# lsbin data include mysql-test shareCOPYING DESTINATION INSTALL-BINARY README.md sql-benchCOPYING.thirdparty docs lib README-wsrep support-filesCREDITS EXCEPTIONS-CLIENT man scripts
Enter the Support-files directory and find that it differs from the support-files under MySQL
[[email protected] mariadb]# ls support-files/binary-configure my-innodb-heavy-4G.cnf my-small.cnf mysql.server wsrep_notifymagic my-large.cnf mysqld_multi.server policymy-huge.cnf my-medium.cnf mysql-log-rotate wsrep.cnf
4.2 my-small.cnf function According to your memory size, reasonable allocation, according to the system operating conditions
[[email protected] mariadb]# vim support-files/my-small.cnf
There are many parameters after opening
[[email protected] mariadb]# free total used free shared buff/cache availableMem: 1867292 625788 973228 9120 268276 1045700Swap: 3905532 0 3905532
4.3 Copy my-small.cnf to/usr/local/mariadb/my.cnf, edit specified Basedir and DataDir
[[email protected] mariadb]# cp support-files/my-small.cnf /usr/local/mariadb/my.cnf
Basedir=/usr/local/mariadb
Datadir=/data/mariadb
5. Copy the startup script to the/etc/init.d/directory and modify the content
[[email protected] mariadb]# cp support-files/mysql.server /etc/init.d/mariadb[[email protected] mariadb]# vim /etc/init.d/mariadb
[[email protected] mariadb]# ps aux |grep mysqlroot 1073 0.0 0.0 115392 1668 ? S 20:39 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/xavi.pidmysql 1354 0.2 24.5 1368672 458540 ? Sl 20:39 0:11 /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/xavi.err --pid-file=/data/mysql/xavi.pidroot 3762 0.0 0.0 112676 976 pts/0 S+ 21:55 0:00 grep --color=auto mysql[[email protected] mariadb]# ps aux |grep mariadbroot 3764 0.0 0.0 112676 972 pts/0 S+ 21:55 0:00 grep --color=auto mariadb
6. Start mariadb:/etc/init.d/mariadb Start or service mariadb start
[[email protected] mariadb]# /etc/init.d/mariadb startReloading systemd: [ 确定 ]Starting mariadb (via systemctl): [ 确定 ][[email protected] mariadb]# ps aux |grep mariadbroot 3693 0.0 0.0 112676 972 pts/0 S+ 21:50 0:00 grep --color=auto mariadb
6.1 There is an error, it is possible that the MySQL service is not off, check: PS aux |grep MySQL
[[email protected] mariadb]# ps aux |grep mysqlroot 1073 0.0 0.0 115392 1668 ? S 20:39 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/xavi.pidmysql 1354 0.2 24.5 1302876 458540 ? Sl 20:39 0:10 /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/xavi.err --pid-file=/data/mysql/xavi.pidroot 3478 0.0 0.0 112676 976 pts/0 S+ 21:48 0:00 grep --color=auto mysql
6.2 Turn off the MySQL service first and then open the MARIADB
[[email protected] mariadb]# service mysqld stopShutting down MySQL.. SUCCESS! [[email protected] mariadb]# service mariadb startStarting mariadb (via systemctl): [ 确定 ]
6.3 See PS aux |grep mariadb again
[[email protected] mariadb]# ps aux |grep mariadbroot 3990 0.1 0.0 115392 1720 ? S 22:06 0:00 /bin/sh /usr/local/mariadb/bin/mysqld_safe --defaults-file=/usr/local/mariadb/my.cnf --datadir=/data/mariadb --pid-file=/data/mariadb/xavi.pidmysql 4112 1.4 3.1 1585872 58176 ? Sl 22:06 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/xavi.err --pid-file=/data/mariadb/xavi.pid --socket=/tmp/mysql.sock --port=3306
6.4 NETSTAT-LNTP View Port 3306
[[email protected] mariadb]# netstat-lntpactive Internet connections (only servers) Proto recv-q send-q Local addres s Foreign Address State Pid/program name TCP 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd TCP 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 2183/DNSMASQ TCP 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1045/sshd TCP 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1044/cupsd TCP 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1597/master tcp6 0 0::: 3306 :::* LISTEN 4112/mysqld tcp6 0 0::: 111:::* LISTEN 1/systemd tcp6 0 0::: +:::* LISTEN 1045/s SHD TCP60 0:: 1:631:::* LISTEN 1044/cupsd tcp6 0 0:: 1:25 :::* LISTEN 1597/master
What's the question?
This can't be explained, just from Port 3306, MARIADB should be started.
Killall mysqld kills all mysqld processes first, both MySQL and mariadb use a port and the MYSQLD process program.
[[email protected] mariadb]# killall mysqld[[email protected] mariadb]# ps aux |grep mysqlroot 4566 0.0 0.0 112676 976 pts/0 R+ 22:39 0:00 grep --color=auto mysql[[email protected] mariadb]# service mariadb startStarting mariadb (via systemctl): [ 确定 ]
Modify Host Name
[[email protected] ~]# hostnamectl set-hostname xavi[[email protected] ~]# [[email protected] ~]# init 6
After reboot, [[email protected] ~]#
11.7~11.9 Apache installation 1. Download the required source package to the specified directory/USR/LOCAL/SRC
[[email protected] mariadb]# cd /usr/local/src[[email protected] src]# wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.gz //2.4源码包[[email protected] src]# wget http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz //apr-1.6.3r包[[email protected] src]# wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gz //apr-util-1.6.1包
1.1 See if all are downloaded completely: LS
[[email protected] src]# lsapr-1.6.3 httpd-2.4.29.tar.gzapr-1.6.3.tar.gz mariadb-10.2.6-linux-glibc_214-x86_64.tar.gzapr-util-1.6.1 mysql-5.5.55apr-util-1.6.1.tar.gz mysql-5.5.55.tar.gzhttpd-2.4.29 mysql-5.6.36-linux-glibc2.5-x86_64.tar.g
2. Unzip the source package
[[email protected] src]# tar zxvf httpd-2.4.29.tar.gz [[email protected] src]# tar zxvf apr-1.6.3.tar.gz [[email protected] src]# tar zxvf apr-util-1.6.1.tar.gz
3. Install the source package 3.1 install Apr package: #./configure--PREFIX=/USR/LOCAL/APR
[[email protected] apr-1.6.3]# ./configure --prefix=/usr/local/apr //执行配置命令[[email protected] apr-1.6.3]# echo $?0 //确认有无错误
To compile and install: makes && make install
[[email protected] apr-1.6.3]# make && make install
3.3 Installing the Apr-unit package
See 4 listings under Apr
[[email protected] apr-1.6.3]# ls /usr/local/aprbin build-1 include lib
Open an Apr directory: Why 1.6.1??
[[email protected] apr-1.6.3]# cd ../apr-util-1.6.5/-bash: cd: ../apr-util-1.6.5/: //没有那个文件或目录[[email protected] apr-1.6.3]# cd ../apr-util-1.6.1/[[email protected] apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr[[email protected] apr-util-1.6.1]# make && make install
An error has occurred: expat.h: no file or directory
xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录 #include <expat.h> ^编译中断。make[1]: *** [xml/apr_xml.lo] 错误 1make[1]: 离开目录“/usr/local/src/apr-util-1.6.1”make: *** [all-recursive] 错误 1
From the description of the exact file, reinstall the packages associated with the expat*
[[email protected] apr-util-1.6.1]# yum install -y expat*
Install make && make install again, and produce 3 subdirectories under apr-util/
[[email protected] apr-util-1.6.1]# echo $?0[[email protected] apr-util-1.6.1]# ls /usr/local/apr-util/ bin include lib
3.7 Install the HTTPD package and return to the SRC directory
Configuration apache2.4:./configure--prefix=/usr/local/apache2.4--WITH-APR=/USR/LOCCAL/APR--with-apr-util=/usr/local/ Apr-util--enable-so--enable-mods-shared=most
[[email protected] httpd-2.4.29]# ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/loccal/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
Error:
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
Resolve Error: Yum list |grep Pcre
[[email protected] httpd-2.4.29]# yum list |grep pcre
Installation: Yum install-y pcre--devel
[[email protected] httpd-2.4.29]# yum install -y pcre--devel
Installation Successful
[[email protected] local]# cd /usr/local/src[[email protected] src]# lsapr-1.6.3 httpd-2.4.29.tar.gzapr-1.6.3.tar.gz mariadb-10.2.6-linux-glibc_214-x86_64.tar.gzapr-util-1.6.1 mysql-5.5.55apr-util-1.6.1.tar.gz mysql-5.5.55.tar.gzhttpd-2.4.29 mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz[[email protected] src]# cd /usr/local/src/apr-util-1.6.1[[email protected] apr-util-1.6.1]# make clean
Error:
Add "--WITH-INCLUDED-APR" after configure. Recompile, make, make install. Can.
The problem comes again, add--with-included-apr after, compile, error is as follows:
Configure:error:Bundled APR requested but not found at./srclib/. Download and unpack the corresponding APR and Apr-util packages to./srclib/.
Error: Apr,apr-util missing, need to download and unzip to./srclib/Directory
Workaround:
#cd/usr/local/src/# cp-r APR-1.5.2/USR/LOCAL/SRC/HTTPD-2.4.7/SRCLIB/APR
#cp-R Apr-util-1.5.4/usr/local/src/httpd-2.4.7/srclib/apr-util
2.MariaDB and Apache Installation