11.6 MARIADB Installation
Preparatory work
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.
Install the Lrzsz tool First:
[email protected] src]# Yum install-y lrzsz
To upload a local package to a virtual terminal:
[Email protected] ~]# CD/USR/LOCAL/SRC
[[email protected] src]# ls
Mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
[Email protected] src]# RZ
[[email protected] src]# ls
Mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
Installing MARIADB
Initialization
Unpack the package:
[Email protected] mariadb]# 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
[Email protected] src]# cd/usr/local/mariadb
Initialization
[Email protected] mariadb]#/scripts/mysql_install_db--user=mysql--datadir=/data/mariadb
Configure 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
To configure the startup script:
[Email protected] mariadb]# vim/etc/init.d/mariadb
Basedir=/usr/local/mariadb
Datadir=/data/mariadb
conf= $basedir/my.cnf
Mark
Start the MARIADB service
To detect if the MySQL service is running:
[[Email protected] mariadb]# PS aux |grep mysql
Root 1326 0.0 0.0 115376 612? S 16:42 0:00/bin/sh/usr/local/mysql/b
MySQL 1848 0.1 44.9 981244 453044? Sl 16:42 0:19/usr/local/mysql/bin/mysqlysql--log-error=/data/mysql/centos-01.err--pid-file=/data/mysql/ Centos-01.pid--socket=/t
Root 2780 0.0 0.0 112664 972 pts/1 r+ 21:48 0:00 grep--color=auto MySQL
Because MySQL and mariadb listen to the same port, in order to avoid conflict, it is necessary to close the MySQL service first:
[[email protected] mariadb]# systemctl stop MySQL
To start the MARIADB service:
[[email protected] mariadb]#/etc/init.d/mariadb start
Reloading systemd: [OK]
Starting mariadb (via Systemctl): [OK]
Note: If only one of the services in MySQL and mariadb is installed on the system, you can put the startup script directly in the/etc/file to set the boot up.
11.7-11.9 Apache Installation
Apache is the name of a foundation, HTTPD is the package we want to install, the early name of it is called Apache. HTTPD uses a common function library Apr and Apr-util, which allows httpd to be easily ported (from Linux to Windows) without caring for the underlying operating system platform.
Apache official website www.apache.org.
The APR libraries used by httpd2.2 and httpd2.4 are different, and the APR that comes with the CENTOS7 system does not match, so you need to install the APR library file using Yum.
Preparatory work
Download the required Packages
Apache Pack:
[Email protected] src]# wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.27.tar.gz
Apr Pack:
[Email protected] src]# wget http://mirrors.hust.edu.cn/apache/apr/apr-1.5.2.tar.gz
Apr-util Package:
[Email protected] src]# wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.5.4.tar.gz
Unpack the Package
[Email protected] src]# tar zxvf httpd-2.4.27.tar.gz
[Email protected] src]# tar zxvf apr-1.5.2.tar.gz
[Email protected] src]# tar zxvf apr-util-1.5.4.tar.gz
Install Apr Package
[Email protected] src]# CD apr-1.5.2
Configuration:
[Email protected] apr-1.5.2]#/configure--PREFIX=/USR/LOCAL/APR
Error:
Configure:error:in /usr/local/src/apr-1.5.2‘:<br/>configure: error: no acceptable C compiler found in $PATH<br/>See
config.log ' for more details
Description: A C language-related compiler was missing.
Workaround:
[email protected] apr-1.5.2]# Yum install-y gcc*
Install the GCC compiler.
[Email protected] apr-1.5.2]#/configure--PREFIX=/USR/LOCAL/APR
Configuration is successful!
Compile and install:
[[email protected] apr-1.5.2]# make
Error:
XML/APR_XML.C:35:19: Fatal error: expat.h: no file or directory
#include <expat.h>
^
Compile interrupts.
MAKE[1]: [Xml/apr_xml.lo] Error 1
MAKE[1]: Leave directory "/usr/local/src/apr-util-1.6.0"
Make: [all-recursive] Error 1
Workaround:
[Email protected] apr-util-1.6.0]# yum-y install Expat-devel
[[email protected] apr-1.5.2]# make && make install
[[email protected] apr-1.5.2]# echo $?
0
Complete!
Note: APR 1.6.2 has been changed, the encryption settings are made, and the following commands are required for compiling (otherwise, the library file cannot be called when Apache is installed):
[Email protected] httpd-2.4.27]# cc= "gcc-m64"./configure--prefix=/usr/local/apr
Installing the Apr-util Package
[Email protected] src]# CD apr-util-1.5.4
Configuration:
[Email protected] apr-util-1.5.4]#/configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr
[[email protected] apr-util-1.5.4]# echo $?
0
Compile and install:
[[email protected] apr-util-1.5.4]# make && make install
Complete!
Installing httpd
[Email protected] src]# CD httpd-2.4.27
Configuration:
[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
Error:
Configure:error:pcre-config for Libpcre not found. PCRE is required and available from http://pcre.org/
Description: A library file needs to be installed Pcre
Workaround:
# #查看相关的包
[email protected] httpd-2.4.27]# Yum list |grep pcre
(Results not shown)
Install the following package based on the results of the search:
[email protected] httpd-2.4.27]# Yum install-y pcre-devel
[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
[[email protected] httpd-2.4.27]# echo $?
0
Configuration Complete!
Compiling and installing
[[email protected] httpd-2.4.27]# make
This process takes a long time!
[[email protected] httpd-2.4.27]# make install
[[email protected] httpd-2.4.27]# echo $?
0
Installation is complete!
Start the service
To switch to the Apache2.4 directory:
[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
Note: The more commonly used directory bin (executable file directory), conf (the directory where the configuration file is located), Htdocs (to hold an access page), logs (log file storage directory), modules (storage extension Module).
To view the modules that Apache has loaded:
[Email protected] apache2.4]#/usr/local/apache2.4/bin/httpd-m
Or
[Email protected] apache2.4]#/usr/local/apache2.4/bin/apachectl-m
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::65d2:adc:20d3:8c74. Set the ' ServerName ' directive globally to suppress this message
#此处错误提示没影响.
Detection Status:
[[[email protected] apache2.4]# PS aux |grep httpd
Root 51085 0.0 0.2 95476 2532? Ss 04:00 0:00/usr/local/apache2.4/binhttpd-k start
Daemon 51086 0.0 0.4 382304 4424? Sl 04:00 0:00/usr/local/apache2.4/binhttpd-k start
Daemon 51087 0.0 0.4 382304 4428? Sl 04:00 0:00/usr/local/apache2.4/binhttpd-k start
Daemon 51088 0.1 0.4 382304 4432? Sl 04:00 0:00/usr/local/apache2.4/binhttpd-k start
root 51185 0.0 0.0 112668 972 PTS/2 s+ 04:02 0:00 grep--color=aut o 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 836/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0: LISTEN 1975/master
tcp6 0 0::: 3306::: LISTEN 20596/mysqld
tcp6 0 0::: 80 :: LISTEN 51085/httpd
tcp6 0 0::: +:: LISTEN 836/sshd
tcp6 0 0:: 1:25::: LISTEN 1975/master
Mariadb and Apache installation