您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關(guān)tomcat+mysql+xwiki如何搭建開源wiki系統(tǒng)的內(nèi)容。小編覺得挺實(shí)用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
tomcat+mysql+xwiki搭建開源wiki系統(tǒng)
xwiki是使用java語言編寫的開源wiki系統(tǒng)
xwiki有多種版本,standalone的版本可以直接下載之后獨(dú)立安裝,默認(rèn)集成了jetty運(yùn)行,但是這種方式安裝xwiki,運(yùn)行速度比較慢,在大部分的情況下不能滿足企業(yè)的需求。
在linux系統(tǒng)上實(shí)現(xiàn)部署xwiki也有多種方式:
其中serlet container就有許多:
tomcat
glassfish
jboss等
關(guān)系型數(shù)據(jù)庫的選擇也是比較廣泛的,在此使用tomcat和mysql
第一步:下載xwiki的war包
wget http://download.forge.ow2.org/xwiki/xwiki-enterprise-web-6.3.war
第二步:安裝jdk
安裝jdkde要點(diǎn)主要就是環(huán)境變量
導(dǎo)出JAVA_HOME
JRE_HOME
1. 導(dǎo)出可執(zhí)行程序到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 啟動服務(wù)命令
bin/shutdown.sh 停止服務(wù)命令
webapps/ROOT/ 網(wǎng)頁目錄
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(數(shù)據(jù)庫存放目錄 /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
初始化授權(quán)庫
cd /usr/local/mysql
./scripts/mysql_install_db --user=mysql
ls /usr/local/mysql/data/mysql/ -l
chmod 777 data
創(chuàng)建mysql數(shù)據(jù)庫的主配置文件
cd mysql-5.5.13/support-files/
cp my-medium.cnf /etc/my.cnf
3.啟動數(shù)據(jù)庫服務(wù)
/usr/local/mysql/bin/mysqld_safe --user=mysql &
4.使用數(shù)據(jù)庫管理員從數(shù)據(jù)庫服務(wù)器本機(jī)登錄(沒密碼)
/usr/local/mysql/bin/mysql -uroot -p
5.設(shè)置數(shù)據(jù)庫管理員從本機(jī)登錄的密碼
/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命令所在的路徑添加到系統(tǒng)環(huán)境變量PATH里
export PATH=/usr/local/mysql/bin:$PATH
vim /etc/bashrc
export PATH=/usr/local/mysql/bin:$PATH
:wq
7.給源碼mysql服務(wù)編寫啟動腳本
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:關(guān)閉 1:關(guān)閉 2:啟用 3:啟用 4:啟用 5:啟用 6:關(guān)閉
[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
更改包大?。?/span>默認(rèn)是1M,WiKi導(dǎo)入超過1M的文件會出錯。
vi /etc/my.cnf
更改max_allowed_packet = 1M為max_allowed_packet = 32M創(chuàng)建XWiki的數(shù)據(jù)庫:
8.創(chuàng)建xwiki的數(shù)據(jù)庫:
mysql -uroot -p
mysql> create database xwiki
mysql> grant all privileges on xwiki.* to xwiki@127.0.0.1 identified by 'xwiki';
不要使用MyISAM存儲引擎,因?yàn)镸yISAM不支持事務(wù)處理,推薦使用InnoDB存儲引擎。
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
第五步:下載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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- MySQL configuration.
Uncomment if you want to use MySQL and comment out other database configurations.
-->
<property name="connection.url">jdbc:mysql://localhost/xwiki</property>
<property name="connection.username">xwiki</property>
<property name="connection.password">xwiki</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<property name="dbcp.ps.maxActive">20</property>
<mapping resource="xwiki.hbm.xml"/>
<mapping resource="feeds.hbm.xml"/>
<mapping resource="activitystream.hbm.xml"/>
<mapping resource="instance.hbm.xml"/>
</session-factory>
</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中添加
<property name="connection.useUnicode">true</property>
<property name="connection.characterEncoding">UTF-8</property>
3.MySQL的配置文件my.cnf
[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8
character-set-server=utf8
collation-server=utf8_bin
4.管理附件(/var/local/xwiki/)
默認(rèn)情況下,XWIKI使用數(shù)據(jù)庫存儲附件,上傳的附件最大為30M左右,同時MySQL的配置文件my.cnf中要設(shè)置max_allowed_packet為最大值的3倍左右,因?yàn)榇鎯v史版本也會耗費(fèi)空間
使用文件系統(tǒng)存儲可以上傳更大的附件,XWIKI使用一個臨時目錄來存儲從數(shù)據(jù)庫中調(diào)出的圖片或附件。
附件的存儲目錄在xwiki.properties中設(shè)定,不可以隨意增加或刪除這個目錄下的內(nèi)容,因?yàn)槊總€附件在數(shù)據(jù)庫中都有相應(yīng)的元數(shù)據(jù)
#-# 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/
最好在第一次運(yùn)行XWIKI的時候就設(shè)定好附件的存儲方式
在xwik.cfg文件中設(shè)置
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登陸即可。
感謝各位的閱讀!關(guān)于“tomcat+mysql+xwiki如何搭建開源wiki系統(tǒng)”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。