在centos7上部署RAP
- 基础软件安装 wget rpm -ivh mysql-community-release-el7-5.noarch.rpm yum install -y mysql-server nginx tomcat unzip redis
- Nginx下载安装 rpm -ivh yum install nginx service nginx start
- Redis下载安装
- mysql安装 yum install wget wget rpm -ivh mysql-community-release-el7-5.noarch.rpm yum install mysql-server yum install mysql-devel 这样就安装完成mysql了,我们可以用命令查看一下是否安装成功了 命令是:rpm -qa | grep mysql 显示: mysql-community-release-el7-5.noarch
- 下载war包 wget
- 解压至ROOT unzip -x RAP-0.14.0-SNAPSHOT.war -d ROOT
配置数据库创建数据库及用户create database rap_db default charset utf8 COLLATE utf8_general_ci;grant all on rap_db.* to 'rap'@'localhost' IDENTIFIED BY 'password';flush privileges;初始化数据库,输入刚才创建用户的密码mysql -u rap -p rap_db < ROOT/WEB-INF/classes/database/initialize.sql配置应用中数据库连接vi ROOT/WEB-INF/classes/config.properties 修改为刚才创建的数据库用户名及密码jdbc.username=rapjdbc.password=password其中redis配置可根据需求更改启动redissystemctl start redis配置tomcatsudo cp -rf ROOT /var/lib/tomcat/webappssudo chown -R tomcat. /var/lib/tomcat/webapps/ROOT重启tomcatsystemctl restart tomcat配置nginx在/etc/nginx/conf.d 中添加如下配置 rap.conf注意: 将其中的xxxx替换为你的本机ip地址或者域名server { listen 80; server_name xxxxx; #本机IP或者域名 access_log /var/log/nginx/rap_access.log; charset utf-8; autoindex off; location /{ proxy_pass http://localhost:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }}重启nginxsystemctl restart nginx配置防火墙firewall-cmd --permanent --add-service=httpfirewall-cmd --reload
- 关闭防火墙war包 systemctl stop firewalld.service#停止firewall systemctl disable firewalld.service#禁止firewall开机启动