美文网首页
node服务器部署,环境搭建(centOS7.4+koa2+my

node服务器部署,环境搭建(centOS7.4+koa2+my

作者: 无心之水 | 来源:发表于2021-11-19 13:58 被阅读0次

打个广告,这里有更详细的教程

一、node

安装教程

curl --silent --location https://rpm.nodesource.com/setup_14.x | sudo bash
sudo yum -y install nodejs

二、nginx

rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install -y nginx

systemctl start nginx

三、mysql

wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
yum localinstall mysql57-community-release-el7-11.noarch.rpm
vim /etc/yum.repos.d/mysql-community.repo
yum -y install mysql-community-server
systemctl start mysqld

这个时候mysql其实是有默认密码的,用下面命令来查看

grep 'temporary password' /var/log/mysqld.log

拿到默认密码之后
第一次连接mysql,需要改密码:

alter  user 'root'@'localhost' identified by '新密码';
flush privileges;
quit;

下次改密码:

use mysql;
update mysql.user set authentication_string=password('新密码') where user='root';
flush privileges;
quit;

其他可能用到的:
linux 生成ssh key

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

创建数据库

CREATE DATABASE IF NOT EXISTS test_db_char DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;

四、部署koa2

使用pm2守护进程
安装

npm install pm2 -g

相关文章

网友评论

      本文标题:node服务器部署,环境搭建(centOS7.4+koa2+my

      本文链接:https://www.haomeiwen.com/subject/jjestrtx.html