準備一臺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即可打開

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/209077.html
標籤:其他
上一篇:再說linux命令列的管道
下一篇:得心應手,linux新安裝的虛擬機必備常用的配置【最小化】,centos7虛擬機初始化環境快照配置,幫助你快速使用新系統/虛機
