1. newman的安装依赖nodejs,首先安装node/npm

进入到 /usr/local目录
[root@ipha-dev71- local]# cd /usr/local
[root@ipha-dev71- local]# pwd
/usr/local
[root@ipha-dev71- local]# wget https://nodejs.org/dist/v10.16.2/node-v10.16.2-linux-x64.tar.xz # 下载安装包
---- ::-- https://nodejs.org/dist/v10.16.2/node-v10.16.2-linux-x64.tar.xz
Resolving nodejs.org (nodejs.org)... 104.20.23.46, 104.20.22.46, :::::172e, ...
Connecting to nodejs.org (nodejs.org)|104.20.23.46|:... connected.
HTTP request sent, awaiting response... OK
Length: (12M) [application/x-xz]
Saving to: ‘node-v10.16.2-linux-x64.tar.xz’ %[==============================================================================================================================>] ,, .00MB/s in .4s -- :: (1.49 MB/s) - ‘node-v10.16.2-linux-x64.tar.xz’ saved [/] [root@ipha-dev71- local]# ll
total
drwxr-xr-x. root root Nov bin
drwxr-xr-x. root root Nov etc
drwxr-xr-x. root root Nov games
drwxr-xr-x. root root Nov include
drwxr-xr-x. root root Nov lib
drwxr-xr-x. root root Nov lib64
drwxr-xr-x. root root Nov libexec
-rw-r--r-- root root Aug : node-v10.16.2-linux-x64.tar.xz
drwxr-xr-x root root Jan python3
drwxr-xr-x. root root Nov sbin
drwxr-xr-x. root root Jan share
drwxr-xr-x. root root Nov src
[root@ipha-dev71-1 local]# tar -xvf node-v10.16.2-linux-x64.tar.xz # 解压

[root@ipha-dev71-1 local]# ll
  total 12740
  drwxr-xr-x. 2 root root 6 Nov 5 2016 bin
  drwxr-xr-x. 2 root root 6 Nov 5 2016 etc
  drwxr-xr-x. 2 root root 6 Nov 5 2016 games
  drwxr-xr-x. 2 root root 6 Nov 5 2016 include
  drwxr-xr-x. 2 root root 6 Nov 5 2016 lib
  drwxr-xr-x. 2 root root 6 Nov 5 2016 lib64
  drwxr-xr-x. 2 root root 6 Nov 5 2016 libexec
  drwxrwxr-x 6 500 500 108 Aug 7 00:02 node-v10.16.2-linux-x64
  -rw-r--r-- 1 root root 13043892 Aug 7 00:03 node-v10.16.2-linux-x64.tar.xz
  drwxr-xr-x 7 root root 100 Jan 25 2019 python3
  drwxr-xr-x. 2 root root 6 Nov 5 2016 sbin
  drwxr-xr-x. 5 root root 49 Jan 22 2018 share
  drwxr-xr-x. 2 root root 6 Nov 5 2016 src

 [root@ipha-dev71-1 local]# mv node-v10.16.2-linux-x64 node  # 重命名为node

 [root@ipha-dev71-1 local]# vi /etc/profile  # 配置环境变量

在文件末尾添加:

export NODE_HOME=/usr/local/node
  export PATH=$NODE_HOME/bin:$PATH

[root@ipha-dev71-1 local]# source /etc/profile   # 使环境变量生效

# 检测node和npm是否安装成功

[root@ipha-dev71-1 local]# node -v
  v10.16.2
  [root@ipha-dev71-1 local]# npm -v
  6.9.0

2.安装newman

[root@ipha-dev71- local]# npm install -g newman
/usr/local/node/bin/newman -> /usr/local/node/lib/node_modules/newman/bin/newman.js
+ [email protected].
added packages from contributors in .393s
[root@ipha-dev71- local]# newman -v # 检测Newman是否安装成功
4.5.

参考:https://www.cnblogs.com/HYanqing/p/11137146.html

05-27 02:32