从拿到一个裸机开始,系统 centos 6.8,通过以下命令可以查看

1.cat /etc/issue

一、开始部署

1、安装 wget

1.yum -y install wget

2、安装基础软件,MySQL 5.6.12+ 太老的MySQL运行initialize.sql会报多timestamp错误

1.wget http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-libs-5.6.26-2.el7.x86_64.rpm
2.rpm -ivh mysql-community-release-el7-5.noarch.rpm
3.yum install -y mysql-server nginx tomcat unzip
4.
5.service mysqld start

安装idk

1.wget --no-check-certificate --no-cookie --header "Cookie: oraclelicense=accept-securebackup-cookie;" http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.rpm
2.
3.rpm -ivh jdk-8u111-linux-x64.rpm

3、下载rap的war包

1.wget http://rap.taobao.org/release/RAP-0.14.1-SNAPSHOT.war

4、解压到root

1.unzip -x RAP-0.14.1-SNAPSHOT.war -d ROOT

5、操作数据库

1.mysql
2.create database rap_db default charset utf8 COLLATE utf8_general_ci;
3.grant all on rap_db.* to 'rap'@'localhost' IDENTIFIED BY 'password';
4.flush privileges;

6、初始化数据库, 执行以下命令时,会提示输入密码,输入刚才创建用户的密码

1.mysql -u rap -p rap_db < ROOT/WEB-INF/classes/database/initialize.sql

7、配置应用中数据库连接

1.vi ROOT/WEB-INF/classes/config.properties

修改为刚才创建的数据库用户名及密码

1.jdbc.username=rap
2.jdbc.password=password

8、安装Redis 3.0以上稳定版

1.wget http://download.redis.io/releases/redis-3.2.6.tar.gz
2.tar zxvf redis-3.2.6.tar.gz
3.cd redis-3.2.6
4.make
5.cd src
6.make test

配置Redis

1.cp redis.conf /etc/
2.touch /etc/init.d/redis
3.chmod 755 /etc/init.d/redis
4.vi /etc/init.d/redis

以下是/etc/init.d/redis的文件内容

1.#!/bin/bash
2.#
3.# Init file for redis
4.#
5.# chkconfig: – 80 12
6.# description: redis daemon
7.#
8.# processname: redis
9.# config: /etc/redis.conf
10.# pidfile: /var/run/redis.pid
11.source /etc/init.d/functions
12.#BIN="/usr/local/bin"
13.BIN="/usr/local/bin"
14.CONFIG="/etc/redis.conf"
15.PIDFILE="/var/run/redis.pid"
16.### Read configuration
17.[ -r "$SYSCONFIG" ] && source "$SYSCONFIG"
18.RETVAL=0
19.prog="redis-server"
20.desc="Redis Server"
21.start() {
22.        if [ -e $PIDFILE ];then
23.            echo "$desc already running…."
24.            exit 1
25.        fi
26.        echo -n $"Starting $desc: "
27.        daemon $BIN/$prog $CONFIG
28.        RETVAL=$?
29.        echo
30.        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
31.        return $RETVAL
32.}
33.stop() {
34.        echo -n $"Stop $desc: "
35.        killproc $prog
36.        RETVAL=$?
37.        echo
38.        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog $PIDFILE
39.        return $RETVAL
40.}
41.restart() {
42.        stop
43.        start
44.}
45.case "$1" in
46.  start)
47.        start
48.        ;;
49.  stop)
50.        stop
51.        ;;
52.  restart)
53.        restart
54.        ;;
55.  condrestart)
56.        [ -e /var/lock/subsys/$prog ] && restart
57.        RETVAL=$?
58.        ;;
59.  status)
60.        status $prog
61.        RETVAL=$?
62.        ;;
63.  *)
64.        echo $"Usage: $0 {start|stop|restart|condrestart|status}"
65.        RETVAL=1
66.esac
67.exit $RETVAL

记得在redis.conf中修改

1.daemonize yes

运行

1./etc/init.d/redis start

9、安装Tomcat8

http://tomcat.apache.org/download-80.cgi下载Tomcat8的安装文件apache-tomcat-8.0.26.tar.gz。
将apache-tomcat-8.0.26.tar.gz文件放到/usr/local目录下:

1.wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-8/v8.5.9/bin/apache-tomcat-8.5.9.tar.gz
2.
3.sudo cp apache-tomcat-8.5.9.tar.gz /usr/local
4.cd /usr/local    
5.tar -zxvf apache-tomcat-8.5.9.tar.gz
6.mv apache-tomcat-8.0.26 tomcat
7.

启动Tomcat8

1./usr/local/tomcat/bin/startup.sh

10、配置tomcat

1.cp -rf ROOT /usr/local/tomcat/webapps
2.sudo chown -R devuser. /usr/local/tomcat/webapps/ROOT

重启tomcat

1. /usr/local/tomcat/bin/shutdown.sh
2. /usr/local/tomcat/bin/startup.sh

二、可能遇到问题:

1、外网无法访问

折腾好久,最后索性关闭了 iptables

1.service iptables stop

关闭了SELINUX

修改/etc/sysconfig/selinux,将SELINUX的值改为disabled的

1.# This file controls the state of SELinux on the system.
2.# SELINUX= can take one of these three values:
3.#     enforcing - SELinux security policy is enforced.
4.#     permissive - SELinux prints warnings instead of enforcing.
5.#     disabled - No SELinux policy is loaded.
6.SELINUX=disabled
7.# SELINUXTYPE= can take one of these two values:
8.#     targeted - Targeted processes are protected,
9.#     mls - Multi Level Security protection.
10.SELINUXTYPE=targeted


标签: none

评论已关闭