服务器配置

Mysql8安装

sudo apt update
sudo apt search mysql-server
sudo apt install -y mysql-server
sudo systemctl start mysql
mysql --version
sudo mysql -uroot -p
alter user 'root'@'localhost' identified with mysql_native_password by '密码';
flush privileges;
sudo mysql -uroot -p
# 登录mysql,执行source .sql文件
# 新建用户
CREATE USER 'username'@'remote_ip' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'remote_ip' WITH GRANT OPTION;
FLUSH PRIVILEGES;
SELECT user,plugin,host FROM mysql.user;
  1. 修改配置文件
vim /etc/mysql/mysql.conf.d/mysqld.cnf bind-address = 0.0.0.0 # 允许所有IP连接(默认值为127.0.0.1,仅限本地)
  1. 重启服务
Ubuntu/Debian sudo systemctl restart mysql
  1. 远程连接测试
mysql -h mysql_server_ip -u root -p

nginx安装

地址

https://nginx.org/en/linux_packages.html#Ubuntu

node安装

https://nodejs.org/zh-cn/download

export NVM_SOURCE=https://gitee.com/mirrors/nvm.git
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash

生成github秘钥

ssh-keygen -t ed25519 -C "your_email@example.com"

创建虚拟swap

  1. sudo fallocate -l 4G /swapfile
  2. 设置文件权限(只有 root 可读写)

sudo chmod 600 /swapfile

  1. 格式化为 swap 格式

sudo mkswap /swapfile

  1. 启用 swap 文件

sudo swapon /swapfile

  1. 验证是否启用成功

free -h

swapon --show

sudo swapoff /swapfile

2. 删除旧文件
sudo rm /swapfile

3. 创建新大小的 swap 文件
sudo fallocate -l 4G /swapfile  # 例如改为 4G

4. 重新设置
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile