// 买的是腾讯云 轻量应用服务器
// 切换到根目录
cd /
/**
* 安装node
*
* 查看所有node包 https://nodejs.org/dist/
**/
sudo wget https://nodejs.org/dist/v16.17.0/node-v16.17.0-linux-x64.tar.xz
sudo tar xf node-v16.17.0-linux-x64.tar.xz
cd node-v16.17.0-linux-x64
export PATH=$PATH:/node-v16.17.0-linux-x64/bin
/**
* 安装 mysql
**/
sudo yum install mysql-server
sudo systemctl enable mysqld
sudo systemctl start mysqld
sudo systemctl status mysqld
// 无密码登录
sudo mysql
// 改密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '117304@Jie';
FLUSH PRIVILEGES;
// 使用密码登录
sudo mysql -uroot -p
/***
* 文件上传
* 通过ftp
* ftp不支持文件夹上传
**/
sudo yum -y install ftp
put /Users/aqiu/Desktop/Work/project/e_c/packages/backend/dist/index.js /home/lighthouse/
/***
* scp 上传文件
**/
scp /Users/aqiu/Desktop/Work/project/e_c/packages/backend/dist/index.js root@43.139.155.19:/home/lighthouse/
// Permission denied
// vim /etc/ssh/sshd_config 修改 sshd_config文件中 PasswordAuthentication yes
sodo service sshd restart
/**
* mysql 重启
***/
lsof -i:3000
kill -9 [PID]
// 安装git
sudo yum install git
/***
* nvm 安装
***/
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
source ~/.bash_profile
nvm install 16.18.1
nvm list
nvm use 16.18.1
/***
* nginx 安装
**/
sudo yum install nginx
sudo systemctl enable nginx
sudo systemctl start nginx
sudo systemctl status nginx
// 项目目录
/home/lighthouse/
// 静态文件目录
/usr/share/nginx/html
echo "hello aqiu.com" | sudo tee /usr/share/nginx/html/index.html
// 创建测试文件
echo "你好 阿秋" | sudo tee /usr/share/nginx/html/index.html
// 添加文件
sudo vim /etc/nginx/conf.d/aqiu.vip.conf
// 文件内容
server {
listen 80;
server_name aqiu.vip www.aqiu.vip;
root /home/lighthouse;
index index.html;
access_log /var/log/nginx/aqiu.vip.access.log;
error_log /var/log/nginx/aqiu.vip.error.log;
}
// 测试nginx是否ok
sudo nginx -t
// 映射 aqiu.vip 到 本地环境
echo "127.0.0.1 aqiu.vip" | sudo tee -a /etc/hosts
// 重启 nginx
sudo systemctl restart nginx
// 查看nginx安装目录
ps -ef | grep nginx