Created
May 14, 2020 10:52
-
-
Save axipo/81e148e47f4a02892c22e76339b68b63 to your computer and use it in GitHub Desktop.
方便用户安装mini-status的脚本,针对无nodejs相关经验的用户
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin | |
export PATH | |
# install nvm | |
# 安装nvm | |
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash | |
# load nvm | |
# 加载nvm | |
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | |
# install node js | |
# 安装node js | |
nvm install 10 --lts | |
# install mini-status and pm2 | |
# 安装mini-status 和 pm2 | |
npm install mini-status pm2 -g | |
# get user input | |
# 获取用户输入 | |
read -p "请输入实例IP和端口(eg:1.1.1.1:8080) : " ip | |
read -p "请输入实例密码 : " pass | |
# start mini-status use pm2 | |
# 使用pm2启动mini-status | |
pm2 start mini-status -- -a "${ip}" -p "${pass}" | |
# start mini-status on boot | |
# 保存为开机启动 | |
pm2 save | |
pm2 startup | |
echo -e "请在小程序中填写接口地址:${ip}/update Password:${pass}" | |
# if you need https, it's suggested to use nginx to do it. It won't be covered here. | |
# 如果想用https,那么还是建议用nginx来反向代理一下,这里就不写了。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
使用帖子中安装脚本:
最后一步会报错:
no such file or directory
。脚本修改为:
./mini_status_easy_install.sh
成功运行