tomcat+mysql+xwiki如何搭建开源wiki系统

网友投稿 351 2023-12-25

tomcat+mysql+xwiki如何搭建开源wiki系统

这篇文章给大家分享的是有关tomcat+mysql+xwiki如何搭建开源wiki系统的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

tomcat+mysql+xwiki如何搭建开源wiki系统

tomcat+mysql+xwiki搭建开源wiki系统

xwiki是使用java语言编写的开源wiki系统

xwiki有多种版本,standalone的版本可以直接-之后独立安装,默认集成了jetty运行,但是这种方式安装xwiki,运行速度比较慢,在大部分的情况下不能满足企业的需求。

在linux系统上实现部署xwiki也有多种方式:

其中serlet container就有许多:

    tomcat

    glassfish 

    jboss等

    关系型数据库的选择也是比较广泛的,在此使用tomcat和mysql

第一步:-xwiki的war包

wget http://download.forge.ow2.org/xwiki/xwiki-enterprise-web-6.3.war

第二步:安装jdk

    安装jdkde要点主要就是环境变量

    导出JAVA_HOME

    JRE_HOME

1. 导出可执行程序到PATH变量

    tar -zxvf jdk-8u73-linux-x64.tar.gz

    mv jdk1.8.0_73 /usr/local/jdk

echo "JAVA_HOME=/usr/local/jdk" >>/etc/profile

    echo "CLASSPATH=.:$JAVA_HOME/lib.tools.jar" >>/etc/profile

echo "PATH=/usr/local/jdk/bin:/bin:/sbin:/usr/sbin:/bin:/usr/bin:/root/bin" >>/etc/profile

echo "export JAVA_HOME CLASSPATH PATH" >>/etc/profile

    source /etc/profile

2.查看jdk的版本

    usr/local/jdk/bin/java -version

     java version "1.8.0_73"

Java(TM) SE Runtime Environment (build 1.8.0_73-b02)

Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode)

第三步:安装tomcat(/usr/local/tomcat/)

tar   -zxvf   apache-tomcat-6.0.32.tar.gz  -C     /usr/local/

    cd /usr/local/

    mv  apache-tomcat-6.0.32     tomcat

1.tomcat的命令

    cd  tomcat

    bin/startup.sh   启动服务命令

bin/shutdown.sh   停止服务命令

    webapps/ROOT/   网页目录

    conf   配置文件存放目录

2.查看端口

    netstat  -untnalp | grep :8080

cd /usr/local/tomcat/webapps/

    mkdir xwiki

    mv xwiki-enterprise-web-6.3.war /usr/local/tomcat/webapps/xwiki/

unzip xwiki-enterprise-web-6.3.war

第四步:安装mysql(数据库存放目录 /usr/local/mysql/data/)

安装配置工具cmake

[root@localhost cmake-2.8.10.2]# ./bootstrap   --prefix=/usr/local/cmake

[root@localhost cmake-2.8.10.2]# make

[root@localhost cmake-2.8.10.2]# make install

[root@localhost local]# /usr/local/cmake/bin/cmake  --version

cmake version 2.8.10.2

使用camke配置安装源码mysql

tar -zxvf mysql-5.5.13.tar.gz

cd mysql-5.5.13

/usr/local/cmake/bin/cmake   -DCMAKE_INSTALL_PREFIX=/usr/local/mysql    -DSYSCONFDIR=/etc   -DMYSQL_DATADIR=/home/mysql  -DMYSQL_TCP_PORT=3306   -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock   -DMYSQL_USER=mysql   -DEXTRA_CHARSETS=all   -DWITH_READLINE=1   -DWITH_SSL=system   -DWITH_EMBEDDED_SERVER=1   -DENABLED_LOCAL_INFILE=1   -DWITH_INNOBASE_STORAGE_ENGINE=1

make

make install

初始化授权库

cd /usr/local/mysql

./scripts/mysql_install_db --user=mysql

ls /usr/local/mysql/data/mysql/ -l

chmod 777 data

    创建mysql数据库的主配置文件

cd   mysql-5.5.13/support-files/

    cp  my-medium-f   /etc/my-f

3.启动数据库服务/usr/local/mysql/bin/mysqld_safe   --user=mysql     &

4.使用数据库管理员从数据库服务器本机登录(没密码)    /usr/local/mysql/bin/mysql    -uroot    -p

5.设置数据库管理员从本机登录的密码/usr/local/mysql/bin/mysqladmin   -hlocalhost    -uroot     password     "123"

    kill   -9   %1  

pkill    -9    mysqld

    /usr/local/mysql/bin/mysqld_safe   --user=mysql     &

/usr/local/mysql/bin/mysql     -uroot    -p123  (不加密码无法登录)

6.把mysql命令所在的路径添加到系统环境变量PATH里    export  PATH=/usr/local/mysql/bin:$PATH

    vim /etc/bashrc

export  PATH=/usr/local/mysql/bin:$PATH

    :wq

7.给源码mysql服务编写启动脚本

    cd    mysql-5.5.13/support-files/

cp   mysql.server    /etc/init.d/mysqldd

    chmod   +x    /etc/init.d/mysqldd

    chkconfig --add mysqldd

chkconfig --list mysqldd

    mysqldd       0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭

[root@localhost support-files]# netstat -untlap | grep :3306

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      38572/mysqld

[root@localhost support-files]# pkill  -9  mysqld

[1]+  已杀死               /usr/local/mysql/bin/mysqld_safe --user=mysql

[root@localhost support-files]# netstat -untlap | grep :3306

service  mysqldd status

 service  mysqldd start

service  mysqldd status

service  mysqldd stop

service  mysqldd start

 更改包大小:默认是1M,WiKi导入超过1M的文件会出错。

    vi /etc/my-f

更改max_allowed_packet = 1M为max_allowed_packet = 32M创建XWiki的数据库:

 8.创建xwiki的数据库:

    mysql -uroot -p

    mysql> create database xwiki

mysql> grant all privileges on xwiki.* to xwiki@127.0.0.1 identified by xwiki;

    不要使用MyISAM存储引擎,因为MyISAM不支持事务处理,推荐使用InnoDB存储引擎。

vi /etc/my-f

[client]

#password       = your_password

port            = 3306

socket          = /tmp/mysqld.sock

default-character-set=utf8

[mysqld]

port            = 3306

socket          = /tmp/mysqld.sock

skip-external-locking

key_buffer_size = 16M

max_allowed_packet = 32M

table_open_cache = 64

sort_buffer_size = 512K

net_buffer_length = 8K

read_buffer_size = 256K

read_rnd_buffer_size = 512K

myisam_sort_buffer_size = 8M

default-storage-engine=INNODB

第五步:-wiki和MySQL连接工具

-MySQL JDBC Driver Jar放到/data/app_platform/xwiki_tomcat/webapps/xwiki/WEB-INF/lib目录下

wget http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.34/mysql-connector-java-5.1.34.jar

mv mysql-connector-java-5.1.34.jar /usr/local/tomcat/webapps/xwiki/WEB-INF/lib/

    cd  /usr/local/tomcat/webapps/wiki/WEB-INF/lib/

cp -p hibernate.cfg.xml hibernate.cfg.xml-bak

    vi  hibernate.cfg.xml   删除所有多余的配置文件。

    [root@fanxh WEB-INF]# cat hibernate.cfg.xml

"-//Hibernate/Hibernate Configuration DTD//EN"

  "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

Uncomment if you want to use MySQL and comment out other database configurations.

    -->

    jdbc:mysql://localhost/xwiki

    xwiki

    xwiki

    com.mysql.jdbc.Driver

    org.hibernate.dialect.MySQL5InnoDBDialect

    20

<mapping resource="instance.hbm.xml"/>

</hibernate-configuration>

1.XWIKI字符集编码配置

   修改 web.xml文件

/data/app_platform/xwiki_tomcat/webapps/xwiki/WEB-INF/xwiki.cfg

#-# The encoding to use when transformin strings to and from byte arrays. This causes the jvm encoding to be ignored,

#-# since we want to be independend of the underlying system.

xwiki.encoding=UTF-8

2.修改hibernate.cfg.xml

     hibernate.cfg.xml中添加

true

<property name="connection.characterEncoding">UTF-8</property>

3.MySQL的配置文件my-f

[client]

default-character-set=utf8

[mysqld]

default-character-set=utf8

character-set-server=utf8

collation-server=utf8_bin

4.管理附件(/var/local/xwiki/)

默认情况下,XWIKI使用数据库存储附件,上传的附件最大为30M左右,同时MySQL的配置文件my-f中要设置max_allowed_packet为最大值的3倍左右,因为存储历史版本也会耗费空间

使用文件系统存储可以上传更大的附件,XWIKI使用一个临时目录来存储从数据库中调出的图片或附件。

附件的存储目录在xwiki.properties中设定,不可以随意增加或删除这个目录下的内容,因为每个附件在数据库中都有相应的元数据

#-# Note if the system property xwiki.data.dir is set then this property is not used.

#-# If neither the system property nor this configuration value here are set then the Servlet containers temporary

#-# directory is used; This is absolutely not recommended since that directory could be wiped out at any time and you

#-# should specify a value.

environment.permanentDirectory=/var/local/xwiki/

最好在第一次运行XWIKI的时候就设定好附件的存储方式

在xwik.cfg文件中设置

xwiki.store.p_w_upload.hint=file

xwiki.store.p_w_upload.versioning.hint=file

xwiki.store.p_w_upload.recyclebin.hint=file

用管理员登陆的话,需要修改xwiki.cfg,将xwiki.superadminpassword=system 前面#去掉,用superadmin/system登陆即可。

感谢各位的阅读!关于“tomcat+mysql+xwiki如何搭建开源wiki系统”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:可以用vue写HTML页面吗?
下一篇:vue中使用axios?
相关文章

 发表评论

暂时没有评论,来抢沙发吧~