🐛 fix sh

This commit is contained in:
chaos-zhu 2023-03-15 13:31:27 +08:00
parent 8cd547724f
commit c539271665
2 changed files with 44 additions and 37 deletions

View File

@ -60,12 +60,14 @@ docker run -d --net=host -v /easynode-server:/easynode-server/server/app/storage
#### 一键脚本
- 依赖Linux基础命令curl wget git zip tar如未安装请先安装
- **依赖Linux基础命令工具curl wget git zip tar如未安装请先安装**
> ubuntu/debian: `apt install curl wget git zip tar -y`
>
> centos: `yum install curl wget git zip tar -y`
- 运行环境:[Node.js](https://nodejs.org/en/download/) **v14+**
```shell
wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubusercontent.com/chaos-zhu/easynode/v1.2/easynode-server-install.sh | bash
```

View File

@ -5,41 +5,26 @@ if [ "$(id -u)" != "0" ] ; then
exit 1
fi
# 编写中...
echo '开始安装nvm'
rm -rf /root/.nvm
# 国内
bash -c "$(curl -fsSL https://gitee.com/chaoszhu_0/nvm-cn/raw/master/install.sh)"
# 国外
# bash -c "$(curl -fsSL https://raw.githubusercontent.com/chaos-zhu/nvm-cn/master/install.sh)"
if [ $? != "0" ] ; then
echo '安装失败'
exit 1
echo "***********************检测node环境***********************"
node -v
if [ $? != 0 ]
then
echo "未安装node运行环境"
exit 1
fi
echo "已安装"
. /root/.nvm/nvm.sh
echo "nvm version: $(nvm -v)"
echo "***********************检测pm2守护进程***********************"
pm2 list
if [ $? != 0 ]
then
echo "未安装pm2,正在安装..."
npm i -g pm2
fi
echo "已安装"
export VM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
echo '开始安装node&npm'
nvm install 16
echo "node version: $(node -v) 安装成功"
echo "npm version: $(npm -v) 安装成功"
echo '开始安装pm2'
npm config set registry https://registry.npm.taobao.org
npm i -g pm2
echo "pm2 version: $(pm2 -v) 安装成功"
echo '开始下载EasyNode'
echo "***********************开始下载EasyNode***********************"
DOWNLOAD_FILE_URL="https://ghproxy.com/https://github.com/chaos-zhu/easynode/releases/download/v1.2.1/easynode-server.zip"
SERVER_NAME=easynode-server
@ -49,21 +34,41 @@ wget -O ${FILE_PATH}/${SERVER_ZIP} --no-check-certificate --no-cache ${DOWNLOAD_
if [ $? != 0 ]
then
echo "***********************下载EasyNode.zip失败***********************"
echo "下载EasyNode.zip失败,请检查网络环境或稍后再试"
exit 1
fi
echo "下载成功"
echo '开始解压'
echo '***********************开始解压***********************'
unzip -o -d ${FILE_PATH}/${SERVER_NAME} ${SERVER_ZIP}
if [ $? != 0 ]
then
echo "解压失败, 请确保已安装zip、tar基础工具"
exit 1
fi
echo "解压成功"
cd ${FILE_PATH}/${SERVER_NAME} || exit
echo '安装依赖'
npm i -g yarn
echo '***********************开始安装依赖***********************'
yarn -v
if [ $? != 0 ]
then
echo "未安装yarn管理工具,正在安装..."
npm i -g yarn
fi
yarn
if [ $? != 0 ]
then
echo "yarn安装失败请检测网络环境. 使用大陆vps请执行以下命令设置镜像源再重新运行该脚本npm config set registry https://registry.npm.taobao.org
"
fi
echo "依赖安装成功"
echo '启动服务'
pm2 start ${FILE_PATH}/${SERVER_NAME}/app/main.js --name easynode-server
echo '查看日志请输入: pm2 log easynode-server'