您的位置:首页 > 教育 > 锐评 > Ubuntu Linux 22 云服务器配置备忘

Ubuntu Linux 22 云服务器配置备忘

2024/10/7 2:28:25 来源:https://blog.csdn.net/qiuzen/article/details/140178829  浏览:    关键词:Ubuntu Linux 22 云服务器配置备忘

登录云服务器控制台,开放端口: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

測試网站访问,修改主域名解析

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com