准备一台Centos7的虚拟机
关掉防火墙
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
1.准备jdk环境
[root@localhost ~]# rpm -ivh jdk-8u131-linux-x64_.rpm
准备中... ################################# [100%]
正在升级/安装...
1:jdk1.8.0_131-2000:1.8.0_131-fcs ################################# [100%]
Unpacking JAR files...
tools.jar...
plugin.jar...
javaws.jar...
deploy.jar...
rt.jar...
jsse.jar...
charsets.jar...
localedata.jar...
[root@localhost ~]# java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
2.安装启动tomcat
[root@localhost ~]# mkdir /home/tomcat
[root@localhost ~]# cd /home/tomcat/
[root@localhost ~]# wget http://archive.apache.org/dist/tomcat/tomcat-9/v9.0.8/bin/apache-tomcat-9.0.8.tar.gz
[root@localhost tomcat]# tar xzf apache-tomcat-9.0.8.tar.gz
[root@localhost tomcat]# apache-tomcat-9.0.8/bin/startup.sh
Using CATALINA_BASE: /home/tomcat/apache-tomcat-9.0.8
Using CATALINA_HOME: /home/tomcat/apache-tomcat-9.0.8
Using CATALINA_TMPDIR: /home/tomcat/apache-tomcat-9.0.8/temp
Using JRE_HOME: /usr
Using CLASSPATH: /home/tomcat/apache-tomcat-9.0.8/bin/bootstrap.jar:/home/tomcat/apache-tomcat-9.0.8/bin/tomcat-juli.jar
Tomcat started.
[root@localhost tomcat]# netstat -nlput |grep 8080
tcp6 0 0 :::8080 :::* LISTEN 11737/java
3.安装启动mysql数据库
[root@localhost tomcat]# mkdir /home/mysql
[root@localhost tomcat]# cd /home/mysql/
[root@localhost mysql]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
[root@localhost mysql]# yum -y install mysql57-community-release-el7-10.noarch.rpm
[root@localhost mysql]# yum -y install mysql-community-server
[root@localhost mysql]# systemctl start mysqld.service
5.7mysql首次登录需要修改密码,先获取密码 grep password /var/log/mysqld.log
[root@localhost mysql]# grep password /var/log/mysqld.log
2020-11-09T11:09:15.473967Z 1 [Note] A temporary password is generated for root@localhost: qFRkhJBVY7_a
获取到mysql初始密码,登录mysql并修改密码 mysql -uroot -p
输入获取到的密码
进入数据库后,执行修改密码语句:
[root@localhost mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.32
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>alter user 'root'@'localhost' identified by '新密码';
新密码需要符合5.7的密码复杂度要求,弱密码用不了。
修改完密码后,必须执行刷新策略。
mysql>flush privileges;
mysql>exit
退出数据库后,重启服务,service mysqld restart
4.安装启动redis
[root@localhost mysql]# mkdir /home/redis
[root@localhost mysql]# cd /home/redis/
[root@localhost redis]# tar xzf redis-5.0.5.tar.gz
[root@localhost redis]# ls
redis-5.0.5 redis-5.0.5.tar.gz
[root@localhost redis]# cd redis-5.0.5
[root@localhost redis-5.0.5]# yum -y install gcc gcc-c++
[root@localhost redis-5.0.5]# make
启动redis
[root@localhost redis-5.0.5]# /home/redis/redis-5.0.5/src/redis-server /home/redis/redis-5.0.5/redis.conf
5.安装maven
[root@localhost ~]# mkdir /home/maven
[root@localhost ~]# cd /home/maven/
[root@localhost maven]# ls
apache-maven-3.5.4-bin.tar.gz
[root@localhost maven]# tar xzf apache-maven-3.5.4-bin.tar.gz
[root@localhost maven]#
[root@localhost maven]# vim /etc/profile
export MAVEN_HOME=/home/maven/apache-maven-3.5.4(此条为新增)
export PATH=$PATH:${JAVA_HOME}/bin:${CATALINA_HOME}/bin:${MAVEN_HOME}/bin(:${MAVEN_HOME}/bin为新增)
[root@localhost maven]# source /etc/profile
6.安装启动wukongcrm 导入数据
[root@localhost maven]# mkdir /home/wukongcrm
[root@localhost maven]# cd /home/wukongcrm/
[root@localhost wukongcrm]# ls
wukongcrm-72crm-java-master.zip
[root@localhost wukongcrm]# unzip wukongcrm-72crm-java-master.zip
[root@localhost wukongcrm]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.32 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database crm9;
mysql> use crm9;
mysql> source /home/wukongcrm/wukongcrm-72crm-java-master/docs/crm9.sql;
mysql> exit
Bye
修改配置文件
修改前 先cp备份
[root@localhost wukongcrm]# vim /home/wukongcrm/wukongcrm-72crm-java-master/src/main/resources/config/crm9-config.txt
mysql.jdbcUrl = jdbc:mysql://127.0.0.1:3306/crm9?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false
mysql.user = root
mysql.password = 新设置的mysql密码
jfinal.devMode = true
[root@localhost wukongcrm]# vim /home/wukongcrm/wukongcrm-72crm-java-master/src/main/resources/config/redis.json
{
"type":1,
"remarks":"1为单机版,2为cluster集群,3为sentinel集群",
"cacheName":"master",
"host":[
"127.0.0.1:6379"
],
"password":"", 密码这一行删掉,不要注释
"database":7
[root@localhost wukongcrm]# vim /home/wukongcrm/wukongcrm-72crm-java-master/src/main/resources/config/undertow.txt
undertow.devMode=true
# 端口
undertow.port=8090
# host
undertow.host=127.0.0.1
[root@localhost wukongcrm]# vim /home/wukongcrm/wukongcrm-72crm-java-master/pom.xml
<modelVersion>4.0.0</modelVersion>
<groupId>com.kakarote</groupId>
<artifactId>crm9</artifactId>
<packaging>war</packaging> #改成war
<version>1.4.0</version>
<name>crm9-master</name>
开启tomcat: 去掉注释
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
[root@localhost wukongcrm]# vim /home/wukongcrm/wukongcrm-72crm-java-master/src/main/java/com/kakarote/crm9/Application.java
全部注释
//package com.kakarote.crm9;
//import com.jfinal.server.undertow.UndertowConfig;
//import com.jfinal.server.undertow.UndertowServer;
//import com.kakarote.crm9.common.config.JfinalConfig;
//import com.kakarote.crm9.common.constant.BaseConstant;
//public class Application {
// public static void main(String[] args) {
// UndertowConfig config=new UndertowConfig(JfinalConfig.class,"config/undertow.txt");
// config.setResourcePath("src/main/webapp,"+ BaseConstant.UPLOAD_PATH);
// config.setServerName(BaseConstant.NAME);
// UndertowServer.create(config).start();
// }
//}
使用maven打包 过程很慢(耐心等待)
[root@localhost wukongcrm-72crm-java-master]# mvn clean package
生产war包并放置前端
将生成的cp到web根目录
[root@localhost target]# cp /home/wukongcrm/wukongcrm-72crm-java-master/target/ROOT.war /home/tomcat/apache-tomcat-9.0.8/webapps/
会自动生成 webapps/ROOT目录并有首页index.html
直接访问http://ip:8080即可打开