1.购买云服务器
阿里:爆款云产品,新客特惠全年最低价,云服务器低至0.4折起
https://www.aliyun.com/activity/1111?userCode=q88dydwd
腾讯:【腾讯云】爆款1核2G云服务器首年48元,还有iPad Pro、Bose耳机、京东卡等你来抽!
https://curl.qcloud.com/Sbfa0Tiy
2.购买系统后,通过xhshell或 MobaXterm连接上服务器
https://mobaxterm.mobatek.net/
3.环境安装
---------------------------------------------------------------------------------------------
Centos7 安装git
yum -y install git
----------------------------------------------------------------------------------------------
Centos7 安装nginx
https://www.cnblogs.com/gezp/p/14967445.html
1.安装依赖包
sudo yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
2.下载并解压安装包
cd /usr/local//下载tar包
sudo wget http://nginx.org/download/nginx-1.18.0.tar.gz
sudo tar -xvf nginx-1.18.0.tar.gz
3.安装nginx
//进入nginx目录
cd /usr/local/nginx-1.18.0
4.编译 make&make install
sudo ./configure
sudo make
sudo make install
5. 配置,可以默认配置
sudo vi /usr/local/nginx/conf/nginx.conf
6. 启动
# 检查配置文件
sudo /usr/local/nginx/sbin/nginx -t
#启动
sudo /usr/local/nginx/sbin/nginx
# 重启加载配置
sudo /usr/local/nginx/sbin/nginx -s reload
----------------------------------------------------------------------------------------------
Centos7 安装jdk8
1. 查看yum库中jdk的版本
yum search java|grep jdk
2. 选择java-1.8.0安装
yum install java-1.8.0-openjdk*
3. java -version
----------------------------------------------------------------------------------------------
Centos7 安装mysql5.7
1. wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
2. yum -y install mysql57-community-release-el7-10.noarch.rpm
3. yum -y install mysql-community-server
报错:# No match for argument: mysql-community-server
yum module disable mysql
# 然后再重新执行安装命令就可以了
yum install mysql-community-server
4. systemctl start mysqld (systemctl start mysqld.service)
service mysqld restart
systemctl status mysqld
5. 查看初始密码
grep "password" /var/log/mysqld.log
设置密码
ALTER USER 'root'@'localhost' IDENTIFIED BY ''{password}';
添加新用户,允许远程链接,刷新权限配置
use mysql;
CREATE USER '{username}'@'localhost' IDENTIFIED BY '{password}';
update user set host='%' where user='{username}';
GRANT ALL PRIVILEGES ON *.* TO '{username}'@'%';
flush privileges;
6. 卸载yum,防止每次都更新
yum -y remove mysql57-community-release-el7-10.noarch
7. 安全组开启3306端口进入/出去权限,可以远程链接
8. 导入数据文件
mysql -h {ip} -P 3306 -u {username} -p
----------------------------------------------------------------------------------------------
Centos7 安装redis
1.yum install redis
2.启动redis服务
systemctl start redis
3.查看redis状态
systemctl status redis
4.设置开机自启动
systemctl enable redis
5.输入命令vi /etc/redis.conf进入编辑模式
# bind 127.0.0.1 注释掉允许远程连接
protected-mode no yes改为no
6.重启redis
systemctl restart redis
7.redis-cli -h {ip} -p 6379 连接redis
----------------------------------------------------------------------------------------------
Centos7 安装Nodejs8.x
wget https://nodejs.org/dist/v8.15.0/node-v8.15.0-linux-x64.tar.gz
tar -zxvf node-v8.15.0-linux-x64.tar.gz
mv node-v8.15.0-linux-x64 node
cp -R node /usr/local
配置环境变量
vi /etc/profile
在末尾添加
export NODE_HOME=/usr/local/node
export PATH=$NODE_HOME/bin:$PATH
export NODE_PATH=$NODE_HOME/lib/node_modules:$PATH
source /etc/profile
----------------------------------------------------------------------------------------------
4.服务部署
后端
nohup java -jar storemall-launcher.jar >storemall.log 2>&1 &
前端
前端打包完成后,放入安装的nginx包路径的html文件路径
nginx
配置前端域名映射