准备mysql数据库
1、设置字符集为utf8
vim /etc/my.cnf
在[mysqld]下添加
default-character-set=utf8
底部再添加
[mysql]
default-character-set=utf8
2、创建xwiki数据库
create database xwiki character set utf8 collate utf8_general_ci;
3、创建xwiki用户 及授予权限+密码给xwiki用户
grant all privileges on xwiki.* to xwikiadmin@localhost identified by '你设置的密码'; 四、安装xwiki
1、将xwiki的WAR文件解压到tomcat的webapps目录下:
unzip xwiki-enterprise-web-8.2.1.war -d /usr/local/tomcat/webapps/xwiki/
2、下载mysql jdbc driver到xwiki/WEB-INF/lib目录
wget http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.39/mysql-connector-java-5.1.39.jar
建议到官网手动下载 mysql-connector-java-5.1.39_bin.jar 然后再放lib目录
3、修改xwiki/WEB-INF/hibernate.cfg.xml
在选择数据库那块区域将默认的hsql给注释掉,然后将MySQL那一段去掉注释(请参照官网操作,而不是乱去掉注释) 注:这里强烈建议你将此XML文件导出或叫上传到win的系统上用Notepad++之类的软件编辑注释再下载回centos7的系统上。
<!-- MySQL configuration.
Uncomment if you want to use MySQL and comment out other database configurations.
Notes:
- if you want the main wiki database to be different than "xwiki"
you will also have to set the property xwiki.db in xwiki.cfg file
-->
<property name="connection.url">jdbc:mysql://localhost/xwiki</property>
<property name="connection.username">xwikiadmin</property>
<property name="connection.password">此处为密码</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.useUnicode">true</property>
<property name="connection.characterEncoding">UTF-8</property>
<property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<property name="dbcp.poolPreparedStatements">true</property>
<property name="dbcp.maxOpenPreparedStatements">20</property>
<mapping resource="xwiki.hbm.xml"/>
<mapping resource="feeds.hbm.xml"/>
<mapping resource="activitystream.hbm.xml"/>
<mapping resource="instance.hbm.xml"/>
<mapping resource="mailsender.hbm.xml"/>
新增的两行是:
<property name="connection.useUnicode">true</property>
<property name="connection.characterEncoding">UTF-8</property>