This commit is contained in:
chaos-zhu 2022-06-09 14:06:26 +08:00
parent 1607ac3189
commit 15244afebb
2 changed files with 68 additions and 7 deletions

View File

@ -32,14 +32,14 @@
#### 一键脚本
> 编写中...
<!-- ```shell
# 国外环境
wget -N --no-check-certificate xxx && bash easynode-server-install.sh
- 依赖Linux基础命令curl wget git zip tar如未安装请先安装
> ubuntu: apt install curl wget git zip tar -y
>
> centos: yum install curl wget git zip tar -y
# 国内环境
wget -N --no-check-certificate xxx && bash easynode-server-install.sh
``` -->
```shell
wget -qO- http://221022.xyz:8000/s/WnGWForqiM48AnA/download/install-nodejs.sh| bash
```
#### 手动部署

View File

@ -6,3 +6,64 @@ if [ "$(id -u)" != "0" ] ; then
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
fi
. /root/.nvm/nvm.sh
echo "nvm version: $(nvm -v)"
export VM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
echo '开始安装node&npm'
nvm install --lts
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'
DOWNLOAD_FILE_URL="https://ghproxy.com/https://github.com/chaos-zhu/easynode/releases/download/v1.0/easynode-server.zip"
SERVER_NAME=easynode-server
SERVER_ZIP=easynode-server.zip
FILE_PATH=/root
wget -O ${FILE_PATH}/${SERVER_ZIP} --no-check-certificate --no-cache ${DOWNLOAD_FILE_URL}
if [ $? != 0 ]
then
echo "***********************下载EasyNode.zip失败***********************"
exit 1
fi
echo '开始解压'
unzip -o -d ${FILE_PATH}/${SERVER_NAME} ${SERVER_ZIP}
cd ${FILE_PATH}/${SERVER_NAME} || exit
echo '安装依赖'
npm i -g yarn
yarn
echo '启动服务'
pm2 start ${FILE_PATH}/${SERVER_NAME}/app/main.js