Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build Open Source wiki system by tomcat+mysql+xwiki

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article is about how tomcat+mysql+xwiki builds an open source wiki system. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Tomcat+mysql+xwiki builds open source wiki system

Xwiki is an open source wiki system written in Java

There are many versions of xwiki. The version of standalone can be downloaded directly and installed independently. By default, it integrates jetty to run. However, the installation of xwiki in this way is slow and can not meet the needs of enterprises in most cases.

There are also several ways to deploy xwiki on linux systems:

Many of them are serlet container:

Tomcat

Glassfish

Jboss et al.

The choice of relational database is also extensive, tomcat and mysql are used here.

Step 1: download xwiki's war package

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

Step 2: install jdk

The main points of installing jdkde are mainly environment variables.

Export JAVA_HOME

JRE_HOME

1. Export executable programs to PATH variables

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

two。 View the version of jdk

Usr/local/jdk/bin/java-version

Java version "1.8.073"

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

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

Step 3: install 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 's command

Cd tomcat

Bin/startup.sh start service command

Bin/shutdown.sh stop Service Command

Webapps/ROOT/ web page directory

Conf configuration file storage directory

two。 View Port

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

Step 4: install mysql (database storage directory / usr/local/mysql/data/)

Install the configuration tool 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

Install source mysql using camke configuration

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

Initialize the authorization library

Cd / usr/local/mysql

. / scripts/mysql_install_db-- user=mysql

Ls / usr/local/mysql/data/mysql/-l

Chmod 777 data

Create the main configuration file for the mysql database

Cd mysql-5.5.13/support-files/

Cp my-medium.cnf / etc/my.cnf

3. Start the database service

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

4. Use the database administrator to log in locally from the database server (no password)

/ usr/local/mysql/bin/mysql-uroot-p

5. Set the password for the database administrator to log in from this computer

/ 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 (cannot log in without a password)

6. Add the path where the mysql command is located to the system environment variable PATH

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

Vim / etc/bashrc

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

: wq

7. Write a startup script for the source mysql service

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: off 1: off 2: enable 3: enable 4: enable 5: enable 6: close

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

Tcp 0 0 0.0.0.0 3306 0.0.0.015 * LISTEN 38572/mysqld

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

[1] + killed / 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

Change the package size: there will be an error when importing files larger than 1m by default.

Vi / etc/my.cnf

Change max_allowed_packet = 1m to max_allowed_packet = 32m to create the database for XWiki:

8. Create a database for xwiki:

Mysql-uroot-p

Mysql > create database xwiki

Mysql > grant all privileges on xwiki.* to xwiki@127.0.0.1 identified by 'xwiki'

Do not use the MyISAM storage engine because MyISAM does not support transactions and it is recommended that you use the InnoDB storage engine.

Vi / etc/my.cnf

[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

Step 5: download the wiki and MySQL connection tools

Download MySQL JDBC Driver Jar and put it in the / data/app_platform/xwiki_tomcat/webapps/xwiki/WEB-INF/lib directory

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 deletes all redundant configuration files.

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

Jdbc:mysql://localhost/xwiki

Xwiki

Xwiki

Com.mysql.jdbc.Driver

Org.hibernate.dialect.MySQL5InnoDBDialect

twenty

1.XWIKI character set encoding configuration

Modify the web.xml file

/ 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

two。 Modify hibernate.cfg.xml

Add to hibernate.cfg.xml

True

UTF-8

Configuration file my.cnf for 3.MySQL

[client]

Default-character-set=utf8

[mysqld]

Default-character-set=utf8

Character-set-server=utf8

Collation-server=utf8_bin

4. Manage attachments (/ var/local/xwiki/)

By default, XWIKI uses a database to store attachments, and the maximum size of uploaded attachments is about 30m. At the same time, max_allowed_packet should be set to about 3 times the maximum value in MySQL configuration file my.cnf, because the storage history version also consumes space.

Larger attachments can be uploaded using file system storage, and XWIKI uses a temporary directory to store pictures or attachments pulled from the database.

The storage directory of attachments is set in xwiki.properties, and the contents in this directory cannot be added or deleted at will, because each attachment has corresponding metadata in the database.

#-# 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 container's 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/

It is best to set the storage mode of attachments the first time you run XWIKI

Set in the xwik.cfg file

Xwiki.store.p_w_upload.hint=file

Xwiki.store.p_w_upload.versioning.hint=file

Xwiki.store.p_w_upload.recyclebin.hint=file

If you log in with an administrator, you need to modify xwiki.cfg, remove the front # of xwiki.superadminpassword=system, and log in with superadmin/system.

Thank you for reading! This is the end of this article on "how to build an open source wiki system in tomcat+mysql+xwiki". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report