官方文档:https://github.com/thx/RAP/wiki/deploy_manual_cn
一.安装jdk
tar -xf jdk-7u80-linux-x64.tar.gz
ln -s jdk1.7.0_80/ jd``k
添加以下内容到/etc/profile
JAVA_HOME=/opt/software/jdk
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME
export JRE_HOME
export PATH
export CLASSPATH
```
**source /etc/profile** 更新环境变量
#二.编译安装mysql5.6
```
yum -y install make gcc-c++ cmake bison-devel ncurses-devel unzip
wget https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.35.tar.gz
tar xf mysql-5.6.36.tar.gz
mkdir -p /usr/local/mysql/data
cd mysql-5.6.36
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make&& make install
groupadd mysql
useradd -g mysql mysql
chown -R mysql:mysql /usr/local/mysql
cd /usr/local/mysql
scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
cp support-files/mysql.server /etc/init.d/mysql
chkconfig mysql on
service mysql start
echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
mysqladmin -uroot password='gnova2017!@#'
```
#三.下载rap.war 包
wget http://rapapi.org/release/RAP-0.14.16-SNAPSHOT.war
unzip -x RAP-0.14.16-SNAPSHOT.war -d ROOT
修改文件
vi ROOT/WEB-INF/classes/config.properties
jdbc.username=root
jdbc.password=password
#四.下载tomcat
```
wget http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.69/bin/apache-tomcat-7.0.69.tar.gz
tar -zvxf apache-tomcat-7.0.69.tar.gz
```
#五.安装redis
```
tar xzf redis-3.2.8.tar.gz
cd redis-3.2.8
nohup ./src/redis-server &
```
#六.部署rap应用
初始化数据库,设置密码,禁止匿名访问,导入数据
```
create database rap_db default charset utf8 COLLATE utf8_general_ci;
mysql -uroot -p'gnova2017!@#' < ROOT/WEB-INF/classes/database/initialize.sql
```
将rap应用部署到tomcat中运行
```
rm -rf apache-tomcat-7.0.69/webapps/ROOT/*
cp -R ROOT/* apache-tomcat-7.0.69/webapps/ROOT/
```
启动tomcat
![图片.png](http://upload-images.jianshu.io/upload_images/4618795-60eb158f0db7b00c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)