quli/quli.sh
2024-11-22 22:25:06 +08:00

53 lines
1.8 KiB
Bash

#!/bin/bash
# 更新软件包列表并安装必要的软件
apt-get update && apt-get install -y git wget tmux tar build-essential && \
rm -rf /var/lib/apt/lists/*
# 下载并安装 Go 1.20.14
wget http://192.168.1.238/quli/go1.20.14.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go1.20.14.linux-amd64.tar.gz && \
rm go1.20.14.linux-amd64.tar.gz
wget http://192.168.1.238/quli/ceremonyclient-develop.tar.gz && \
mkdir -p /root/ceremonyclient && \
tar -C /root/ceremonyclient -xzf ceremonyclient-develop.tar.gz && \
rm ceremonyclient-develop.tar.gz
# 设置 Go 环境变量
export PATH="/usr/local/go/bin:$PATH"
export GOPATH="/root/go"
export GO111MODULE=on
export GOPROXY=https://goproxy.cn,direct
echo 'export PATH=/usr/local/go/bin:$PATH' >> /root/.bashrc
echo 'export GOPATH=/root/go' >> /root/.bashrc
echo 'export GO111MODULE=on' >> /root/.bashrc
echo 'export GOPROXY=https://goproxy.cn,direct' >> /root/.bashrc
# 创建必要的文件夹
mkdir -p /root/backup /root/scripts/log /swap
# 配置交换空间
fallocate -l 24G /swap/swapfile && \
chmod 600 /swap/swapfile && \
mkswap /swap/swapfile && \
swapon /swap/swapfile && \
echo "/swap/swapfile swap swap defaults 0 0" >> /etc/fstab
# 修改网络缓冲区大小
echo -e "\nnet.core.rmem_max=600000000" >> /etc/sysctl.conf
echo -e "\nnet.core.wmem_max=600000000" >> /etc/sysctl.conf
sysctl -p
# 下载 qnode_restart.sh 脚本并赋予执行权限
wget -O /root/scripts/qnode_restart.sh -N http://192.168.1.238/quli/qnode_restart.sh && chmod +x /root/scripts/qnode_restart.sh
# 克隆 Quilibrium 客户端
# git clone https://git.088.im/coosld/ceremonyclient.git /root/ceremonyclient
# 构建 Quilibrium 客户端
cd /root/ceremonyclient/client
GOEXPERIMENT=arenas go build -o /root/qclient main.go
# 启动 qnode_restart 脚本
exec /root/scripts/qnode_restart.sh