幽映每白日,清辉照衣裳。这篇文章主要讲述Linux环境下部署Jpress大型博客网站 #yyds干货盘点#相关的知识,希望能为你提供帮助。
【Linux环境下部署Jpress大型博客网站 #yyds干货盘点#】Jpress简介
一个类似 WordPress 的产品,使用java开发。
开始部署
1.环境准备
1.1.搭建tomcat
jdk安装
#这里的eof使用单引号引起来是为了让特殊符号也写入文件
#PATH 存放命令的路径,如果不小心改错了/etc/profile文件那么命令就不能使用了,可以使用命令的绝对路径来修改/bin/vim /etc/profile改完后exit重新连一下就行
#安装jdk之前先把之前rpm装的删掉cat >
>
/etc/profile <
<
EOF
export JAVA_HOME=/application/jdk
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
EOF[root@localhost ~]# mkdir /application
[root@localhost application]# rz -E
rz waiting to receive.
[root@localhost application]# ln -s jdk1.8.0_60/ jdk
Tomcat
[root@localhost application]# tar xf apache-tomcat-8.5.53.tar.gz
[root@localhost application]# ln -s apache-tomcat-8.5.53 tomcat
[root@localhost application]# ./tomcat/bin/startup.sh
#到此为止Tomcat部署完成
1.2.数据库部署
1.下载mysql官方扩展源
[root@localhost ~]# rpm -ivh http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-release-el7-5.noarch.rpm2.安装完mysqlrpm后会在/etc/yum.repos.d中生成两个文件
root@localhost ~]# ls /etc/yum.repos.d/my*
/etc/yum.repos.d/mysql-community.repo/etc/yum.repos.d/mysql-community-source.repo[root@localhost ~]# yum install mysql-community-server4.启动
[root@localhost soft]# systemctl start mysqld
[root@localhost soft]# systemctl enable mysqld5.登录
[root@localhost ~]# mysql
2.部署jpress博客 2.1.创建数据库
MariaDB [(none)]>
create database jpress charset utf8mb4;
Query OK, 1 row affected (0.02 sec)MariaDB [(none)]>
show create database jpress;
+----------+--------------------------------------------------------------------+
| Database | Create Database|
+----------+--------------------------------------------------------------------+
| jpress| CREATE DATABASE `jpress` /*!40100 DEFAULT CHARACTER SET utf8mb4 */ |
+----------+--------------------------------------------------------------------+
1 row in set (0.00 sec)MariaDB [(none)]>
grant all on jpress.* to jpress@localhost identified by 123456;
Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]>
MariaDB [(none)]>
select user,host from mysql.user;
+--------+-----------------------+
| user| host|
+--------+-----------------------+
| root| 127.0.0.1|
| root| ::1|
|| localhost|
| jpress | localhost|
| root| localhost|
|| localhost.localdomain |
| root| localhost.localdomain |
+--------+-----------------------+
7 rows in set (0.00 sec)MariaDB [(none)]>
grant all on jpress.* to jpress@192.168.81.% identified by 123456;
Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]>
drop user @localhost;
Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]>
MariaDB [(none)]>
select user,host from mysql.user;
+--------+-----------------------+
| user| host|
+--------+-----------------------+
| root| 127.0.0.1|
| jpress | 192.168.81.%|
| root| ::1|
| jpress | localhost|
| root| localhost|
|| localhost.localdomain |
| root| localhost.localdomain |
+--------+-----------------------+
7 rows in set (0.00 sec)MariaDB [(none)]>
flush privileges;
Query OK, 0 rows affected (0.00 sec)
2.1.获取jpress代码
- https://gitee.com/GalaIO/jpress/blob/master/wars/jpress-web-newest.war
文章图片
[root@localhost webapps]# cp jpress/jpress/wars/jpress-web-newest.war.
[root@localhost webapps]# rm -rf jpress
[root@localhost webapps]# rm -rf jpress.war
[root@localhost webapps]# mv jpress-web-newest jpress
[root@localhost webapps]# mv jpress-web-newest.war jpress.war
[root@localhost webapps]# ls
docsexampleshost-managerjpressjpress.warjpress-web-newestmanagerROOT
- 下面访问http://192.168.81.210:8080/jpress
文章图片
文章图片
文章图片
文章图片
- 我们去重启一下tomcat
- jpress的配置文件位于webapps/jpress/WEB-INF/classes, db.properties
- 安装完成默认是进入整体的首页,我们可以使用单独账号进行登录
- 然后去访问http://192.168.81.210:8080/jpress/admin
文章图片
文章图片
- 可以写一篇文章并上传图片
文章图片
- 在jpress/attachment/20200331/目录可以看到用户上传的附件
- 可以看到jpress中的表
MariaDB [(none)]> show tables from jpress; +-------------------+ | Tables_in_jpress| +-------------------+ | jpress_attachment | | jpress_comment| | jpress_content| | jpress_mapping| | jpress_metadata| | jpress_option| | jpress_taxonomy| | jpress_user| +-------------------+ 8 rows in set (0.01 sec)文章内容应该是在content表中 MariaDB [(none)]> select * from jpress.jpress_content \\G; *************************** 1. row *************************** id: 1 title: 第一篇测试文档 text: < p> 江晓龙很牛!!!!< img src="https://www.songbingjia.com/jpress/attachment/20200331/da5a9dd62da44c3fb1cab6fe9f7b293d.jpg"> < /p> thumbnail: NULL module: article style: NULL user_id: 1 parent_id: NULL object_id: NULL order_number: 0 status: normal vote_up: 0 vote_down: 0 price: 0.00 comment_status: NULL comment_count: 0 view_count: 0 created: 2020-03-31 18:16:56 modified: 2020-03-31 18:16:56 slug: 第一篇测试文档 flag: NULL lng: NULL lat: NULL meta_keywords: NULL meta_description: NULL remarks: NULL
推荐阅读
- Spring系列(@FactoryBean注解用法介绍)
- 磁盘文件系统管理及挂载管理
- 使用APICloud平台实现朋友圈功能
- 威联通(QNAP)NAS忘记密码怎么办(手把手教你!请收藏!关键时刻有用!)
- 涨粉写作经验分享 - 写作技巧
- 虚拟机快照及bash初识
- 分享一个定义需求优先级的公式,让迭代尽可能实现最有价值功能
- C++核心编程中的函数-占位参数和默认参数
- 阿里P7大牛教你如何面试NIO