登录云服务器控制台,开放端口:8888,9999,6666,5555,80,443
设置子域名指向IP
ssh root@xx.domain.name
更新系统:
# apt update && apt upgrade -y
安装基本工具:
# apt install build-essential nano git
修改hostname
# hostnamectl set-hostname xiaoyue
修改密码
# passwd root
防火墙设置
# ufw allow 22
# ufw allow 80
# ufw allow 443
# ufw allow 9999
# ufw allow 8888
# ufw allow 6666
# ufw allow 5555
# ufw enable
# ufw status
安装node/npm
# cd ~ && mkdir download && cd download
# wget https://nodejs.org/dist/v20.15.0/node-v20.15.0-linux-x64.tar.xz
# tar --strip-components 1 -xvf node-v20.15.0-linux-x64.tar.xz -C /usr/local
# node -v
使用國內鏡像
# npm config set registry https://registry.npmmirror.com
用回官方registry
# npm config set registry https://registry.npmjs.org
# npm install npm@latest -g
# mkdir vue_test && cd vue_test
npm create vue@latest
ssh免密登录Linux服务器
在客户端检查是否存在证书
# ls -al ~/.ssh/id_*.pub
如果不存在,生成证书
# ssh-keygen -t rsa -b 4096 -C "jinmin.si@outlook.com"
生成证书的过程中使用空白的 passphrase
将证书拷贝到服务器
# ssh-copy-id root@server
保持与服务器的ssh连接不断线的方法
ssh连接服务器时如果容易断线,可以修改服务器sshd的设置,保持ssh连接不断线:
# nano /etc/ssh/sshd_config
ClientAliveInterval 60 # 表示每60秒发送一次请求,从而保持连接不断线。
ClientAliveCountMax 10 # 表示服务器发出请求后客户端没有响应的次数达到10次,就自动断开连接
# systemctl restart sshd
拷贝文件
scp root@old_server:/root/.bash_aliases root@new_server:/root/
scp root@old_server:/etc/systemd/system/buda.service
root@new_server:/etc/systemd/system/
設置buda
cd ~ && mkdir code && cd code
git clone https://github.com/SiJinmin/buda
initbuda
# 重新加载systemd管理器配置:
systemctl daemon-reload
systemctl enable buda
systemctl start buda
systemctl status buda
systemctl stop buda
systemctl disable buda#查看服务的日志输出,帮助调试和故障排除。
journalctl -u buda
startbuda
測試网站访问,修改主域名解析