[前提] 本机已安装Android SDK和nodejs 未安装Android SDK和nodejs,分别参考下文:
1.《[ubuntu server 16.04下的安装脚本] 7.一键安装 android sdk》
2.《[ubuntu server 16.04下的安装脚本] 9.一键安装 nodejs》

1.Ubuntu16.04一键安装STF脚本:

  1. #!/bin/bash
  2. #sudo npm install -g node-gyp
  3. #安装RethinkBD
  4. #source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list wget -qO- http://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
  5. source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | tee /etc/apt/sources.list.d/rethinkdb.list | wget -qO- http://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
  6. sudo apt-get update
  7. sudo apt-get install -y rethinkdb
  8. sudo cp /etc/rethinkdb/default.conf.sample /etc/rethinkdb/instances.d/instance1.conf
  9. sudo service rethinkdb stop
  10. #安装graphicsmagick
  11. sudo apt-get install -y graphicsmagick
  12. sudo apt-get install -y libzmq3-dev
  13. sudo apt-get install -y libprotobuf-dev
  14. #------------------------------------------------------------------------
  15. #安装protobuf-all
  16. #wget https://github.com/google/protobuf/releases/download/v3.5.1/protobuf-all-3.5.1.tar.gz
  17. wget https://coding.net/u/jamesz2011/p/STF-install/git/raw/master/protobuf-all-3.5.1.tar.gz
  18. tar -zxvf protobuf-all-3.5.1.tar.gz
  19. cd protobuf-3.5.1/
  20. ./configure --prefix=/usr/local/protobuf-3.5.1
  21. make
  22. sudo make install
  23. sudo ln -s /usr/local/protobuf-3.5.1/bin/protoc /usr/local/bin/protoc
  24. protoc --version
  25. #set environment
  26. #export PATH=$PATH:/usr/local/protobuf-3.5.1/bin/
  27. #export PKG_CONFIG_PATH=/usr/local/protobuf-3.5.1/lib/pkgconfig/
  28. export PKG_CONFIG_PATH="/usr/local/protobuf-3.5.1/lib/pkgconfig/"
  29. if ! grep PKG_CONFIG_PATH="/usr/local/protobuf-3.5.1/lib/pkgconfig/" /etc/profile
  30. then
  31. echo PKG_CONFIG_PATH="/usr/local/protobuf-3.5.1/lib/pkgconfig/" | sudo tee -a /etc/profile
  32. echo "export PKG_CONFIG_PATH" | sudo tee -a /etc/profile
  33. echo "PATH=$PATH:/usr/local/protobuf-3.5.1/bin/" | sudo tee -a /etc/profile
  34. echo "export PATH" | sudo tee -a /etc/profile
  35. fi
  36. source /etc/profile
  37. #安装yasm
  38. sudo apt-get install -y yasm
  39. #安装pkg-config
  40. sudo apt-get install -y pkg-config
  41. #安装g++
  42. sudo apt-get install -y g++
  43. #安装node-gyp
  44. sudo npm install -g node-gyp --unsafe-perm
  45. #安装zmq
  46. sudo npm install -g zmq --unsafe-perm
  47. #安装jpeg-turbo
  48. sudo npm install -g jpeg-turbo --unsafe-perm
  49. #安装stf
  50. sudo npm install -g stf --unsafe-perm
  51. sudo ln -s /opt/node-v8.9.3-linux-x64/bin/stf /usr/local/bin/stf

[PS] install_stf_stable.sh脚本地址


2..启动STF的方法:

2.1 使用命令启动:

  1. service rethinkdb stop
  2. rethinkdb --bind all --cache-size 8192 --http-port 8075
  3. stf local --public-ip 192.168.1.13 --allow-remote

2.2 一键启动STF脚本【linux后台启动】:

  1. #! /bin/bash
  2. #[Note]使用本shell脚本的前提:关闭rethinkdb的开机自启动
  3. #关闭rethinkdb的开机自启动 >> # sudo sysv-rc-conf
  4. #this shell is used for start STF
  5. echo "--------# this shell is used for start STF #-------------"
  6. echo "--------# step1: service rethinkdb stop#-------------"
  7. service rethinkdb stop
  8. echo "--------# step2: rethinkdb允许所有ip访问,并设置port为8075 #-------------"
  9. #rethinkdb --bind all --cache-size 8192 --http-port 8075
  10. rethinkdb --bind all --http-port 8075 &
  11. echo "--------# step3: 允许远程访问STF #-------------"
  12. stf local --public-ip 192.168.1.13 --allow-remote &
  13. echo "--------# 启动成功 #-------------"

【PS】startup_STF.sh脚本地址


3.连接上真机的效果图:

image.png