快速配置 CentOS 7.0 服务器

快速配置CentOS服务器

Java 安装

[root@54lxb ~]# cd /home
[root@54lxb home]# ll
total 410520
-rw-r--r-- 1 root root 176154027 Nov 16 13:05 jdk-8u191-linux-x64.rpm
-rw-r--r-- 1 root root 243793920 Nov 16 15:45 MySQL-5.6.42-1.el7.x86_64.rpm-bundle.tar
[root@54lxb home]# rpm -ivh jdk-8u191-linux-x64.rpm
warning: jdk-8u191-linux-x64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:jdk1.8-2000:1.8.0_191-fcs        ################################# [100%]
Unpacking JAR files...
	tools.jar...
	plugin.jar...
	javaws.jar...
	deploy.jar...
	rt.jar...
	jsse.jar...
	charsets.jar...
	localedata.jar...
[root@54lxb home]#
[root@54lxb home]# java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
[root@54lxb home]# javac
Usage: javac  
where possible options include:
  -g                         Generate all debugging info
  -g:none                    Generate no debugging info
  -g:{lines,vars,source}     Generate only some debugging info
  -nowarn                    Generate no warnings
  -verbose                   Output messages about what the compiler is doing
  -deprecation               Output source locations where deprecated APIs are used
  -classpath           Specify where to find user class files and annotation processors
  -cp                  Specify where to find user class files and annotation processors
  -sourcepath          Specify where to find input source files
  -bootclasspath       Override location of bootstrap class files
  -extdirs             Override location of installed extensions
  -endorseddirs        Override location of endorsed standards path
  -proc:{none,only}          Control whether annotation processing and/or compilation is done.
  -processor [,,...] Names of the annotation processors to run; bypasses default discovery process
  -processorpath       Specify where to find annotation processors
  -parameters                Generate metadata for reflection on method parameters
  -d              Specify where to place generated class files
  -s              Specify where to place generated source files
  -h              Specify where to place generated native header files
  -implicit:{none,class}     Specify whether or not to generate class files for implicitly referenced files
  -encoding        Specify character encoding used by source files
  -source           Provide source compatibility with specified release
  -target           Generate class files for specific VM version
  -profile          Check that API used is available in the specified profile
  -version                   Version information
  -help                      Print a synopsis of standard options
  -Akey[=value]              Options to pass to annotation processors
  -X                         Print a synopsis of nonstandard options
  -J                   Pass  directly to the runtime system
  -Werror                    Terminate compilation if warnings occur
  @                Read options and filenames from file

[root@54lxb home]# clear

Nginx 安装

[root@54lxb home]# yum -y list nginx*
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Available Packages
nginx.x86_64                                                                                          1:1.12.2-2.el7                                                                    epel
nginx-all-modules.noarch                                                                              1:1.12.2-2.el7                                                                    epel
nginx-filesystem.noarch                                                                               1:1.12.2-2.el7                                                                    epel
nginx-mod-http-geoip.x86_64                                                                           1:1.12.2-2.el7                                                                    epel
nginx-mod-http-image-filter.x86_64                                                                    1:1.12.2-2.el7                                                                    epel
nginx-mod-http-perl.x86_64                                                                            1:1.12.2-2.el7                                                                    epel
nginx-mod-http-xslt-filter.x86_64                                                                     1:1.12.2-2.el7                                                                    epel
nginx-mod-mail.x86_64                                                                                 1:1.12.2-2.el7                                                                    epel
nginx-mod-stream.x86_64                                                                               1:1.12.2-2.el7                                                                    epel
[root@54lxb home]# yum install nginx.x86_64
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.12.2-2.el7 will be installed
--> Processing Dependency: nginx-filesystem = 1:1.12.2-2.el7 for package: 1:nginx-1.12.2-2.el7.x86_64
--> Processing Dependency: nginx-all-modules = 1:1.12.2-2.el7 for package: 1:nginx-1.12.2-2.el7.x86_64
--> Processing Dependency: nginx-filesystem for package: 1:nginx-1.12.2-2.el7.x86_64
--> Processing Dependency: libprofiler.so.0()(64bit) for package: 1:nginx-1.12.2-2.el7.x86_64
--> Running transaction check
---> Package gperftools-libs.x86_64 0:2.6.1-1.el7 will be installed
---> Package nginx-all-modules.noarch 1:1.12.2-2.el7 will be installed
--> Processing Dependency: nginx-mod-stream = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-mail = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-http-xslt-filter = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-http-perl = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-http-image-filter = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-http-geoip = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
---> Package nginx-filesystem.noarch 1:1.12.2-2.el7 will be installed
--> Running transaction check
---> Package nginx-mod-http-geoip.x86_64 1:1.12.2-2.el7 will be installed
---> Package nginx-mod-http-image-filter.x86_64 1:1.12.2-2.el7 will be installed
--> Processing Dependency: gd for package: 1:nginx-mod-http-image-filter-1.12.2-2.el7.x86_64
--> Processing Dependency: libgd.so.2()(64bit) for package: 1:nginx-mod-http-image-filter-1.12.2-2.el7.x86_64
---> Package nginx-mod-http-perl.x86_64 1:1.12.2-2.el7 will be installed
---> Package nginx-mod-http-xslt-filter.x86_64 1:1.12.2-2.el7 will be installed
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.18)(64bit) for package: 1:nginx-mod-http-xslt-filter-1.12.2-2.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.11)(64bit) for package: 1:nginx-mod-http-xslt-filter-1.12.2-2.el7.x86_64
--> Processing Dependency: libxslt.so.1()(64bit) for package: 1:nginx-mod-http-xslt-filter-1.12.2-2.el7.x86_64
--> Processing Dependency: libexslt.so.0()(64bit) for package: 1:nginx-mod-http-xslt-filter-1.12.2-2.el7.x86_64
---> Package nginx-mod-mail.x86_64 1:1.12.2-2.el7 will be installed
---> Package nginx-mod-stream.x86_64 1:1.12.2-2.el7 will be installed
--> Running transaction check
---> Package gd.x86_64 0:2.0.35-26.el7 will be installed
--> Processing Dependency: libpng15.so.15(PNG15_0)(64bit) for package: gd-2.0.35-26.el7.x86_64
--> Processing Dependency: libpng15.so.15()(64bit) for package: gd-2.0.35-26.el7.x86_64
--> Processing Dependency: libfontconfig.so.1()(64bit) for package: gd-2.0.35-26.el7.x86_64
--> Processing Dependency: libXpm.so.4()(64bit) for package: gd-2.0.35-26.el7.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: gd-2.0.35-26.el7.x86_64
---> Package libxslt.x86_64 0:1.1.28-5.el7 will be installed
--> Running transaction check
---> Package fontconfig.x86_64 0:2.10.95-11.el7 will be installed
--> Processing Dependency: fontpackages-filesystem for package: fontconfig-2.10.95-11.el7.x86_64
--> Processing Dependency: font(:lang=en) for package: fontconfig-2.10.95-11.el7.x86_64
---> Package libX11.x86_64 0:1.6.5-1.el7 will be installed
--> Processing Dependency: libX11-common >= 1.6.5-1.el7 for package: libX11-1.6.5-1.el7.x86_64
--> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.6.5-1.el7.x86_64
---> Package libXpm.x86_64 0:3.5.12-1.el7 will be installed
---> Package libpng.x86_64 2:1.5.13-7.el7_2 will be installed
--> Running transaction check
---> Package fontpackages-filesystem.noarch 0:1.44-8.el7 will be installed
---> Package libX11-common.noarch 0:1.6.5-1.el7 will be installed
---> Package libxcb.x86_64 0:1.12-1.el7 will be installed
--> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.12-1.el7.x86_64
---> Package lyx-fonts.noarch 0:2.2.3-1.el7 will be installed
--> Running transaction check
---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================
 Package                                                    Arch                                  Version                                         Repository                           Size
============================================================================================================================================================================================
Installing:
 nginx                                                      x86_64                                1:1.12.2-2.el7                                  epel                                530 k
Installing for dependencies:
 fontconfig                                                 x86_64                                2.10.95-11.el7                                  os                                  229 k
 fontpackages-filesystem                                    noarch                                1.44-8.el7                                      os                                  9.9 k
 gd                                                         x86_64                                2.0.35-26.el7                                   os                                  146 k
 gperftools-libs                                            x86_64                                2.6.1-1.el7                                     os                                  272 k
 libX11                                                     x86_64                                1.6.5-1.el7                                     os                                  606 k
 libX11-common                                              noarch                                1.6.5-1.el7                                     os                                  164 k
 libXau                                                     x86_64                                1.0.8-2.1.el7                                   os                                   29 k
 libXpm                                                     x86_64                                3.5.12-1.el7                                    os                                   55 k
 libpng                                                     x86_64                                2:1.5.13-7.el7_2                                os                                  213 k
 libxcb                                                     x86_64                                1.12-1.el7                                      os                                  211 k
 libxslt                                                    x86_64                                1.1.28-5.el7                                    os                                  242 k
 lyx-fonts                                                  noarch                                2.2.3-1.el7                                     epel                                159 k
 nginx-all-modules                                          noarch                                1:1.12.2-2.el7                                  epel                                 16 k
 nginx-filesystem                                           noarch                                1:1.12.2-2.el7                                  epel                                 17 k
 nginx-mod-http-geoip                                       x86_64                                1:1.12.2-2.el7                                  epel                                 23 k
 nginx-mod-http-image-filter                                x86_64                                1:1.12.2-2.el7                                  epel                                 26 k
 nginx-mod-http-perl                                        x86_64                                1:1.12.2-2.el7                                  epel                                 36 k
 nginx-mod-http-xslt-filter                                 x86_64                                1:1.12.2-2.el7                                  epel                                 26 k
 nginx-mod-mail                                             x86_64                                1:1.12.2-2.el7                                  epel                                 54 k
 nginx-mod-stream                                           x86_64                                1:1.12.2-2.el7                                  epel                                 76 k

Transaction Summary
============================================================================================================================================================================================
Install  1 Package (+20 Dependent packages)

Total download size: 3.1 M
Installed size: 9.3 M
Is this ok [y/d/N]: y
Downloading packages:
(1/21): fontpackages-filesystem-1.44-8.el7.noarch.rpm                                                                                                                | 9.9 kB  00:00:00     
(2/21): fontconfig-2.10.95-11.el7.x86_64.rpm                                                                                                                         | 229 kB  00:00:00     
(3/21): gd-2.0.35-26.el7.x86_64.rpm                                                                                                                                  | 146 kB  00:00:00     
(4/21): libX11-1.6.5-1.el7.x86_64.rpm                                                                                                                                | 606 kB  00:00:00     
(5/21): libX11-common-1.6.5-1.el7.noarch.rpm                                                                                                                         | 164 kB  00:00:00     
(6/21): libXau-1.0.8-2.1.el7.x86_64.rpm                                                                                                                              |  29 kB  00:00:00     
(7/21): libXpm-3.5.12-1.el7.x86_64.rpm                                                                                                                               |  55 kB  00:00:00     
(8/21): libpng-1.5.13-7.el7_2.x86_64.rpm                                                                                                                             | 213 kB  00:00:00     
(9/21): libxcb-1.12-1.el7.x86_64.rpm                                                                                                                                 | 211 kB  00:00:00     
(10/21): libxslt-1.1.28-5.el7.x86_64.rpm                                                                                                                             | 242 kB  00:00:00     
(11/21): lyx-fonts-2.2.3-1.el7.noarch.rpm                                                                                                                            | 159 kB  00:00:00     
(12/21): nginx-all-modules-1.12.2-2.el7.noarch.rpm                                                                                                                   |  16 kB  00:00:00     
(13/21): nginx-filesystem-1.12.2-2.el7.noarch.rpm                                                                                                                    |  17 kB  00:00:00     
(14/21): nginx-mod-http-geoip-1.12.2-2.el7.x86_64.rpm                                                                                                                |  23 kB  00:00:00     
(15/21): nginx-mod-http-image-filter-1.12.2-2.el7.x86_64.rpm                                                                                                         |  26 kB  00:00:00     
(16/21): nginx-mod-http-perl-1.12.2-2.el7.x86_64.rpm                                                                                                                 |  36 kB  00:00:00     
(17/21): nginx-mod-http-xslt-filter-1.12.2-2.el7.x86_64.rpm                                                                                                          |  26 kB  00:00:00     
(18/21): nginx-mod-mail-1.12.2-2.el7.x86_64.rpm                                                                                                                      |  54 kB  00:00:00     
(19/21): nginx-mod-stream-1.12.2-2.el7.x86_64.rpm                                                                                                                    |  76 kB  00:00:00     
(20/21): gperftools-libs-2.6.1-1.el7.x86_64.rpm                                                                                                                      | 272 kB  00:00:10     
(21/21): nginx-1.12.2-2.el7.x86_64.rpm                                                                                                                               | 530 kB  00:00:12     
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                       251 kB/s | 3.1 MB  00:00:12     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : fontpackages-filesystem-1.44-8.el7.noarch                                                                                                                               1/21 
  Installing : lyx-fonts-2.2.3-1.el7.noarch                                                                                                                                            2/21 
  Installing : fontconfig-2.10.95-11.el7.x86_64                                                                                                                                        3/21 
  Installing : libX11-common-1.6.5-1.el7.noarch                                                                                                                                        4/21 
  Installing : gperftools-libs-2.6.1-1.el7.x86_64                                                                                                                                      5/21 
  Installing : libxslt-1.1.28-5.el7.x86_64                                                                                                                                             6/21 
  Installing : libXau-1.0.8-2.1.el7.x86_64                                                                                                                                             7/21 
  Installing : libxcb-1.12-1.el7.x86_64                                                                                                                                                8/21 
  Installing : libX11-1.6.5-1.el7.x86_64                                                                                                                                               9/21 
  Installing : libXpm-3.5.12-1.el7.x86_64                                                                                                                                             10/21 
  Installing : 2:libpng-1.5.13-7.el7_2.x86_64                                                                                                                                         11/21 
  Installing : gd-2.0.35-26.el7.x86_64                                                                                                                                                12/21 
  Installing : 1:nginx-filesystem-1.12.2-2.el7.noarch                                                                                                                                 13/21 
  Installing : 1:nginx-mod-mail-1.12.2-2.el7.x86_64                                                                                                                                   14/21 
  Installing : 1:nginx-mod-http-geoip-1.12.2-2.el7.x86_64                                                                                                                             15/21 
  Installing : 1:nginx-mod-http-xslt-filter-1.12.2-2.el7.x86_64                                                                                                                       16/21 
  Installing : 1:nginx-mod-http-perl-1.12.2-2.el7.x86_64                                                                                                                              17/21 
  Installing : 1:nginx-mod-stream-1.12.2-2.el7.x86_64                                                                                                                                 18/21 
  Installing : 1:nginx-1.12.2-2.el7.x86_64                                                                                                                                            19/21 
  Installing : 1:nginx-mod-http-image-filter-1.12.2-2.el7.x86_64                                                                                                                      20/21 
  Installing : 1:nginx-all-modules-1.12.2-2.el7.noarch                                                                                                                                21/21 
  Verifying  : libXpm-3.5.12-1.el7.x86_64                                                                                                                                              1/21 
  Verifying  : libX11-1.6.5-1.el7.x86_64                                                                                                                                               2/21 
  Verifying  : lyx-fonts-2.2.3-1.el7.noarch                                                                                                                                            3/21 
  Verifying  : 1:nginx-filesystem-1.12.2-2.el7.noarch                                                                                                                                  4/21 
  Verifying  : gd-2.0.35-26.el7.x86_64                                                                                                                                                 5/21 
  Verifying  : 2:libpng-1.5.13-7.el7_2.x86_64                                                                                                                                          6/21 
  Verifying  : libXau-1.0.8-2.1.el7.x86_64                                                                                                                                             7/21 
  Verifying  : fontconfig-2.10.95-11.el7.x86_64                                                                                                                                        8/21 
  Verifying  : libxslt-1.1.28-5.el7.x86_64                                                                                                                                             9/21 
  Verifying  : gperftools-libs-2.6.1-1.el7.x86_64                                                                                                                                     10/21 
  Verifying  : 1:nginx-1.12.2-2.el7.x86_64                                                                                                                                            11/21 
  Verifying  : 1:nginx-mod-mail-1.12.2-2.el7.x86_64                                                                                                                                   12/21 
  Verifying  : libxcb-1.12-1.el7.x86_64                                                                                                                                               13/21 
  Verifying  : 1:nginx-all-modules-1.12.2-2.el7.noarch                                                                                                                                14/21 
  Verifying  : 1:nginx-mod-http-geoip-1.12.2-2.el7.x86_64                                                                                                                             15/21 
  Verifying  : 1:nginx-mod-http-xslt-filter-1.12.2-2.el7.x86_64                                                                                                                       16/21 
  Verifying  : 1:nginx-mod-http-image-filter-1.12.2-2.el7.x86_64                                                                                                                      17/21 
  Verifying  : 1:nginx-mod-http-perl-1.12.2-2.el7.x86_64                                                                                                                              18/21 
  Verifying  : libX11-common-1.6.5-1.el7.noarch                                                                                                                                       19/21 
  Verifying  : fontpackages-filesystem-1.44-8.el7.noarch                                                                                                                              20/21 
  Verifying  : 1:nginx-mod-stream-1.12.2-2.el7.x86_64                                                                                                                                 21/21 

Installed:
  nginx.x86_64 1:1.12.2-2.el7                                                                                                                                                               

Dependency Installed:
  fontconfig.x86_64 0:2.10.95-11.el7        fontpackages-filesystem.noarch 0:1.44-8.el7      gd.x86_64 0:2.0.35-26.el7                  gperftools-libs.x86_64 0:2.6.1-1.el7             
  libX11.x86_64 0:1.6.5-1.el7               libX11-common.noarch 0:1.6.5-1.el7               libXau.x86_64 0:1.0.8-2.1.el7              libXpm.x86_64 0:3.5.12-1.el7                     
  libpng.x86_64 2:1.5.13-7.el7_2            libxcb.x86_64 0:1.12-1.el7                       libxslt.x86_64 0:1.1.28-5.el7              lyx-fonts.noarch 0:2.2.3-1.el7                   
  nginx-all-modules.noarch 1:1.12.2-2.el7   nginx-filesystem.noarch 1:1.12.2-2.el7           nginx-mod-http-geoip.x86_64 1:1.12.2-2.el7 nginx-mod-http-image-filter.x86_64 1:1.12.2-2.el7
  nginx-mod-http-perl.x86_64 1:1.12.2-2.el7 nginx-mod-http-xslt-filter.x86_64 1:1.12.2-2.el7 nginx-mod-mail.x86_64 1:1.12.2-2.el7       nginx-mod-stream.x86_64 1:1.12.2-2.el7           

Complete!
[root@54lxb home]# whereis nginx
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man3/nginx.3pm.gz /usr/share/man/man8/nginx.8.gz
[root@54lxb home]# 
[root@54lxb home]# /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

[root@54lxb home]# systemctl enable nginx.service
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
[root@54lxb home]# systemctl start nginx.service

MySQL 安装

[root@54lxb home]# tar -xvf MySQL-5.6.42-1.el7.x86_64.rpm-bundle.tar
MySQL-client-5.6.42-1.el7.x86_64.rpm
MySQL-server-5.6.42-1.el7.x86_64.rpm
MySQL-shared-compat-5.6.42-1.el7.x86_64.rpm
MySQL-shared-5.6.42-1.el7.x86_64.rpm
MySQL-test-5.6.42-1.el7.x86_64.rpm
MySQL-embedded-5.6.42-1.el7.x86_64.rpm
MySQL-devel-5.6.42-1.el7.x86_64.rpm
[root@54lxb home]# rpm -qa | grep -i mysql
[root@54lxb home]# groupadd mysql
[root@54lxb home]# useradd -r -g mysql mysql
[root@54lxb home]# rpm -ivh MySQL-shared-compat-5.6.42-1.el7.x86_64.rpm
warning: MySQL-shared-compat-5.6.42-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
	mariadb-libs is obsoleted by MySQL-shared-compat-5.6.42-1.el7.x86_64
[root@54lxb home]# rpm -qa |grep maridb
[root@54lxb home]# rpm -qa | grep maridb
[root@54lxb home]# rpm -qa | grep maridb*
[root@54lxb home]# rpm -e --nodeps mariadb-libs-*
[root@54lxb home]# rpm -ivh MySQL-shared-compat-5.6.42-1.el7.x86_64.rpm
warning: MySQL-shared-compat-5.6.42-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:MySQL-shared-compat-5.6.42-1.el7 ################################# [100%]
[root@54lxb home]# rpm -ivh MySQL-devel-5.6.42-1.el7.x86_64.rpm
warning: MySQL-devel-5.6.42-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:MySQL-devel-5.6.42-1.el7         ################################# [100%]
[root@54lxb home]# rpm -ivh MySQL-client-5.6.42-1.el7.x86_64.rpm
warning: MySQL-client-5.6.42-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:MySQL-client-5.6.42-1.el7        ################################# [100%]
[root@54lxb home]# rpm -ivh MySQL-server-5.6.42-1.el7.x86_64.rpm
warning: MySQL-server-5.6.42-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
	libnuma.so.1()(64bit) is needed by MySQL-server-5.6.42-1.el7.x86_64
	libnuma.so.1(libnuma_1.1)(64bit) is needed by MySQL-server-5.6.42-1.el7.x86_64
	libnuma.so.1(libnuma_1.2)(64bit) is needed by MySQL-server-5.6.42-1.el7.x86_64
	perl(Data::Dumper) is needed by MySQL-server-5.6.42-1.el7.x86_64
[root@54lxb home]# yum install numactl-libs
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package numactl-libs.x86_64 0:2.0.9-7.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================
 Package                                          Arch                                       Version                                           Repository                              Size
============================================================================================================================================================================================
Installing:
 numactl-libs                                     x86_64                                     2.0.9-7.el7                                       os                                      29 k

Transaction Summary
============================================================================================================================================================================================
Install  1 Package

Total download size: 29 k
Installed size: 50 k
Is this ok [y/d/N]: y
Downloading packages:
numactl-libs-2.0.9-7.el7.x86_64.rpm                                                                                                                                  |  29 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:
2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18()(64bit)
2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18(libmysqlclient_18)(64bit)
  Installing : numactl-libs-2.0.9-7.el7.x86_64                                                                                                                                          1/1 
  Verifying  : numactl-libs-2.0.9-7.el7.x86_64                                                                                                                                          1/1 

Installed:
  numactl-libs.x86_64 0:2.0.9-7.el7                                                                                                                                                         

Complete!
[root@54lxb home]# rpm -ivh MySQL-server-5.6.42-1.el7.x86_64.rpm
warning: MySQL-server-5.6.42-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
	perl(Data::Dumper) is needed by MySQL-server-5.6.42-1.el7.x86_64
[root@54lxb home]# rpm -ivh MySQL-server-5.6.42-1.el7.x86_64.rpm
warning: MySQL-server-5.6.42-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
	perl(Data::Dumper) is needed by MySQL-server-5.6.42-1.el7.x86_64
[root@54lxb home]# rpm -e MySQL-server-5.6.42-1.el7.x86_64
error: package MySQL-server-5.6.42-1.el7.x86_64 is not installed
[root@54lxb home]# yum install perl
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package perl.x86_64 4:5.16.3-291.el7 will be updated
---> Package perl.x86_64 4:5.16.3-292.el7 will be an update
--> Processing Dependency: perl-libs = 4:5.16.3-292.el7 for package: 4:perl-5.16.3-292.el7.x86_64
--> Running transaction check
---> Package perl-libs.x86_64 4:5.16.3-291.el7 will be updated
---> Package perl-libs.x86_64 4:5.16.3-292.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================
 Package                                       Arch                                       Version                                              Repository                              Size
============================================================================================================================================================================================
Updating:
 perl                                          x86_64                                     4:5.16.3-292.el7                                     os                                     8.0 M
Updating for dependencies:
 perl-libs                                     x86_64                                     4:5.16.3-292.el7                                     os                                     688 k

Transaction Summary
============================================================================================================================================================================================
Upgrade  1 Package (+1 Dependent package)

Total download size: 8.6 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/2): perl-libs-5.16.3-292.el7.x86_64.rpm                                                                                                                           | 688 kB  00:00:00     
(2/2): perl-5.16.3-292.el7.x86_64.rpm                                                                                                                                | 8.0 MB  00:00:01     
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                       5.9 MB/s | 8.6 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : 4:perl-libs-5.16.3-292.el7.x86_64                                                                                                                                        1/4 
  Updating   : 4:perl-5.16.3-292.el7.x86_64                                                                                                                                             2/4 
  Cleanup    : 4:perl-libs-5.16.3-291.el7.x86_64                                                                                                                                        3/4 
  Cleanup    : 4:perl-5.16.3-291.el7.x86_64                                                                                                                                             4/4 
  Verifying  : 4:perl-5.16.3-292.el7.x86_64                                                                                                                                             1/4 
  Verifying  : 4:perl-libs-5.16.3-292.el7.x86_64                                                                                                                                        2/4 
  Verifying  : 4:perl-libs-5.16.3-291.el7.x86_64                                                                                                                                        3/4 
  Verifying  : 4:perl-5.16.3-291.el7.x86_64                                                                                                                                             4/4 

Updated:
  perl.x86_64 4:5.16.3-292.el7                                                                                                                                                              

Dependency Updated:
  perl-libs.x86_64 4:5.16.3-292.el7                                                                                                                                                         

Complete!
[root@54lxb home]# rpm -ivh MySQL-server-5.6.42-1.el7.x86_64.rpm
warning: MySQL-server-5.6.42-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
	perl(Data::Dumper) is needed by MySQL-server-5.6.42-1.el7.x86_64
[root@54lxb home]# yum -y install autoconf
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package autoconf.noarch 0:2.69-11.el7 will be installed
--> Processing Dependency: m4 >= 1.4.14 for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(Data::Dumper) for package: autoconf-2.69-11.el7.noarch
--> Running transaction check
---> Package m4.x86_64 0:1.4.16-10.el7 will be installed
---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================
 Package                                             Arch                                      Version                                          Repository                             Size
============================================================================================================================================================================================
Installing:
 autoconf                                            noarch                                    2.69-11.el7                                      os                                    701 k
Installing for dependencies:
 m4                                                  x86_64                                    1.4.16-10.el7                                    os                                    256 k
 perl-Data-Dumper                                    x86_64                                    2.145-3.el7                                      os                                     47 k

Transaction Summary
============================================================================================================================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 1.0 M
Installed size: 2.8 M
Downloading packages:
(1/3): m4-1.4.16-10.el7.x86_64.rpm                                                                                                                                   | 256 kB  00:00:00     
(2/3): perl-Data-Dumper-2.145-3.el7.x86_64.rpm                                                                                                                       |  47 kB  00:00:00     
(3/3): autoconf-2.69-11.el7.noarch.rpm                                                                                                                               | 701 kB  00:00:00     
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                       1.8 MB/s | 1.0 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : m4-1.4.16-10.el7.x86_64                                                                                                                                                  1/3 
  Installing : perl-Data-Dumper-2.145-3.el7.x86_64                                                                                                                                      2/3 
  Installing : autoconf-2.69-11.el7.noarch                                                                                                                                              3/3 
  Verifying  : perl-Data-Dumper-2.145-3.el7.x86_64                                                                                                                                      1/3 
  Verifying  : m4-1.4.16-10.el7.x86_64                                                                                                                                                  2/3 
  Verifying  : autoconf-2.69-11.el7.noarch                                                                                                                                              3/3 

Installed:
  autoconf.noarch 0:2.69-11.el7                                                                                                                                                             

Dependency Installed:
  m4.x86_64 0:1.4.16-10.el7                                                              perl-Data-Dumper.x86_64 0:2.145-3.el7                                                             

Complete!
[root@54lxb home]# rpm -ivh MySQL-server-5.6.42-1.el7.x86_64.rpm
warning: MySQL-server-5.6.42-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:MySQL-server-5.6.42-1.el7        ################################# [100%]
2018-11-19 16:15:32 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-11-19 16:15:32 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-11-19 16:15:32 0 [Note] /usr/sbin/mysqld (mysqld 5.6.42) starting as process 13899 ...
2018-11-19 16:15:32 13899 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-11-19 16:15:32 13899 [Note] InnoDB: The InnoDB memory heap is disabled
2018-11-19 16:15:32 13899 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-11-19 16:15:32 13899 [Note] InnoDB: Memory barrier is not used
2018-11-19 16:15:32 13899 [Note] InnoDB: Compressed tables use zlib 1.2.11
2018-11-19 16:15:32 13899 [Note] InnoDB: Using Linux native AIO
2018-11-19 16:15:32 13899 [Note] InnoDB: Using CPU crc32 instructions
2018-11-19 16:15:32 13899 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-11-19 16:15:32 13899 [Note] InnoDB: Completed initialization of buffer pool
2018-11-19 16:15:32 13899 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2018-11-19 16:15:32 13899 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2018-11-19 16:15:32 13899 [Note] InnoDB: Database physically writes the file full: wait...
2018-11-19 16:15:32 13899 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2018-11-19 16:15:32 13899 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2018-11-19 16:15:33 13899 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2018-11-19 16:15:33 13899 [Warning] InnoDB: New log files created, LSN=45781
2018-11-19 16:15:33 13899 [Note] InnoDB: Doublewrite buffer not found: creating new
2018-11-19 16:15:33 13899 [Note] InnoDB: Doublewrite buffer created
2018-11-19 16:15:33 13899 [Note] InnoDB: 128 rollback segment(s) are active.
2018-11-19 16:15:33 13899 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-11-19 16:15:33 13899 [Note] InnoDB: Foreign key constraint system tables created
2018-11-19 16:15:33 13899 [Note] InnoDB: Creating tablespace and datafile system tables.
2018-11-19 16:15:33 13899 [Note] InnoDB: Tablespace and datafile system tables created.
2018-11-19 16:15:33 13899 [Note] InnoDB: Waiting for purge to start
2018-11-19 16:15:33 13899 [Note] InnoDB: 5.6.42 started; log sequence number 0
A random root password has been set. You will find it in '/root/.mysql_secret'.
2018-11-19 16:15:34 13899 [Note] Binlog end
2018-11-19 16:15:34 13899 [Note] InnoDB: FTS optimize thread exiting.
2018-11-19 16:15:34 13899 [Note] InnoDB: Starting shutdown...
2018-11-19 16:15:35 13899 [Note] InnoDB: Shutdown completed; log sequence number 1625977


2018-11-19 16:15:35 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-11-19 16:15:35 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-11-19 16:15:35 0 [Note] /usr/sbin/mysqld (mysqld 5.6.42) starting as process 13922 ...
2018-11-19 16:15:35 13922 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-11-19 16:15:35 13922 [Note] InnoDB: The InnoDB memory heap is disabled
2018-11-19 16:15:35 13922 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-11-19 16:15:35 13922 [Note] InnoDB: Memory barrier is not used
2018-11-19 16:15:35 13922 [Note] InnoDB: Compressed tables use zlib 1.2.11
2018-11-19 16:15:35 13922 [Note] InnoDB: Using Linux native AIO
2018-11-19 16:15:35 13922 [Note] InnoDB: Using CPU crc32 instructions
2018-11-19 16:15:35 13922 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-11-19 16:15:35 13922 [Note] InnoDB: Completed initialization of buffer pool
2018-11-19 16:15:35 13922 [Note] InnoDB: Highest supported file format is Barracuda.
2018-11-19 16:15:35 13922 [Note] InnoDB: 128 rollback segment(s) are active.
2018-11-19 16:15:35 13922 [Note] InnoDB: Waiting for purge to start
2018-11-19 16:15:35 13922 [Note] InnoDB: 5.6.42 started; log sequence number 1625977
2018-11-19 16:15:35 13922 [Note] Binlog end
2018-11-19 16:15:35 13922 [Note] InnoDB: FTS optimize thread exiting.
2018-11-19 16:15:35 13922 [Note] InnoDB: Starting shutdown...
2018-11-19 16:15:37 13922 [Note] InnoDB: Shutdown completed; log sequence number 1625987




A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

  /usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.
This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

[root@54lxb home]# rpm -ivh MySQL-shared-5.6.42-1.el7.x86_64.rpm
warning: MySQL-shared-5.6.42-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:MySQL-shared-5.6.42-1.el7        ################################# [100%]
[root@54lxb home]# rpm -ivh MySQL-embedded-5.6.42-1.el7.x86_64.rpm
warning: MySQL-embedded-5.6.42-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:MySQL-embedded-5.6.42-1.el7      ################################# [100%]
[root@54lxb home]# whereis mysql
mysql: /usr/bin/mysql /usr/lib64/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
[root@54lxb home]# chown mysql:mysql /var/lib/mysql -R
[root@54lxb home]# chkconfig --add mysql
[root@54lxb home]# chkconfig mysql on
[root@54lxb home]# find / -name my-default.cnf
/usr/share/doc/MySQL-server-5.6.42/my-default.cnf
/usr/share/mysql/my-default.cnf
[root@54lxb home]# cd /usr/share/mysql/
[root@54lxb mysql]# cp my-default.cnf /etc/my.cnf
[root@54lxb mysql]# mysql_install_db --user=mysql
Installing MySQL system tables...2018-11-19 16:18:28 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-11-19 16:18:28 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-11-19 16:18:28 0 [Note] /usr/sbin/mysqld (mysqld 5.6.42) starting as process 14163 ...
2018-11-19 16:18:28 14163 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-11-19 16:18:28 14163 [Note] InnoDB: The InnoDB memory heap is disabled
2018-11-19 16:18:28 14163 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-11-19 16:18:28 14163 [Note] InnoDB: Memory barrier is not used
2018-11-19 16:18:28 14163 [Note] InnoDB: Compressed tables use zlib 1.2.11
2018-11-19 16:18:28 14163 [Note] InnoDB: Using Linux native AIO
2018-11-19 16:18:28 14163 [Note] InnoDB: Using CPU crc32 instructions
2018-11-19 16:18:28 14163 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-11-19 16:18:28 14163 [Note] InnoDB: Completed initialization of buffer pool
2018-11-19 16:18:28 14163 [Note] InnoDB: Highest supported file format is Barracuda.
2018-11-19 16:18:28 14163 [Note] InnoDB: 128 rollback segment(s) are active.
2018-11-19 16:18:28 14163 [Note] InnoDB: Waiting for purge to start
2018-11-19 16:18:28 14163 [Note] InnoDB: 5.6.42 started; log sequence number 1625987
2018-11-19 16:18:29 14163 [Note] Binlog end
2018-11-19 16:18:29 14163 [Note] InnoDB: FTS optimize thread exiting.
2018-11-19 16:18:29 14163 [Note] InnoDB: Starting shutdown...
2018-11-19 16:18:30 14163 [Note] InnoDB: Shutdown completed; log sequence number 1625997
OK

Filling help tables...2018-11-19 16:18:30 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-11-19 16:18:30 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-11-19 16:18:30 0 [Note] /usr/sbin/mysqld (mysqld 5.6.42) starting as process 14187 ...
2018-11-19 16:18:30 14187 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-11-19 16:18:30 14187 [Note] InnoDB: The InnoDB memory heap is disabled
2018-11-19 16:18:30 14187 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-11-19 16:18:30 14187 [Note] InnoDB: Memory barrier is not used
2018-11-19 16:18:30 14187 [Note] InnoDB: Compressed tables use zlib 1.2.11
2018-11-19 16:18:30 14187 [Note] InnoDB: Using Linux native AIO
2018-11-19 16:18:30 14187 [Note] InnoDB: Using CPU crc32 instructions
2018-11-19 16:18:30 14187 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-11-19 16:18:30 14187 [Note] InnoDB: Completed initialization of buffer pool
2018-11-19 16:18:30 14187 [Note] InnoDB: Highest supported file format is Barracuda.
2018-11-19 16:18:30 14187 [Note] InnoDB: 128 rollback segment(s) are active.
2018-11-19 16:18:30 14187 [Note] InnoDB: Waiting for purge to start
2018-11-19 16:18:30 14187 [Note] InnoDB: 5.6.42 started; log sequence number 1625997
2018-11-19 16:18:30 14187 [Note] Binlog end
2018-11-19 16:18:30 14187 [Note] InnoDB: FTS optimize thread exiting.
2018-11-19 16:18:30 14187 [Note] InnoDB: Starting shutdown...
2018-11-19 16:18:32 14187 [Note] InnoDB: Shutdown completed; log sequence number 1626007
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 MySQL root USER !
To do so, start the server, then issue the following commands:

  /usr/bin/mysqladmin -u root password 'new-password'
  /usr/bin/mysqladmin -u root -h 54lxb password 'new-password'

Alternatively you can run:

  /usr/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 manual for more instructions.

You can start the MySQL daemon with:

  cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

  cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

WARNING: Found existing config file /usr/my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used --defaults-file)
and when you later start the server.
The new default config file was created as /usr/my-new.cnf,
please compare it with your file and take the changes you need.

WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server

[root@54lxb mysql]# service mysql start
Starting MySQL.Logging to '/var/lib/mysql/54lxb.err'.
 SUCCESS! 
[root@54lxb mysql]# mysqladmin -u root password 'root'
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
[root@54lxb mysql]# cd /root
[root@54lxb ~]# ls -a
.  ..  .bash_history  .bash_logout  .bash_profile  .bashrc  .cache  .config  .cshrc  .mysql_secret  .oracle_jre_usage  .pip  .pydistutils.cfg  .ssh  .tcshrc
[root@54lxb ~]# vim .mysql_secret
[root@54lxb ~]# /usr/bin/mysqladmin -u root password '6q6Oy4dl370JyF09'
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
[root@54lxb ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.6.42

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> SET PASSWORD = PASSWORD('123456');
Query OK, 0 rows affected (0.02 sec)

mysql> exit
Bye
[root@54lxb ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.6.42 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> exit
Bye
[root@54lxb ~]#

至此,快速配置 CentOS 7.0 服务器教程到此结束。

你可能感兴趣的:(CentOS服务器环境搭建)