阶段测试13

Q1 简述DNS服务器原理,并搭建主-辅服务器。

DNS服务器原理:
DNS也就是Domain Name Service的缩写,它的作用就是通过域名查找IP地址。DNS查询的类型对DNS于客户端来说是递归查询,对于DNS服务器端来说,绝大多数是迭代查询,在它的解析中,从名称到IP的查询叫做正向解析,而从IP到名称的查询叫做反向解析。如果DNS服务器至少解析了一个或一个以上的域叫做DNS主服务器或者DNS辅助服务器,如果不负责任何解析叫做DNS缓存服务器。现全球一共分布了13台DNS根服务器,名称为A至M。

域名解析过程:
客户访问时,查找自己的hosts文件,有则返回,无则查找DNS服务器。
DNS服务器查找中先从顶级域到二级域,分别获取他们的IP地址,然后最终获得域名的IP地址,找到服务器。

DNS区域数据库文件:
资源记录(resource record 简称rr)的类型有以下几种:

SOA:起始授权记录,只能有一个,必须放在第一条
NS:域名服务记录,其中一个为主,可以有多个
A:IPV4地址记录
AAAA:IPV6地址记录
CNAME:别名记录
PTR:反向解析记录
MX:邮件交换器

Q2 搭建并实现智能DNS。

环境说明

DNS主服务器:192.168.10.10
DNS辅服务器:192.168.10.11
DNS子域主服务器:192.168.10.12


在这里插入图片描述
在这里插入图片描述

配置正向区域解析

在这里插入图片描述

建立区域数据文件

在这里插入图片描述

修改权限并且验证语法

在这里插入图片描述

在这里插入图片描述

正向解析测试
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

配置反向区域解析

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

配置备DNS服务器

在这里插入图片描述

配置备DNS 正向区域

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

测试备DNS服务器解析网址

在这里插入图片描述

配置备DNS 反向区域

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

测试备DNS 反向解析

在这里插入图片描述

配置访问控制

在这里插入图片描述

服务器只允许列表中网段主机可以进行递归查询

智能DNS

要实现DNS服务器的智能DNS解析,首先需要了解view的概念:view就是将不同IP地址段发来的查询响应到不同的DNS解析。如需要对两个不同的IP地址段进行配置,就需要明确这些IP地址段的范围,这样view才能生效。需要注意的是,一旦使用了view,所有域都必须定义在view中。

在这里插入图片描述

修改主DNS的named.conf

在这里插入图片描述

建立两个正向区域数据文件

在这里插入图片描述

检测语法并且设置权限

在这里插入图片描述

在这里插入图片描述

用192.168.10.12进行解析,解析成内网IP

在这里插入图片描述

在这里插入图片描述

用192.168.10.11进行解析,解析成外网IP

至此 只能dns搭建完毕。

Q3 编译安装Mariadb,并启动后可以正常登录

首先下载源码包 GCC

[root@localhost ~]# wget http://ftpmirror.gnu.org/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2
--2020-04-26 16:19:37--  http://ftpmirror.gnu.org/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2
Resolving ftpmirror.gnu.org (ftpmirror.gnu.org)... 209.51.188.200, 2001:470:142:5::200
Connecting to ftpmirror.gnu.org (ftpmirror.gnu.org)|209.51.188.200|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://ftp.cse.yzu.edu.tw/gnu/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2 [following]
--2020-04-26 16:19:39--  http://ftp.cse.yzu.edu.tw/gnu/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2
Resolving ftp.cse.yzu.edu.tw (ftp.cse.yzu.edu.tw)... 140.138.144.170
Connecting to ftp.cse.yzu.edu.tw (ftp.cse.yzu.edu.tw)|140.138.144.170|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 95221552 (91M) [application/octet-stream]
Saving to: ‘gcc-5.2.0.tar.bz2’

71% [===============================================================================> 

解压缩

[root@localhost ~]# tar -xf gcc-5.2.0.tar.bz2

下载依赖包

[root@localhost gcc-5.2.0]# ./contrib/download_prerequisites 
--2020-04-26 08:33:30--  ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
           => ‘mpfr-2.4.2.tar.bz2’
Resolving gcc.gnu.org (gcc.gnu.org)... 8.43.85.97, 2620:52:3:1:0:246e:9693:128c
Connecting to gcc.gnu.org (gcc.gnu.org)|8.43.85.97|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD (1) /pub/gcc/infrastructure ... done.
==> SIZE mpfr-2.4.2.tar.bz2 ... 1077886
==> PASV ... done.    ==> RETR mpfr-2.4.2.tar.bz2 ... done.
Length: 1077886 (1.0M) (unauthoritative)

100%[===============================================================================================================>] 1,077,886    434KB/s   in 2.4s   

2020-04-26 08:33:41 (434 KB/s) - ‘mpfr-2.4.2.tar.bz2’ saved [1077886]

--2020-04-26 08:33:41--  ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2

编译安装GCC
建议先安装这几个包

[root@localhost gcc-5.2.0]# yum install -y gcc-c++ glibc-static gcc
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.8.5-39.el7 will be installed
--> Processing Dependency: cpp = 4.8.5-39.el7 for package: gcc-4.8.5-39.el7.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.5-39.el7.x86_64
--> Processing Dependency: libmpfr.so.4()(64bit) for package: gcc-4.8.5-39.el7.x86_64
--> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-4.8.5-39.el7.x86_64
---> Package gcc-c++.x86_64 0:4.8.5-39.el7 will be installed
--> Processing Dependency: libstdc++-devel = 4.8.5-39.el7 for package: gcc-c++-4.8.5-39.el7.x86_64
---> Package glibc-static.x86_64 0:2.17-292.el7 will be installed
--> Running transaction check
---> Package cpp.x86_64 0:4.8.5-39.el7 will be installed
---> Package glibc-devel.x86_64 0:2.17-292.el7 will be installed
--> Processing Dependency: glibc-headers = 2.17-292.el7 for package: glibc-devel-2.17-292.el7.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.17-292.el7.x86_64
---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed
---> Package libstdc++-devel.x86_64 0:4.8.5-39.el7 will be installed
---> Package mpfr.x86_64 0:3.1.1-4.el7 will be installed
--> Running transaction check

随后开始configure

[root@localhost gcc-5.2.0]# ./configure --prefix=/usr/local/gcc  --enable-bootstrap  --enable-checking=release --enable-languages=c,c++ --disable-multilib
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for gawk... gawk
checking for libatomic support... yes
checking for libcilkrts support... yes
checking for libitm support... yes
checking for libsanitizer support... yes
checking for libvtv support... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
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 for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ accepts -static-libstdc++ -static-libgcc... no
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
configure: WARNING: using in-tree ISL, disabling version check
*** This configuration is not supported in the following subdirectories:
     target-libmpx gnattools gotools target-libada target-libgfortran target-libgo target-libffi target-libbacktrace target-zlib target-libjava target-libobjc target-liboffloadmic target-boehm-gc
    (Any other directories should still work fine.)
checking for default BUILD_CONFIG... bootstrap-debug
checking for --enable-vtable-verify... no
checking for bison... no
checking for byacc... no
checking for yacc... no
checking for bison... no
checking for gm4... no
checking for gnum4... no
checking for m4... no
checking for flex... no
checking for lex... no
checking for flex... no
checking for makeinfo... no
/root/gcc-5.2.0/missing: line 81: makeinfo: command not found
checking for expect... no
checking for runtest... no
checking for ar... ar
checking for as... as
checking for dlltool... no
checking for ld... ld
checking for lipo... no
checking for nm... nm
checking for ranlib... ranlib
checking for strip... strip
checking for windres... no
checking for windmc... no
checking for objcopy... objcopy
checking for objdump... objdump
checking for readelf... readelf
checking for cc... cc
checking for c++... c++
checking for gcc... gcc
checking for gcj... no
checking for gfortran... no
checking for gccgo... no
checking for ar... no
checking for ar... ar
checking for as... no
checking for as... as
checking for dlltool... no
checking for dlltool... no
checking for ld... no
checking for ld... ld
checking for lipo... no
checking for lipo... no
checking for nm... no
checking for nm... nm
checking for objcopy... no
checking for objcopy... objcopy
checking for objdump... no
checking for objdump... objdump
checking for ranlib... no
checking for ranlib... ranlib
checking for readelf... no
checking for readelf... readelf
checking for strip... no
checking for strip... strip
checking for windres... no
checking for windres... no
checking for windmc... no
checking for windmc... no
checking where to find the target ar... host tool
checking where to find the target as... host tool
checking where to find the target cc... just compiled
checking where to find the target c++... just compiled
checking where to find the target c++ for libstdc++... just compiled
checking where to find the target dlltool... host tool
checking where to find the target gcc... just compiled
checking where to find the target gcj... host tool
checking where to find the target gfortran... host tool
checking where to find the target gccgo... host tool
checking where to find the target ld... host tool
checking where to find the target lipo... host tool
checking where to find the target nm... host tool
checking where to find the target objcopy... host tool
checking where to find the target objdump... host tool
checking where to find the target ranlib... host tool
checking where to find the target readelf... host tool
checking where to find the target strip... host tool
checking where to find the target windres... host tool
checking where to find the target windmc... host tool
checking whether to enable maintainer-specific portions of Makefiles... no
configure: creating ./config.status
config.status: creating Makefile

编译参数说明:

–prefix=/usr/local/ 指定安装路径

–enable-bootstrap 这里引用网上一些文献对该参数的解释:用第一次编译生成的程序进行第二次编译,然后用再次生成的程序进行第三次编译,并且检查比较第二次和第三次结果的正确性,也就是进行冗余的编译检查工作。 非交叉编译环境下,默认已经将该值设为 enable,可以不用显示指定;交叉编译环境下,需要显示将其值设为 disable。

–enable-checking=release 以软件发布版的标准来对编译时生成的代码进行一致性检查;设置该选项为 enable并不会改变编译器生成的二进制结果,但是会导致编译的时间增加;该选项仅支持gcc编译器; 总体而言,对于上面这个选项,机器的硬件配置较低,以及不愿等待太久编译时间的童鞋,可以设置为 disable;但是这会增加产生未预期的错误的风险,所以应该慎用。 可以同时设置 --disable-bootstrap 与 --disable-checking,这对编译过程的提速很有帮助。

–enable-threads=posix 顾名思义,启用posix标准的线程支持 ,要让程序能在符合POSIX规范的linux发布版上正确运行,就应该启用该选项,取决于宿主或目标操作系统的类型,其它可用值有:aix,dec,solaris,win32等,如果你是其它的类UNIX系统,就需要设置相应的值。

–enable-languages=c,c++ 支持的高级语言类型和运行时库,可以设置的所有语言包括 ada,c,c++,Fortran,java,objc,obj-c++,GO 等语言。这里只开启了c和c++,因为支持的语言越多,就需要安装越多的相应静态与动态库,还有五花八门的依赖库,这会让管理变得困难,体积也会变得庞大。

–disable-multilib 如果你的操作系统是32位,默认就已经设置为 disable,这意味着gcc仅能生成32位的可执行程序;如果你的操作系统是64位,默认就已经设置为 enable,这意味着用gcc编译其它源文件时可以通过 -m32 选项来决定是否生成32位机器代码。如果在64位系统上,要禁止生成32位代码, 设置 --disable-multilib。

–enable-gather-detailed-mem-stats 允许收集详细的内存使用信息,如果设置该参数为 enable,则将来编译好的gcc可执行程序,可以通过 -fmem-report 选项来输出编译其它程序时的实时内存使用情况。

–with-long-double-128 指定 long double 类型为128位(16字节!);设置为 without,则 long double类型将为64位(8字节),这将与普通的 double 类型一样。 基于 Glib 2.4以上版本编译时,默认已经是128位。

导出环境变量
导出头文件
导出库文件

[root@localhost gcc-5.2.0]# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@localhost gcc-5.2.0]# vim /etc/pro
profile    profile.d/ protocols  
[root@localhost gcc-5.2.0]# vim /etc/pro
profile    profile.d/ protocols  
[root@localhost gcc-5.2.0]# vim /etc/profile.d/
256term.csh    colorgrep.csh  colorls.csh    csh.local      lang.sh        less.sh        vim.csh        which2.csh     
256term.sh     colorgrep.sh   colorls.sh     lang.csh       less.csh       sh.local       vim.sh         which2.sh      
[root@localhost gcc-5.2.0]# vim /etc/profile.d/gcc.sh
[root@localhost gcc-5.2.0]# cat /etc/profile.d/gcc.sh 
#!/bin/bash
export PATH=/usr/local/gcc/bin:$PATH
[root@localhost gcc-5.2.0]# source /etc/profile.d/gcc.sh 
[root@localhost gcc-5.2.0]# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@localhost gcc-5.2.0]# ln -sv /usr/local/gcc/include/ /usr/include/gcc
‘/usr/include/gcc’ -> ‘/usr/local/gcc/include/’
[root@localhost gcc-5.2.0]# vim /etc/ld.so.conf.d/gcc.conf
[root@localhost gcc-5.2.0]# ldconfig -v
ldconfig: Can't stat /usr/local/gcc/lib64: No such file or directory
ldconfig: Can't stat /libx32: No such file or directory
ldconfig: Path `/usr/lib' given more than once
ldconfig: Path `/usr/lib64' given more than once
ldconfig: Can't stat /usr/libx32: No such file or directory
/usr/lib64//bind9-export:
	libisccfg-export.so.160 -> libisccfg-export.so.160.2.1
	libisc-export.so.169 -> libisc-export.so.169.0.3
	libirs-export.so.160 -> libirs-export.so.160.0.5
	libdns-export.so.1102 -> libdns-export.so.1102.1.2
/usr/lib64/mysql:
	libmysqlclient.so.18 -> libmysqlclient.so.18.0.0
/lib:
/lib64:
	libguestlib.so.0 -> libguestlib.so.0.0.0
	libDeployPkg.so.0 -> libDeployPkg.so.0.0.0
	libgpgme.so.11 -> libgpgme.so.11.8.1
	libgpm.so.2 -> libgpm.so.2.1.0
	libgpgme-pthread.so.11 -> libgpgme-pthread.so.11.8.1
	librpmsign.so.1 -> librpmsign.so.1.2.2
	librpmbuild.so.3 -> librpmbuild.so.3.2.2
	libpth.so.20 -> libpth.so.20.0.27
	libestr.so.0 -> libestr.so.0.0.0
	libply.so.2 -> libply.so.2.1.0
	libply-splash-core.so.2 -> libply-splash-core.so.2.1.0
	libsysfs.so.2 -> libsysfs.so.2.0.1
	libply-boot-client.so.2 -> libply-boot-client.so.2.1.0
	libbtrfs.so.0 -> libbtrfs.so.0.1
	libdbus-glib-1.so.2 -> libdbus-glib-1.so.2.2.2
	libhandle.so.1 -> libhandle.so.1.0.3
	libteamdctl.so.0 -> libteamdctl.so.0.1.5
	libebtc.so -> libebtc.so
	libdrm_radeon.so.1 -> libdrm_radeon.so.1.0.1
	libparted.so.2 -> libparted.so.2.0.0
	libdrm_nouveau.so.2 -> libdrm_nouveau.so.2.0.0
	libdrm_intel.so.1 -> libdrm_intel.so.1.0.0
	libparted-fs-resize.so.0 -> libparted-fs-resize.so.0.0.0
	libdrm_amdgpu.so.1 -> libdrm_amdgpu.so.1.0.0
	libpciaccess.so.0 -> libpciaccess.so.0.11.1
	liblvm2cmd.so.2.02 -> liblvm2cmd.so.2.02
	libmpc.so.3 -> libmpc.so.3.0.0
	liblvm2app.so.2.2 -> liblvm2app.so.2.2
	libmpfr.so.4 -> libmpfr.so.4.1.1
	libvmtools.so.0 -> libvmtools.so.0.0.0
	libvgauth.so.0 -> libvgauth.so.0.0.0
	libdevmapper-event-lvm2.so.2.02 -> libdevmapper-event-lvm2.so.2.02
	libhgfs.so.0 -> libhgfs.so.0.0.0
	libslapi-2.4.so.2 -> libslapi-2.4.so.2.10.7
	libdevmapper-event.so.1.02 -> libdevmapper-event.so.1.02
	libcryptsetup.so.12 -> libcryptsetup.so.12.3.0
	libldap_r-2.4.so.2 -> libldap_r-2.4.so.2.10.7
	libdevmapper.so.1.02 -> libdevmapper.so.1.02
	libldap-2.4.so.2 -> libldap-2.4.so.2.10.7
	libpolkit-gobject-1.so.0 -> libpolkit-gobject-1.so.0.0.0
	liblber-2.4.so.2 -> liblber-2.4.so.2.10.7
	libpolkit-agent-1.so.0 -> libpolkit-agent-1.so.0.0.0
	librpmio.so.3 -> librpmio.so.3.2.2
	librpm.so.3 -> librpm.so.3.2.2
	libdbus-1.so.3 -> libdbus-1.so.3.14.14
	libcurl.so.4 -> libcurl.so.4.3.0
	libnsssysinit.so -> libnsssysinit.so
	libudev.so.1 -> libudev.so.1.6.2
	libssl3.so -> libssl3.so
	libomapi.so.0 -> libomapi.so.0.0.0
	libsmime3.so -> libsmime3.so
	libnss3.so -> libnss3.so
	libdhcpctl.so.0 -> libdhcpctl.so.0.0.0
	libnsspem.so -> libnsspem.so
	libsystemd.so.0 -> libsystemd.so.0.6.0
	libprocps.so.4 -> libprocps.so.4.0.0
	libfipscheck.so.1 -> libfipscheck.so.1.2.1
	libbfd-2.27-41.base.el7.so -> libbfd-2.27-41.base.el7.so
	libxmlsec1-openssl.so.1 -> libxmlsec1-openssl.so.1.2.20
	libkms.so.1 -> libkms.so.1.0.0
	libjson.so.0 -> libjson.so.0.1.0
	libsystemd-login.so.0 -> libsystemd-login.so.0.9.3
	libssh2.so.1 -> libssh2.so.1.0.1
	libutempter.so.0 -> libutempter.so.1.1.6
	libsystemd-journal.so.0 -> libsystemd-journal.so.0.11.5
	libdrm.so.2 -> libdrm.so.2.4.0
	libuser.so.1 -> libuser.so.1.5.0
	libgirepository-1.0.so.1 -> libgirepository-1.0.so.1.0.0
	libjson-c.so.2 -> libjson-c.so.2.0.1
	libgettextsrc-0.19.8.1.so -> libgettextsrc-0.19.8.1.so
	libnm.so.0 -> libnm.so.0.1.0
	libdnet.so.1 -> libdnet.so.1.0.1
	libgettextpo.so.0 -> libgettextpo.so.0.5.4
	libgettextlib-0.19.8.1.so -> libgettextlib-0.19.8.1.so
	libpipeline.so.1 -> libpipeline.so.1.2.3
	libasprintf.so.0 -> libasprintf.so.0.0.0
	libsystemd-id128.so.0 -> libsystemd-id128.so.0.0.28
	libsasl2.so.3 -> libsasl2.so.3.0.0
	libsystemd-daemon.so.0 -> libsystemd-daemon.so.0.0.12
	libnss_myhostname.so.2 -> libnss_myhostname.so.2
	libpamc.so.0 -> libpamc.so.0.82.1
	libnss_mymachines.so.2 -> libnss_mymachines.so.2
	libpam_misc.so.0 -> libpam_misc.so.0.82.0
	libdw.so.1 -> libdw-0.176.so
	libasound.so.2 -> libasound.so.2.0.0
	libpwquality.so.1 -> libpwquality.so.1.0.2
	libasm.so.1 -> libasm-0.176.so
	libcryptsetup.so.4 -> libcryptsetup.so.4.7.0
	libopcodes-2.27-41.base.el7.so -> libopcodes-2.27-41.base.el7.so
	libulockmgr.so.1 -> libulockmgr.so.1.0.1
	libgobject-2.0.so.0 -> libgobject-2.0.so.0.5600.1
	libfuse.so.2 -> libfuse.so.2.9.2
	libgmodule-2.0.so.0 -> libgmodule-2.0.so.0.5600.1
	libnuma.so.1 -> libnuma.so.1.0.0
	libglib-2.0.so.0 -> libglib-2.0.so.0.5600.1
	libmspack.so.0 -> libmspack.so.0.1.0
	libqrencode.so.3 -> libqrencode.so.3.4.1
	libsgutils2.so.2 -> libsgutils2.so.2.0.0
	libgio-2.0.so.0 -> libgio-2.0.so.0.5600.1
	libverto.so.1 -> libverto.so.1.0.0
	libmount.so.1 -> libmount.so.1.1.0
	libndp.so.0 -> libndp.so.0.0.0
	libcroco-0.6.so.3 -> libcroco-0.6.so.3.0.1
	libpam.so.0 -> libpam.so.0.83.1
	libcpupower.so.0 -> libcpupower.so.0.0.0
	libsemanage.so.1 -> libsemanage.so.1
	libcrack.so.2 -> libcrack.so.2.9.0
	libustr-1.0.so.1 -> libustr-1.0.so.1.0.4
	libpython2.7.so.1.0 -> libpython2.7.so.1.0
	libgmpxx.so.4 -> libgmpxx.so.4.4.0
	libblkid.so.1 -> libblkid.so.1.1.0
	libgmp.so.10 -> libgmp.so.10.2.0
	libkrb5support.so.0 -> libkrb5support.so.0.1
	libsnappy.so.1 -> libsnappy.so.1.1.4
	libkrb5.so.3 -> libkrb5.so.3.3
	libmozjs-17.0.so -> libmozjs-17.0.so
	libkrad.so.0 -> libkrad.so.0.0
	libicuuc.so.50 -> libicuuc.so.50.2
	libkdb5.so.8 -> libkdb5.so.8.0
	libicutu.so.50 -> libicutu.so.50.2
	libk5crypto.so.3 -> libk5crypto.so.3.1
	libicutest.so.50 -> libicutest.so.50.2
	libiculx.so.50 -> libiculx.so.50.2
	libgssapi_krb5.so.2 -> libgssapi_krb5.so.2.2
	libgssrpc.so.4 -> libgssrpc.so.4.2
	libicule.so.50 -> libicule.so.50.2
	libicuio.so.50 -> libicuio.so.50.2
	libssl.so.10 -> libssl.so.1.0.2k
	libicui18n.so.50 -> libicui18n.so.50.2
	libicudata.so.50 -> libicudata.so.50.2
	libcrypto.so.10 -> libcrypto.so.1.0.2k
	libedit.so.0 -> libedit.so.0.0.42
	libdaemon.so.0 -> libdaemon.so.0.5.0
	libfreetype.so.6 -> libfreetype.so.6.14.0
	p11-kit-trust.so -> libnssckbi.so
	libpng15.so.15 -> libpng15.so.15.13.0
	libtasn1.so.6 -> libtasn1.so.6.5.3
	libss.so.2 -> libss.so.2.0
	libgthread-2.0.so.0 -> libgthread-2.0.so.0.5600.1
	libipset.so.13 -> libipset.so.13.1.0
	libfastjson.so.4 -> libfastjson.so.4.0.0
	libteam.so.5 -> libteam.so.5.4.0
	libsmartcols.so.1 -> libsmartcols.so.1.1.0
	libiptc.so.0 -> libiptc.so.0.0.0
	libxtables.so.10 -> libxtables.so.10.0.0
	libnl-cli-3.so.200 -> libnl-cli-3.so.200.23.0
	libnetfilter_conntrack.so.3 -> libnetfilter_conntrack.so.3.6.0
	libxmlsec1.so.1 -> libxmlsec1.so.1.2.20
	libkeyutils.so.1 -> libkeyutils.so.1.5
	libpci.so.3 -> libpci.so.3.5.1
	libaio.so.1.0.0 -> libaio.so.1.0.0
	libgdbm_compat.so.4 -> libgdbm_compat.so.4.0.0
	libaio.so.1 -> libaio.so.1.0.1
	libip6tc.so.0 -> libip6tc.so.0.1.0
	libltdl.so.7 -> libltdl.so.7.3.0
	libgdbm.so.4 -> libgdbm.so.4.0.0
	libmnl.so.0 -> libmnl.so.0.1.0
	liblzo2.so.2 -> liblzo2.so.2.0.0
	libmagic.so.1 -> libmagic.so.1.0.0
	libwrap.so.0 -> libwrap.so.0.7.6
	libxslt.so.1 -> libxslt.so.1.1.28
	libjansson.so.4 -> libjansson.so.4.10.0
	libexslt.so.0 -> libexslt.so.0.8.17
	libassuan.so.0 -> libassuan.so.0.4.0
	libnl-xfrm-3.so.200 -> libnl-xfrm-3.so.200.23.0
	libnewt.so.0.52 -> libnewt.so.0.52.15
	libnl-route-3.so.200 -> libnl-route-3.so.200.23.0
	libp11-kit.so.0 -> libp11-kit.so.0.3.0
	libnl-nf-3.so.200 -> libnl-nf-3.so.200.23.0
	libsoftokn3.so -> libsoftokn3.so
	libnl-idiag-3.so.200 -> libnl-idiag-3.so.200.23.0
	libnssdbm3.so -> libnssdbm3.so
	libnl-genl-3.so.200 -> libnl-genl-3.so.200.23.0
	libslang.so.2 -> libslang.so.2.2.4
	libnl-3.so.200 -> libnl-3.so.200.23.0
	libefivar.so.1 -> libefivar.so.1.36
	liblua-5.1.so -> liblua-5.1.so
	libefiboot.so.1 -> libefiboot.so.1.36
	libsqlite3.so.0 -> libsqlite3.so.0.8.6
	libnfnetlink.so.0 -> libnfnetlink.so.0.2.0
	libexpat.so.1 -> libexpat.so.1.6.0
	liblz4.so.1 -> liblz4.so.1.7.5
	libcap.so.2 -> libcap.so.2.22
	libip4tc.so.0 -> libip4tc.so.0.1.0
	libgomp.so.1 -> libgomp.so.1.0.0
	libauparse.so.0 -> libauparse.so.0.0.0
	libidn.so.11 -> libidn.so.11.6.11
	libaudit.so.1 -> libaudit.so.1.0.0
	libunistring.so.0 -> libunistring.so.0.1.2
	libcap-ng.so.0 -> libcap-ng.so.0.0.0
	libkmod.so.2 -> libkmod.so.2.2.10
	libext2fs.so.2 -> libext2fs.so.2.4
	libgcrypt.so.11 -> libgcrypt.so.11.8.2
	libe2p.so.2 -> libe2p.so.2.3
	libhistory.so.6 -> libhistory.so.6.2
	libreadline.so.6 -> libreadline.so.6.2
	libacl.so.1 -> libacl.so.1.1.0
	libgpg-error.so.0 -> libgpg-error.so.0.10.0
	libstdc++.so.6 -> libstdc++.so.6.0.19
	libnssutil3.so -> libnssutil3.so
	libplds4.so -> libplds4.so
	libdb-5.3.so -> libdb-5.3.so
	libplc4.so -> libplc4.so
	libnspr4.so -> libnspr4.so
	libbz2.so.1 -> libbz2.so.1.0.6
	libpcprofile.so -> libpcprofile.so
	libselinux.so.1 -> libselinux.so.1
	libthread_db.so.1 -> libthread_db-1.0.so
	librt.so.1 -> librt-2.17.so
	libz.so.1 -> libz.so.1.2.7
	libpcreposix.so.0 -> libpcreposix.so.0.0.1
	libresolv.so.2 -> libresolv-2.17.so
	libpcrecpp.so.0 -> libpcrecpp.so.0.0.0
	libpthread.so.0 -> libpthread-2.17.so
	libpcre32.so.0 -> libpcre32.so.0.0.0
	libnss_nisplus.so.2 -> libnss_nisplus-2.17.so
	libnss_nis.so.2 -> libnss_nis-2.17.so
	libpcre16.so.0 -> libpcre16.so.0.2.0
	libnss_hesiod.so.2 -> libnss_hesiod-2.17.so
	libformw.so.5 -> libformw.so.5.9
	libpcre.so.1 -> libpcre.so.1.2.0
	libnss_files.so.2 -> libnss_files-2.17.so
	libsepol.so.1 -> libsepol.so.1
	libnss_dns.so.2 -> libnss_dns-2.17.so
	libtic.so.5 -> libtic.so.5.9
	libnss_db.so.2 -> libnss_db-2.17.so
	libtinfo.so.5 -> libtinfo.so.5.9
	libnss_compat.so.2 -> libnss_compat-2.17.so
	libmemusage.so -> libmemusage.so
	libpopt.so.0 -> libpopt.so.0.0.0
	libnsl.so.1 -> libnsl-2.17.so
	libpanelw.so.5 -> libpanelw.so.5.9
	libm.so.6 -> libm-2.17.so
	libuuid.so.1 -> libuuid.so.1.3.0
	libdl.so.2 -> libdl-2.17.so
	libpanel.so.5 -> libpanel.so.5.9
	libcrypt.so.1 -> libcrypt-2.17.so
	libncursesw.so.5 -> libncursesw.so.5.9
	libcidn.so.1 -> libcidn-2.17.so
	libncurses.so.5 -> libncurses.so.5.9
	libc.so.6 -> libc-2.17.so
	libcom_err.so.2 -> libcom_err.so.2.1
	libanl.so.1 -> libanl-2.17.so
	libncurses++w.so.5 -> libncurses++w.so.5.9
	libSegFault.so -> libSegFault.so
	libattr.so.1 -> libattr.so.1.1.0
	libform.so.5 -> libform.so.5.9
	libBrokenLocale.so.1 -> libBrokenLocale-2.17.so
	libffi.so.6 -> libffi.so.6.0.1
	libelf.so.1 -> libelf-0.176.so
	ld-linux-x86-64.so.2 -> ld-2.17.so
	liblzma.so.5 -> liblzma.so.5.2.2
	libfreeblpriv3.so -> libfreeblpriv3.so
	libncurses++.so.5 -> libncurses++.so.5.9
	libfreebl3.so -> libfreebl3.so
	libmenuw.so.5 -> libmenuw.so.5.9
	libmenu.so.5 -> libmenu.so.5.9
	libgcc_s.so.1 -> libgcc_s-4.8.5-20150702.so.1
	libxml2.so.2 -> libxml2.so.2.9.1
	libutil.so.1 -> libutil-2.17.so
/lib/sse2: (hwcap: 0x0000000004000000)
/lib64/sse2: (hwcap: 0x0000000004000000)
/lib64/tls: (hwcap: 0x8000000000000000)
[root@localhost gcc-5.2.0]# ldconfig -p | grep gcc
	libgcc_s.so.1 (libc6,x86-64) => /lib64/libgcc_s.so.1

创建数据库存放目录

[root@localhost ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x40a343e9.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-67108863, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-67108863, default 67108863): +10GF^H
Unsupported suffix: 'G'.
Supported: 10^N: KB (KiloByte), MB (MegaByte), GB (GigaByte)
            2^N: K  (KibiByte), M  (MebiByte), G  (GibiByte)
Last sector, +sectors or +size{K,M,G} (2048-67108863, default 67108863): +10G
Partition 1 of type Linux and of size 10 GiB is set

Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# pvcreate /dev/sdb
sdb   sdb1  
[root@localhost ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created.
[root@localhost ~]# vgcreate data /dev/sdb1
  Volume group "data" successfully created
[root@localhost ~]# lvcreate -L 2G -n mydata data
  Logical volume "mydata" created.
[root@localhost ~]# mke2fs -t ext4 -L Mydata -b 4096 -m 3 /dev/data/mydata 
mke2fs 1.42.9 (28-Dec-2013)
Discarding device blocks: done
Filesystem label=Mydata
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
131072 inodes, 524288 blocks
15728 blocks (3.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done 

[root@localhost ~]# mount /dev/mapper/data-mydata /data/mydata

创建mysql用户

[root@localhost ~]# groupadd mysql
[root@localhost ~]# useradd -s /sbin/nologin -g mysql -M mysql
[root@localhost ~]# id mysql 
uid=1000(mysql) gid=1000(mysql) groups=1000(mysql)
[root@localhost ~]# mkdir -pv /data/mydata/
[root@localhost ~]# chown -R mysql.mysql /data/mydata/

安装相关包

[root@lightserver ~]$ yum -y install libaio libaio-devel bison bison-devel zlib-devel openssl openssl-devel ncurses ncurses-devel libcurl-devel libarchive-devel boost boost-devel lsof wget gcc gcc-c++ make cmake perl kernel-headers kernel-devel pcre-devel

安装cmake

wget https://cmake.org/files/v3.12/cmake-3.12.1.tar.gz
tar -zxvf cmake-3.12.1.tar.gz
cd cmake-3.12.1/
./bootstrap

-- Looking for wsyncup in /usr/lib64/libcurses.so
-- Looking for wsyncup in /usr/lib64/libcurses.so - found
-- Looking for cbreak in /usr/lib64/libncurses.so
-- Looking for cbreak in /usr/lib64/libncurses.so - found
-- Found Curses: /usr/lib64/libncurses.so  
-- Looking for elf.h
-- Looking for elf.h - found
-- Looking for a Fortran compiler
-- Looking for a Fortran compiler - NOTFOUND
-- Performing Test run_pic_test
-- Performing Test run_pic_test - Success
-- Performing Test run_inlines_hidden_test
-- Performing Test run_inlines_hidden_test - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /root/mariadb-10.5.0-linux-x86_64/cmake-3.12.1
---------------------------------------------
CMake has bootstrapped.  Now run gmake.

在这里插入图片描述

接着执行gmake
在这里插入图片描述

接下来就是 make并且install
make && make install

[root@localhost cmake-3.12.1]# cmake --version
cmake version 3.12.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

注意: 以上为特定要求执行的编译,如若失败请以全新环境再次按照以下顺序进行编译安装
再次确认安装依赖包

wget http://ftp.hosteurope.de/mirror/archive.mariadb.org/mariadb-10.2.25/source/mariadb-10.2.25.tar.gz

tar xf mariadb-10.2.25.tar.gz

yum -y install readline-devel zlib-devel openssl-devel
yum install bison bison-devel zlib-devel libcurl-devel libarchive-devel boost-devel gcc gcc-c++ cmake ncurses-devel gnutls-devel libxml2-devel openssl-devel libevent-devel libaio-devel -y

安装MariaDB 数据库

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/mydata/data/ -DSYSCONFDIR=/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STPRAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWIYH_READLINE=1 -DWIYH_SSL=system -DVITH_ZLIB=system -DWITH_LOBWRAP=0 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci


[root@localhost mariadb-10.2.25]# make && make install
Scanning dependencies of target INFO_BIN
[  0%] Built target INFO_BIN
Scanning dependencies of target INFO_SRC
[  0%] Built target INFO_SRC
Scanning dependencies of target abi_check
[  0%] Built target abi_check
Scanning dependencies of target readline
[  0%] Building C object extra/readline/CMakeFiles/readline.dir/readline.c.o
[  0%] Building C object extra/readline/CMakeFiles/readline.dir/funmap.c.o
[  0%] Building C object extra/readline/CMakeFiles/readline.dir/keymaps.c.o
[  0%] Building C object extra/readline/CMakeFiles/readline.dir/vi_mode.c.o
[  0%] Building C object extra/readline/CMakeFiles/readline.dir/parens.c.o
[  0%] Building C object extra/readline/CMakeFiles/readline.dir/rltty.c.o
[  0%] Building C object extra/readline/CMakeFiles/readline.dir/complete.c.o
[  0%] Building C object extra/readline/CMakeFiles/readline.dir/bind.c.o
[  0%] Building C object extra/readline/CMakeFiles/readline.dir/isearch.c.o
[  0%] Building C object extra/readline/CMakeFiles/readline.dir/display.c.o
[  0%] Building C object extra/readline/CMakeFiles/readline.dir/signals.c.o
[  0%] Building C object extra/readline/CMakeFiles/readline.dir/util.c.o
[  0%] Building C object extra/readline/CMakeFiles/readline.dir/kill.c.o
[  1%] Building C object extra/readline/CMakeFiles/readline.dir/undo.c.o
[  1%] Building C object extra/readline/CMakeFiles/readline.dir/macro.c.o
[  1%] Building C object extra/readline/CMakeFiles/readline.dir/input.c.o
[  1%] Building C object extra/readline/CMakeFiles/readline.dir/callback.c.o

初始化数据库

cd /usr/local/mysql
[root@localhost mysql]# scripts/mysql_install_db --datadir=/data/mydata --user=mysql
Installing MariaDB/MySQL system tables in '/mydata/data' ...
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:

'./bin/mysqladmin' -u root password 'new-password'
'./bin/mysqladmin' -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:
'./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 '.' ; ./bin/mysqld_safe --datadir='/mydata/data'

You can test the MariaDB daemon with mysql-test-run.pl
cd './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/

vim /etc/my.cnf
[mysqld]
port        = 3306
socket      = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
datadir = /data/mydata ####添加此项 目录根据真是存放数据位置                                                                                                                             
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8

设置启动脚本

cp support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --list mysqld

启动完毕

[root@localhost mysql]# systemctl status mysql
● mysqld.service - LSB: start and stop MariaDB
   Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
   Active: active (running) since Mon 2020-04-27 22:24:03 CST; 25s ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/mysqld.service
           ├─42353 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mydata --pid-file=/data/mydata/localhost.localdomain.pid
           └─42477 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mydata --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql...

Apr 27 22:24:02 localhost.localdomain systemd[1]: Starting LSB: start and stop MariaDB...
Apr 27 22:24:02 localhost.localdomain mysqld[42295]: Starting MariaDB.200427 22:24:02 mysqld_safe Logging to '/data/mydata/localhost.localdomain.err'.
Apr 27 22:24:02 localhost.localdomain mysqld[42295]: 200427 22:24:02 mysqld_safe Starting mysqld daemon with databases from /data/mydata
Apr 27 22:24:03 localhost.localdomain mysqld[42295]: SUCCESS!
Apr 27 22:24:03 localhost.localdomain systemd[1]: Started LSB: start and stop MariaDB.
[root@localhost mysql]# ss -tunl | grep 3306
tcp    LISTEN     0      80     [::]:3306               [::]:*   

登陆

[root@localhost mysql]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 10.2.25-MariaDB-log Source distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值