Mac下部署与启动STF

一、stf在Mac下的部署
1、安装Java及jdk

  1)访问官网进行下载
  2)下载完成后点击安装包,跟随提示完成安装。
  3)检查jdk是否安装成功:java -version
  4)打开已存在的.bash_profile文件:open -e .bash_profile
  输入以下内容进行配置环境变量(我是默认安装,详见自己的安装路径)
1 #jdk
2 JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home
3 PATH=$JAVA_HOME/bin:$PATH:.
4 CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
5 export JAVA_HOME
6 export PATH
7 export CLASSPATH
  5)保存退出,使用"source .bash_profile"使配置生效
  6)echo $JAVA_HOME 显示刚才配置的路径信息,再次重启笔记本就不会失效了

2、安装nodejs包(我是直接在官网下载的LTS版本)
• Node.js v8.12.0 to /usr/local/bin/node
• npm v6.4.1 to /usr/local/bin/npm

3、安装bower
npm install bower -g
验证安装是否成功:bower -v 如果显示版本号证明安装成功

4、安装RethinkDB包
brew install rethinkdb
验证安装是否成功:rethinkdb -v 如果显示版本号证明安装成功

5、安装GraphicsMagick
brew install graphicsmagick
如果出现如下提示证明已经安装过:
Warning: graphicsmagick 1.3.30 is already installed and up-to-date
To reinstall 1.3.30, run `brew reinstall graphicsmagick`

6. 安装libsodium(zeromq的依赖)
brew install libsodium

==> Downloading https://homebrew.bintray.com/bottles/libsodium-1.0.16.mojave.bot
######################################################################## 100.0%
==> Pouring libsodium-1.0.16.mojave.bottle.tar.gz
🍺 /usr/local/Cellar/libsodium/1.0.16: 71 files, 940.7KB

7. 安装zeromq
brew install zeromq

==> Downloading https://homebrew.bintray.com/bottles/zeromq-4.2.5.mojave.bottle.
######################################################################## 100.0%
==> Pouring zeromq-4.2.5.mojave.bottle.tar.gz
🍺 /usr/local/Cellar/zeromq/4.2.5: 77 files, 2.7MB

8. 安装protobuf(初次安装的时候会有依赖:gdbm, openssl, readline, sqlite会一并安装)
brew install protobuf

==> Installing dependencies for protobuf: gdbm, openssl, readline and sqlite
==> Installing protobuf dependency: gdbm
==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.18.mojave.bottle.tar
######################################################################## 100.0%
==> Pouring gdbm-1.18.mojave.bottle.tar.gz
🍺 /usr/local/Cellar/gdbm/1.18: 20 files, 588.7KB
==> Installing protobuf dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2p.mojave.bottl
######################################################################## 100.0%
==> Pouring openssl-1.0.2p.mojave.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certs

and run
/usr/local/opt/openssl/bin/c_rehash

openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have openssl first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

For pkg-config to find openssl you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

==> Summary
🍺 /usr/local/Cellar/openssl/1.0.2p: 1,793 files, 12MB
==> Installing protobuf dependency: readline
==> Downloading https://homebrew.bintray.com/bottles/readline-7.0.5.mojave.bottl
######################################################################## 100.0%
==> Pouring readline-7.0.5.mojave.bottle.tar.gz
==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

For compilers to find readline you may need to set:
export LDFLAGS="-L/usr/local/opt/readline/lib"
export CPPFLAGS="-I/usr/local/opt/readline/include"

==> Summary
🍺 /usr/local/Cellar/readline/7.0.5: 46 files, 1.5MB
==> Installing protobuf dependency: sqlite
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.25.2.mojave.bottle
######################################################################## 100.0%
==> Pouring sqlite-3.25.2.mojave.bottle.tar.gz
==> Caveats
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.

If you need to have sqlite first in your PATH run:
echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.bash_profile

For compilers to find sqlite you may need to set:
export LDFLAGS="-L/usr/local/opt/sqlite/lib"
export CPPFLAGS="-I/usr/local/opt/sqlite/include"

For pkg-config to find sqlite you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"

==> Summary
🍺 /usr/local/Cellar/sqlite/3.25.2: 11 files, 3.7MB
==> Installing protobuf
==> Downloading https://homebrew.bintray.com/bottles/protobuf-3.6.1.mojave.bottl
######################################################################## 100.0%
==> Pouring protobuf-3.6.1.mojave.bottle.tar.gz
==> Caveats
Editor support and examples have been installed to:
/usr/local/opt/protobuf/share/doc/protobuf
==> Summary
🍺 /usr/local/Cellar/protobuf/3.6.1: 256 files, 17.2MB
==> Caveats
==> openssl
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certs

and run
/usr/local/opt/openssl/bin/c_rehash

openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have openssl first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

For pkg-config to find openssl you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

==> readline
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

For compilers to find readline you may need to set:
export LDFLAGS="-L/usr/local/opt/readline/lib"
export CPPFLAGS="-I/usr/local/opt/readline/include"

==> sqlite
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.

If you need to have sqlite first in your PATH run:
echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.bash_profile

For compilers to find sqlite you may need to set:
export LDFLAGS="-L/usr/local/opt/sqlite/lib"
export CPPFLAGS="-I/usr/local/opt/sqlite/include"

For pkg-config to find sqlite you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"

==> protobuf
Editor support and examples have been installed to:
/usr/local/opt/protobuf/share/doc/protobuf

修改环境变量,添加如下信息(我这里安装的版本是3.6.1):
export PATH=$PATH:/usr/local/Cellar/protobuf/3.6.1/bin/
export PKG_CONFIG_PATH=/usr/local/Cellar/protobuf/3.6.1/lib/pkgconfig/

9. 安装pkg-config
brew install pkg-config
出现如下的提示证明已经安装过:
Warning: pkg-config 0.29.2 is already installed and up-to-date
To reinstall 0.29.2, run `brew reinstall pkg-config`

10、安装yasm
brew install yasm

==> Downloading https://homebrew.bintray.com/bottles/yasm-1.3.0_1.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring yasm-1.3.0_1.mojave.bottle.tar.gz
🍺 /usr/local/Cellar/yasm/1.3.0_1: 47 files, 3.8MB

11. 安装stf
(如果出现报错先清下缓存:npm cache clean --force)
npm install -g stf

部署完成功之后,可以使用stf doctor命令查看是否都已经部署妥当。如下表示都已经部署好:

 

二、stf在Mac下的启动

1、终端一启动rethinkdb数据库

2、终端二启动stf,以下为两种启动方式选其一

本地启动:stf local
允许远程访问:stf local --public-ip 本机IP --allow-remote

 3、浏览器输入地址即可访问:127.0.0.1:7100

现在就可以在页面上直接控制连接的设备了,按照官方的说法,可以控制more than 160 devices. 当然 要有好的hub或者无线环境。

posted @ 2018-10-11 15:14  韩凯1202  阅读(2797)  评论(0编辑  收藏  举报