ECS node 环境搭建

操作系统

  1.CentOS 7.4 64位

连接 ECS

  1.连接 ECS

  

  2. 输入密码

Welcome to Alibaba Cloud Elastic Compute Service !

 

安装 node 

    1.下载   

wget https://nodejs.org/dist/v6.9.5/node-v6.9.5-linux-x64.tar.xz

 

    显示:

 

--2018-07-17 10:15:11--  https://nodejs.org/dist/v6.9.5/node-v6.9.5-linux-x64.tar.xz
正在解析主机 nodejs.org (nodejs.org)... 104.20.22.46, 104.20.23.46, 2400:cb00:2048:1::6814:162e, ...
正在连接 nodejs.org (nodejs.org)|104.20.22.46|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:9345888 (8.9M) [application/x-xz]
正在保存至: “node-v6.9.5-linux-x64.tar.xz”

100%[======================================================================================================================================================================================================================================>] 9,345,888   3.13MB/s 用时 2.9s   

2018-07-17 10:15:16 (3.13 MB/s) - 已保存 “node-v6.9.5-linux-x64.tar.xz” [9345888/9345888])

    2. 解压   tar xvf node-v6.9.5-linux-x64.tar.xz

。。。。。。。
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/lodash.clonedeep/package.json
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/lodash.clonedeep/LICENSE
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/lodash.clonedeep/index.js
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/lodash.clonedeep/README.md
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/read/
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/read/package.json
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/read/LICENSE
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/read/README.md
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/read/lib/
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/read/lib/read.js
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/read/node_modules/
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/read/node_modules/mute-stream/
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/read/node_modules/mute-stream/package.json
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/read/node_modules/mute-stream/mute.js
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/read/node_modules/mute-stream/LICENSE
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/read/node_modules/mute-stream/README.md
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/inherits/
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/inherits/inherits_browser.js
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/inherits/package.json
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/inherits/LICENSE
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/inherits/README.md
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/inherits/inherits.js
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/umask/
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/umask/package.json
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/umask/LICENSE
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/umask/ChangeLog
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/umask/index.js
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/umask/README.md
node-v6.9.5-linux-x64/lib/node_modules/npm/node_modules/umask/.npmignore

    3.软链接

 ln -s /root/node-v6.9.5-linux-x64/bin/node /usr/local/bin/node

    4.软链接 

ln -s /root/node-v6.9.5-linux-x64/bin/npm /usr/local/bin/npm

    4. 查看版本号

node -v 
npm -v

  

安装 git 

yum install git
显示
[root@izuf6dt5e7ronm1meixuipz ~]# yum install git
已加载插件:fastestmirror
base                                                                                                                                                                                                                                                     | 3.6 kB  00:00:00     
epel                                                                                                                                                                                                                                                     | 3.2 kB  00:00:00     
extras                                                                                                                                                                                                                                                   | 3.4 kB  00:00:00     
updates                                                                                                                                                                                                                                                  | 3.4 kB  00:00:00     
(1/7): base/7/x86_64/group_gz                                                                                                                                                                                                                            | 166 kB  00:00:00     
(2/7): epel/x86_64/group_gz                                                                                                                                                                                                                              |  88 kB  00:00:00     
(3/7): epel/x86_64/updateinfo                                                                                                                                                                                                                            | 929 kB  00:00:00     
(4/7): extras/7/x86_64/primary_db                                                                                                                                                                                                                        | 150 kB  00:00:00     
(5/7): base/7/x86_64/primary_db                                                                                                                                                                                                                          | 5.9 MB  00:00:00     
(6/7): epel/x86_64/primary                                                                                                                                                                                                                               | 3.5 MB  00:00:00     
(7/7): updates/7/x86_64/primary_db                                                                                                                                                                                                                       | 3.6 MB  00:00:00     
Determining fastest mirrors
epel                                                                                                                                                                                                                                                                12609/12609
正在解决依赖关系
--> 正在检查事务
---> 软件包 git.x86_64.0.1.8.3.1-14.el7_5 将被 安装
--> 正在处理依赖关系 perl-Git = 1.8.3.1-14.el7_5,它被软件包 git-1.8.3.1-14.el7_5.x86_64 需要
--> 正在处理依赖关系 rsync,它被软件包 git-1.8.3.1-14.el7_5.x86_64 需要
--> 正在处理依赖关系 perl(Term::ReadKey),它被软件包 git-1.8.3.1-14.el7_5.x86_64 需要
--> 正在处理依赖关系 perl(Git),它被软件包 git-1.8.3.1-14.el7_5.x86_64 需要
--> 正在处理依赖关系 perl(Error),它被软件包 git-1.8.3.1-14.el7_5.x86_64 需要
--> 正在处理依赖关系 libgnome-keyring.so.0()(64bit),它被软件包 git-1.8.3.1-14.el7_5.x86_64 需要
--> 正在检查事务
---> 软件包 libgnome-keyring.x86_64.0.3.12.0-1.el7 将被 安装
---> 软件包 perl-Error.noarch.1.0.17020-2.el7 将被 安装
---> 软件包 perl-Git.noarch.0.1.8.3.1-14.el7_5 将被 安装
---> 软件包 perl-TermReadKey.x86_64.0.2.30-20.el7 将被 安装
---> 软件包 rsync.x86_64.0.3.1.2-4.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

================================================================================================================================================================================================================================================================================
 Package                                                                架构                                                         版本                                                                   源                                                             大小
================================================================================================================================================================================================================================================================================
正在安装:
 git                                                                    x86_64                                                       1.8.3.1-14.el7_5                                                       updates                                                       4.4 M
为依赖而安装:
 libgnome-keyring                                                       x86_64                                                       3.12.0-1.el7                                                           base                                                          109 k
 perl-Error                                                             noarch                                                       1:0.17020-2.el7                                                        base                                                           32 k
 perl-Git                                                               noarch                                                       1.8.3.1-14.el7_5                                                       updates                                                        54 k
 perl-TermReadKey                                                       x86_64                                                       2.30-20.el7                                                            base                                                           31 k
 rsync                                                                  x86_64                                                       3.1.2-4.el7                                                            base                                                          403 k

事务概要
================================================================================================================================================================================================================================================================================
安装  1 软件包 (+5 依赖软件包)

总下载量:5.0 M
安装大小:23 M
Is this ok [y/d/N]: y
Downloading packages:
(1/6): perl-Error-0.17020-2.el7.noarch.rpm                                                                                                                                                                                                               |  32 kB  00:00:00     
(2/6): libgnome-keyring-3.12.0-1.el7.x86_64.rpm                                                                                                                                                                                                          | 109 kB  00:00:00     
(3/6): perl-TermReadKey-2.30-20.el7.x86_64.rpm                                                                                                                                                                                                           |  31 kB  00:00:00     
(4/6): perl-Git-1.8.3.1-14.el7_5.noarch.rpm                                                                                                                                                                                                              |  54 kB  00:00:00     
(5/6): rsync-3.1.2-4.el7.x86_64.rpm                                                                                                                                                                                                                      | 403 kB  00:00:00     
(6/6): git-1.8.3.1-14.el7_5.x86_64.rpm                                                                                                                                                                                                                   | 4.4 MB  00:00:00     
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                                                                                                                             22 MB/s | 5.0 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : 1:perl-Error-0.17020-2.el7.noarch                                                                                                                                                                                                                           1/6 
  正在安装    : rsync-3.1.2-4.el7.x86_64                                                                                                                                                                                                                                    2/6 
  正在安装    : perl-TermReadKey-2.30-20.el7.x86_64                                                                                                                                                                                                                         3/6 
  正在安装    : libgnome-keyring-3.12.0-1.el7.x86_64                                                                                                                                                                                                                        4/6 
  正在安装    : perl-Git-1.8.3.1-14.el7_5.noarch                                                                                                                                                                                                                            5/6 
  正在安装    : git-1.8.3.1-14.el7_5.x86_64                                                                                                                                                                                                                                 6/6 
  验证中      : git-1.8.3.1-14.el7_5.x86_64                                                                                                                                                                                                                                 1/6 
  验证中      : libgnome-keyring-3.12.0-1.el7.x86_64                                                                                                                                                                                                                        2/6 
  验证中      : perl-TermReadKey-2.30-20.el7.x86_64                                                                                                                                                                                                                         3/6 
  验证中      : 1:perl-Error-0.17020-2.el7.noarch                                                                                                                                                                                                                           4/6 
  验证中      : rsync-3.1.2-4.el7.x86_64                                                                                                                                                                                                                                    5/6 
  验证中      : perl-Git-1.8.3.1-14.el7_5.noarch                                                                                                                                                                                                                            6/6 

已安装:
  git.x86_64 0:1.8.3.1-14.el7_5                                                                                                                                                                                                                                                 

作为依赖被安装:
  libgnome-keyring.x86_64 0:3.12.0-1.el7                    perl-Error.noarch 1:0.17020-2.el7                    perl-Git.noarch 0:1.8.3.1-14.el7_5                    perl-TermReadKey.x86_64 0:2.30-20.el7                    rsync.x86_64 0:3.1.2-4.el7                   

完毕!

 

安装 nvm

  1. 直接使用git将源码克隆到本地的~/.nvm目录下,并检查最新版本。
    1. git clone https://github.com/cnpm/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`
  2. 激活NVM。

    1. echo ". ~/.nvm/nvm.sh" >> /etc/profile
  3. 直接使用git将源码克隆到本地的~/.nvm目录下,并检查最新版本。

  4. 激活NVM。

    1. echo ". ~/.nvm/nvm.sh" >> /etc/profile
    2. source /etc/profile
  5. 列出Node.js的所有版本。

    1. nvm list-remote
  6. 安装多个Node.js版本。

    1. nvm install v6.9.5
    2. nvm install v7.4.0
  7. 运行 nvm ls 查看已安装Node.js版本,当前使用的版本为v6.9.5。返回结果如下所示。

    1. [root@iZXXXXZ .nvm]# nvm ls
    2. v6.9.5
    3. -> v7.4.0
    4. system
    5. stable -> 7.4 (-> v7.4.0) (default)
    6. unstable -> 6.9 (-> v6.9.5) (default)
  8. 运行 nvm use v7.4.0 切换Node.js版本至v7.4.0。返回结果如下所示。

    1. [root@iZXXXXZ .nvm]# nvm use v7.4.0
    2. Now using node v7.4.0

 

安装 mysql 

    

    1.下载mysql源安装包

wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

    显示:

[root@izuf6dt5e7ronm1meixuipz ~]# wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
--2018-07-17 10:26:30--  http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
正在解析主机 dev.mysql.com (dev.mysql.com)... 137.254.60.11
正在连接 dev.mysql.com (dev.mysql.com)|137.254.60.11|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 301 Moved Permanently
位置:https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm [跟随至新的 URL]
--2018-07-17 10:26:31--  https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
正在连接 dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:https://repo.mysql.com//mysql57-community-release-el7-8.noarch.rpm [跟随至新的 URL]
--2018-07-17 10:26:32--  https://repo.mysql.com//mysql57-community-release-el7-8.noarch.rpm
正在解析主机 repo.mysql.com (repo.mysql.com)... 104.127.195.16
正在连接 repo.mysql.com (repo.mysql.com)|104.127.195.16|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:9116 (8.9K) [application/x-redhat-package-manager]
正在保存至: “mysql57-community-release-el7-8.noarch.rpm”

100%[======================================================================================================================================================================================================================================>] 9,116       --.-K/s 用时 0s      

2018-07-17 10:26:33 (210 MB/s) - 已保存 “mysql57-community-release-el7-8.noarch.rpm” [9116/9116])

      2.安装mysql源

yum localinstall mysql57-community-release-el7-8.noarch.rpm
[root@izuf6dt5e7ronm1meixuipz ~]# yum localinstall mysql57-community-release-el7-8.noarch.rpm
已加载插件:fastestmirror
正在检查 mysql57-community-release-el7-8.noarch.rpm: mysql57-community-release-el7-8.noarch
mysql57-community-release-el7-8.noarch.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql57-community-release.noarch.0.el7-8 将被 安装
--> 解决依赖关系完成

依赖关系解决

================================================================================================================================================================================================================================================================================
 Package                                                                 架构                                                 版本                                                  源                                                                                     大小
================================================================================================================================================================================================================================================================================
正在安装:
 mysql57-community-release                                               noarch                                               el7-8                                                 /mysql57-community-release-el7-8.noarch                                               8.2 k

事务概要
================================================================================================================================================================================================================================================================================
安装  1 软件包

总计:8.2 k
安装大小:8.2 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : mysql57-community-release-el7-8.noarch                                                                                                                                                                                                                      1/1 
  验证中      : mysql57-community-release-el7-8.noarch                                                                                                                                                                                                                      1/1 

已安装:
  mysql57-community-release.noarch 0:el7-8                                                                                                                                                                                                                                      

完毕!

    3.检查mysql源是否安装成功

yum repolist enabled | grep "mysql.*-community.*"

 

[root@izuf6dt5e7ronm1meixuipz ~]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community                  51
mysql-tools-community/x86_64      MySQL Tools Community                       63
mysql57-community/x86_64          MySQL 5.7 Community Server                 267

    4.安装Mysql

yum install mysql-community-server
[root@izuf6dt5e7ronm1meixuipz ~]# yum install mysql-community-server
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql-community-server.x86_64.0.5.7.22-1.el7 将被 安装
--> 正在处理依赖关系 mysql-community-common(x86-64) = 5.7.22-1.el7,它被软件包 mysql-community-server-5.7.22-1.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-client(x86-64) >= 5.7.9,它被软件包 mysql-community-server-5.7.22-1.el7.x86_64 需要
--> 正在处理依赖关系 libaio.so.1(LIBAIO_0.4)(64bit),它被软件包 mysql-community-server-5.7.22-1.el7.x86_64 需要
--> 正在处理依赖关系 libaio.so.1(LIBAIO_0.1)(64bit),它被软件包 mysql-community-server-5.7.22-1.el7.x86_64 需要
--> 正在处理依赖关系 libaio.so.1()(64bit),它被软件包 mysql-community-server-5.7.22-1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 libaio.x86_64.0.0.3.109-13.el7 将被 安装
---> 软件包 mysql-community-client.x86_64.0.5.7.22-1.el7 将被 安装
--> 正在处理依赖关系 mysql-community-libs(x86-64) >= 5.7.9,它被软件包 mysql-community-client-5.7.22-1.el7.x86_64 需要
---> 软件包 mysql-community-common.x86_64.0.5.7.22-1.el7 将被 安装
--> 正在检查事务
---> 软件包 mariadb-libs.x86_64.1.5.5.56-2.el7 将被 取代
--> 正在处理依赖关系 libmysqlclient.so.18()(64bit),它被软件包 2:postfix-2.10.1-6.el7.x86_64 需要
--> 正在处理依赖关系 libmysqlclient.so.18(libmysqlclient_18)(64bit),它被软件包 2:postfix-2.10.1-6.el7.x86_64 需要
---> 软件包 mysql-community-libs.x86_64.0.5.7.22-1.el7 将被 舍弃
--> 正在检查事务
---> 软件包 mysql-community-libs-compat.x86_64.0.5.7.22-1.el7 将被 舍弃
--> 解决依赖关系完成

依赖关系解决

================================================================================================================================================================================================================================================================================
 Package                                                                      架构                                                    版本                                                             源                                                                  大小
================================================================================================================================================================================================================================================================================
正在安装:
 mysql-community-libs                                                         x86_64                                                  5.7.22-1.el7                                                     mysql57-community                                                  2.1 M
      替换  mariadb-libs.x86_64 1:5.5.56-2.el7
 mysql-community-libs-compat                                                  x86_64                                                  5.7.22-1.el7                                                     mysql57-community                                                  2.0 M
      替换  mariadb-libs.x86_64 1:5.5.56-2.el7
 mysql-community-server                                                       x86_64                                                  5.7.22-1.el7                                                     mysql57-community                                                  165 M
为依赖而安装:
 libaio                                                                       x86_64                                                  0.3.109-13.el7                                                   base                                                                24 k
 mysql-community-client                                                       x86_64                                                  5.7.22-1.el7                                                     mysql57-community                                                   24 M
 mysql-community-common                                                       x86_64                                                  5.7.22-1.el7                                                     mysql57-community                                                  274 k

事务概要
================================================================================================================================================================================================================================================================================
安装  3 软件包 (+3 依赖软件包)

总下载量:193 M
Is this ok [y/d/N]: y
Downloading packages:
(1/6): libaio-0.3.109-13.el7.x86_64.rpm                                                                                                                                                                                                                  |  24 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.22-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY                                                                              ]  0.0 B/s |  24 kB  --:--:-- ETA 
mysql-community-common-5.7.22-1.el7.x86_64.rpm 的公钥尚未安装
(2/6): mysql-community-common-5.7.22-1.el7.x86_64.rpm                                                                                                                                                                                                    | 274 kB  00:00:00     
(3/6): mysql-community-libs-5.7.22-1.el7.x86_64.rpm                                                                                                                                                                                                      | 2.1 MB  00:00:00     
(4/6): mysql-community-libs-compat-5.7.22-1.el7.x86_64.rpm                                                                                                                                                                                               | 2.0 MB  00:00:00     
(5/6): mysql-community-client-5.7.22-1.el7.x86_64.rpm                                                                                                                                                                                                    |  24 MB  00:00:02     
(6/6): mysql-community-server-5.7.22-1.el7.x86_64.rpm                                                                                                                                                                                                    | 165 MB  00:00:12     
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                                                                                                                             14 MB/s | 193 MB  00:00:14     
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 检索密钥
导入 GPG key 0x5072E1F5:
 用户ID     : "MySQL Release Engineering "
 指纹       : a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
 软件包     : mysql57-community-release-el7-8.noarch (installed)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : mysql-community-common-5.7.22-1.el7.x86_64                                                                                                                                                                                                                  1/7 
  正在安装    : mysql-community-libs-5.7.22-1.el7.x86_64                                                                                                                                                                                                                    2/7 
  正在安装    : mysql-community-client-5.7.22-1.el7.x86_64                                                                                                                                                                                                                  3/7 
  正在安装    : libaio-0.3.109-13.el7.x86_64                                                                                                                                                                                                                                4/7 
  正在安装    : mysql-community-server-5.7.22-1.el7.x86_64                                                                                                                                                                                                                  5/7 
  正在安装    : mysql-community-libs-compat-5.7.22-1.el7.x86_64                                                                                                                                                                                                             6/7 
  正在删除    : 1:mariadb-libs-5.5.56-2.el7.x86_64                                                                                                                                                                                                                          7/7 
  验证中      : mysql-community-libs-compat-5.7.22-1.el7.x86_64                                                                                                                                                                                                             1/7 
  验证中      : mysql-community-common-5.7.22-1.el7.x86_64                                                                                                                                                                                                                  2/7 
  验证中      : mysql-community-server-5.7.22-1.el7.x86_64                                                                                                                                                                                                                  3/7 
  验证中      : mysql-community-client-5.7.22-1.el7.x86_64                                                                                                                                                                                                                  4/7 
  验证中      : mysql-community-libs-5.7.22-1.el7.x86_64                                                                                                                                                                                                                    5/7 
  验证中      : libaio-0.3.109-13.el7.x86_64                                                                                                                                                                                                                                6/7 
  验证中      : 1:mariadb-libs-5.5.56-2.el7.x86_64                                                                                                                                                                                                                          7/7 

已安装:
  mysql-community-libs.x86_64 0:5.7.22-1.el7                                             mysql-community-libs-compat.x86_64 0:5.7.22-1.el7                                             mysql-community-server.x86_64 0:5.7.22-1.el7                                            

作为依赖被安装:
  libaio.x86_64 0:0.3.109-13.el7                                                   mysql-community-client.x86_64 0:5.7.22-1.el7                                                   mysql-community-common.x86_64 0:5.7.22-1.el7                                                  

替代:
  mariadb-libs.x86_64 1:5.5.56-2.el7                                                                                                                                                                                                                                            

完毕!

    5.启动MySQL服务

systemctl start mysqld
    6.查看MySQL启动状态
systemctl status mysqld
[root@izuf6dt5e7ronm1meixuipz ~]# systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since 二 2018-07-17 10:33:26 CST; 30s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 1448 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 1374 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 1451 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─1451 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

7月 17 10:33:22 izuf6dt5e7ronm1meixuipz systemd[1]: Starting MySQL Server...
7月 17 10:33:26 izuf6dt5e7ronm1meixuipz systemd[1]: Started MySQL Server.
[root@izuf6dt5e7ronm1meixuipz ~]# 

    7.设置MySQL开机启动

systemctl enable mysqld
systemctl daemon-reload
    8.修改root密码
      8.1 查看默认密码
 grep 'temporary password' /var/log/mysqld.log
[root@izuf6dt5e7ronm1meixuipz ~]#  grep 'temporary password' /var/log/mysqld.log
2018-07-17T02:33:24.001978Z 1 [Note] A temporary password is generated for root@localhost: kbY0Xw3gf>)e

      8.2 修改密码(密码输入上一步的默认密码)

[root@izuf6dt5e7ronm1meixuipz ~]# mysql -uroot -p

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.7.22

 

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> 

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '密码'; Query OK, 0 rows affected (0.00 sec)
 
         
mysql> set password for 'root'@'localhost'=password('密码'); 
    8.3密码不符合规范报错:

        mysql5.7默认安装了密码安全检查插件(validate_password),默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位。否则会提示ERROR 1819 (HY000)

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

    8.4查看密码策略:

mysql> show variables like '%password%';
+---------------------------------------+--------+
| Variable_name                         | Value  |
+---------------------------------------+--------+
| default_password_lifetime             | 0      |
| disconnect_on_expired_password        | ON     |
| log_builtin_as_identified_by_password | OFF    |
| mysql_native_password_proxy_users     | OFF    |
| old_passwords                         | 0      |
| report_password                       |        |
| sha256_password_proxy_users           | OFF    |
| validate_password_check_user_name     | OFF    |
| validate_password_dictionary_file     |        |
| validate_password_length              | 8      |
| validate_password_mixed_case_count    | 1      |
| validate_password_number_count        | 1      |
| validate_password_policy              | MEDIUM |
| validate_password_special_char_count  | 1      |
+---------------------------------------+--------+
14 rows in set (0.01 sec)

    8.5如果不需要密码策略,添加my.cnf文件中添加如下配置禁用即可:

validate_password = off

    8.6重新启动mysql服务使配置生效:

systemctl restart mysqld

 

 

MySQL使用

1、进入MySQL命令:
  mysql -u 用户名 -p
  例:
    输入的命令行:  mysql -u root -p    (输入同样后会让你输入ySQL的密码)
2、在MySQL-Front中新建你要建的数据库,这时只是空数据库:
  mysql>create database 数据库名字
  例:
    输入的命令行: mysql>create database blog;  (新建一个名为blog的目标数据库)
3、使用创建的数据库:
  mysql>use 数据库名字
  例:
    输入的命令行:  mysql>use blog;  (目标数据库名)
4、导入文件:
  mysql>source 导入的文件名;
  例:
    输入的命令行:mysql>source blog.sql;    (导入blog.sql文件)
 5.exit   退出

 

 测试 ECS

新建文件hello.js。

cd ~ 
touch hello.js

    2.使用vim编辑器打开

yum install vim

vim hello.js

      输入 i,进入编辑模式

      使用Esc按钮,退出编辑模式,输入:wq,回车,保存文件内容并退出。

const http = require('http');

const hostname = '0.0.0.0';

const port = 80;

const server = http.createServer((req, res) => {

res.statusCode = 200;

res.setHeader('Content-Type', 'text/plain');

res.end('Hello World\n');

});

server.listen(port, hostname, () => {

console.log(`Server running at http://${hostname}:${port}/`);

});

    3.运行

node ~/hello.js

 



转载于:https://www.cnblogs.com/AmorR/p/9318787.html

你可能感兴趣的:(ECS node 环境搭建)