当前位置: 首页 > 工具软件 > zrlog > 使用案例 >

ZrLog

马博学
2023-12-01

ZrLog简介

ZrLog是使用 Java 开发的博客/CMS程序,具有简约,易用,组件化,内存占用低等特点。自带 Markdown 编辑器,让更多的精力放在写作上
https://gitee.com/94fzb/zrlog

部署环境前提

  • jre 版本 >= 1.8
  • tomcat 版本 >=8,jetty > 8
  • mysql

jdk9.0

vim /etc/profile.d/java.sh

export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib
[root@iZ6we1ar56ovnqhhxxq917Z ~]# java -version
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)

tomcat9.0.22

tar xf apache-tomcat-9.0.22.tar.gz -C /opt/
cd /opt/
ln -s apache-tomcat-9.0.22 tomcat

ZrLog官方war包部署

清空tomcat/webapps目录下内容,上传war包到webapps目录

cp zrlog.war /opt/tomcat/webapps/ROOT.war

创建数据库及用户

create database zrlog character set utf8 collate utf8_general_ci;
grant all on zrlog.* to 'zrlog'@'192.168.1.%' identified by '123456';

访问

http://host:port/zrlog/install

ZrLog源码打包部署

下载maven

apache-maven-3.6.1-bin.tar.gz

maven环境变量

vim /etc/profile.d/maven.sh

export MAVEN_HOME=/usr/local/maven
export PATH="$MAVEN_HOME/bin:$PATH"

maven仓库配置

vim /usr/local/maven/conf/settings.xml

<mirrors>
<mirror> 
<id>nexus-aliyun</id> 
<mirrorOf>*</mirrorOf> 
<name>Nexus aliyun</name> 
<url>http://maven.aliyun.com/nexus/content/groups/public</url> 
</mirror>
</mirrors>

maven打包相关命令

打包

mvn package

清空包

mvn clean

本地仓库

~/.m2/repository/

创建数据库及用户

create database zrlog character set utf8 collate utf8_general_ci;
grant all on zrlog.* to 'zrlog'@'127.0.0.1' identified by '123456';

测试连接数据库

mysql -h 127.0.0.1 -uzrlog -p123456

下载zrlog源码包

git clone https://gitee.com/94fzb/zrlog.git

配置连接数据库文件

vim web/src/main/webapp/WEB-INF/db.properties

password=123456
jdbcUrl=jdbc:mysql://127.0.0.1:3306/zrlog?characterEncoding=UTF-8&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=GMT
user=zrlog
driverClass=com.mysql.cj.jdbc.Driver

导入数据库

zrlog/service/src/main/resources/init-table-structure.sql

删除安装锁

rm web/src/main/webapp/WEB-INF/install.lock

maven打包

mvn package

报错

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project web: There are test failures.

修改pom.xml
vim /opt/zrlog/pom.xml

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.12.4</version>
        <configuration>
          <skipTests>true</skipTests>
        </configuration>
</plugin>

继续打包

...
[INFO] Building war: /opt/zrlog/web/target/../../target/zrlog-2.1.0.war
...

/opt/zrlog/target/zrlog-2.1.0.war

部署maven打包的zrlog-2.1.0.war

cp zrlog-2.1.0.war /opt/tomcat/webapps/ROOT.war

访问

http://ip:8080

 类似资料:

相关阅读

相关文章

相关问答