1. // 买的是腾讯云 轻量应用服务器
    2. // 切换到根目录
    3. cd /
    4. /**
    5. * 安装node
    6. *
    7. * 查看所有node包 https://nodejs.org/dist/
    8. **/
    9. sudo wget https://nodejs.org/dist/v16.17.0/node-v16.17.0-linux-x64.tar.xz
    10. sudo tar xf node-v16.17.0-linux-x64.tar.xz
    11. cd node-v16.17.0-linux-x64
    12. export PATH=$PATH:/node-v16.17.0-linux-x64/bin
    13. /**
    14. * 安装 mysql
    15. **/
    16. sudo yum install mysql-server
    17. sudo systemctl enable mysqld
    18. sudo systemctl start mysqld
    19. sudo systemctl status mysqld
    20. // 无密码登录
    21. sudo mysql
    22. // 改密码
    23. ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '117304@Jie';
    24. FLUSH PRIVILEGES;
    25. // 使用密码登录
    26. sudo mysql -uroot -p
    27. /***
    28. * 文件上传
    29. * 通过ftp
    30. * ftp不支持文件夹上传
    31. **/
    32. sudo yum -y install ftp
    33. put /Users/aqiu/Desktop/Work/project/e_c/packages/backend/dist/index.js /home/lighthouse/
    34. /***
    35. * scp 上传文件
    36. **/
    37. scp /Users/aqiu/Desktop/Work/project/e_c/packages/backend/dist/index.js root@43.139.155.19:/home/lighthouse/
    38. // Permission denied
    39. // vim /etc/ssh/sshd_config 修改 sshd_config文件中 PasswordAuthentication yes
    40. sodo service sshd restart
    41. /**
    42. * mysql 重启
    43. ***/
    44. lsof -i:3000
    45. kill -9 [PID]
    46. // 安装git
    47. sudo yum install git
    48. /***
    49. * nvm 安装
    50. ***/
    51. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
    52. source ~/.bash_profile
    53. nvm install 16.18.1
    54. nvm list
    55. nvm use 16.18.1
    56. /***
    57. * nginx 安装
    58. **/
    59. sudo yum install nginx
    60. sudo systemctl enable nginx
    61. sudo systemctl start nginx
    62. sudo systemctl status nginx
    63. // 项目目录
    64. /home/lighthouse/
    65. // 静态文件目录
    66. /usr/share/nginx/html
    67. echo "hello aqiu.com" | sudo tee /usr/share/nginx/html/index.html
    68. // 创建测试文件
    69. echo "你好 阿秋" | sudo tee /usr/share/nginx/html/index.html
    70. // 添加文件
    71. sudo vim /etc/nginx/conf.d/aqiu.vip.conf
    72. // 文件内容
    73. server {
    74. listen 80;
    75. server_name aqiu.vip www.aqiu.vip;
    76. root /home/lighthouse;
    77. index index.html;
    78. access_log /var/log/nginx/aqiu.vip.access.log;
    79. error_log /var/log/nginx/aqiu.vip.error.log;
    80. }
    81. // 测试nginx是否ok
    82. sudo nginx -t
    83. // 映射 aqiu.vip 到 本地环境
    84. echo "127.0.0.1 aqiu.vip" | sudo tee -a /etc/hosts
    85. // 重启 nginx
    86. sudo systemctl restart nginx
    87. // 查看nginx安装目录
    88. ps -ef | grep nginx