[Original] install Xwiki8.2.1 and centos7xwiki8.2.1 on CentOS7
Environment
CentOS 7
Kernel version 3.10.0-327. el7.x86 _ 64
JDK8 (jdk1.8.0 _ 101) + Tomcat7.0.67 + MySQL5.6.32
Xwiki-enterprise-web-8.2.1.war XWIKI 8.2.1
1. Install JDK 8
Download the jdk-8u101-linux-x64.tar package and decompress it on the server to/usr/java (you can create this folder in advance). The next step is to configure the environment variables.
Vim/etc/profile
Add the following content at the bottom
JAVA_HOME =/usr/java/jdk.1.8.0 _ 101 # depending on the actual version and path you have installed
PATH = $ JAVA_HOME/bin: $ PATH
CLASSPATH = $ JAVA_HOME/jre/lib/ext: $ JAVA_HOME/lib/tools. jar
Export PATH JAVA_HOME CLASSPATH
Use source/etc/profile to make the modification take effect immediately.
It is recommended that you manually execute the command. After modification, you can run the javac or java-version command to see if it can run. If it can run, the variable is set correctly.
2. Configure Tomcat and JAVA variable environments
Tomcat7 also decompress the tar package on the official website to/usr/local/tomcat. Generally, the root directory extracted is the apache_tomcat version, for future convenience, You have to upload all files in the root directory to tomcat.
Note that we recommend that you do not use version 7.0.70 on the xwiki official website (the bug with rollback is not handled). Therefore, we recommend that you use version 7.0.67 of tomcat7.0.67.
Set tomcat startup
1. Add a pid file for tomcat.
Add the setenv. sh configuration under the release a/bin directory. The configuration will be called when catalina. sh is started, and java memory parameters are configured at the same time.
JAVA_HOME =/usr/java/jdk1.8.0 _ 101
TOMCAT_USER = tomcat
# Add tomcat pid
CATALINA_PID = "$ CATALINA_BASE/tomcat. pid"
# Add java opts
JAVA_OPTS = "-server-XX: PermSize = 256 M-XX: MaxPermSize = 1024 m-Xms512M-Xmx1024M-XX: MaxNewSize = 256 m"
Give the script an execution permission
Chmod-R 755 setnev. sh
2. Added tomcat. service
Add tomcat. service to the/usr/lib/systemd/system directory. The directory must be an absolute directory.
-------------------------------
[Unit]
Description = Tomcat
After1_syslog.tar get network.tar get remote-fs.target nss-lookup.target
[Service]
Type = forking
PIDFile =/usr/local/tomcat. pid
ExecStart =/usr/local/tomcat/bin/startup. sh
ExecReload =/bin/kill-s HUP $ MAINPID
ExecStop =/bin/kill-s QUIT $ MAINPID
PrivateTmp = true
[Install]
Wantedbypolicmulti-user.tar get
------------------------------------
[Unit] indicates that the service is configured and executed after the network is started. [Service] configure the service pid, service start, stop, and restart. [Install] the user is configured.
3. Use tomcat. service
Configure startup
Systemctl enable tomcat
Start tomcat
Systemctl start tomcat
Stop tomcat
Systemctl stop tomcat
Restart tomcat
Systemctl restart tomcat
Because the pid is configured, the tomcat. pid file is generated in the tomcat root directory at startup, and deleted after it is stopped.
At the same time, when tomcat is started, executing start will not start two tomcat servers, so that only one tomcat service is always running.
Multiple tomcat servers can be configured in multiple directories without affecting each other.
Modify conf/server. xml
<Connector port = "8080" protocol = "HTTP/1.1"
ConnectionTimeout = "20000"
RedirectPort = "8443"
URIEncoding = "UTF-8"
Compression = "on"
CompressionMinSize = "2048"
CompressableMimeType = "text/html, text/xml, text/css, text/javascript, application/x-javascript"/>
Configure java memory
The above setnev. sh script can be skipped.
Modify bin/catalina. sh:
JAVA_HOME = "/usr/java/glasis1.8.0 _ 101 /"
JAVA_OPTS = "-Xmx800m-XX: MaxPermSize = 196 m" # optimize java memory
CATALINA_OPTS = "-server-Xms800m-Xmx1480m-XX: MaxPermSize = 222 m-Dfile. encoding = UTF-8-Djava. awt. headless = true-XX: + UseParallelGC-XX: MaxGCPauseMillis = 100"
Iii. Install mysql in YUM
First install the rpm package with available mysql5 series community edition Resources
Rpm-Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
View available mysql installation Resources
Yum repolist enabled | grep "mysql. *-community .*"
Generally, you only need to install mysql-server and mysql-client
In this case, we can directly install MySQL using yum.
Yum-y install mysql-community-server
Note that after the installation is complete, you must restart the mysql service once it is started.
Start systemctl enable mysqld
Start the mysql service process systemctl start mysqld
Prepare a mysql database
1. Set the character set to utf8
Vim/etc/my. cnf
Add under [mysqld]
Default-character-set = utf8
Add at the bottom
[Mysql]
Default-character-set = utf8
2. Create an xwiki Database
Create database xwiki character set utf8 collate utf8_general_ci;
3. Create xwiki users and grant permissions and passwords to xwiki users
Grant all privileges on xwiki. * to xwikiadmin @ localhost identified by 'your password ';
4. Install xwiki
1. decompress the xwiki WAR file to the webapps directory of tomcat:
Unzip xwiki-enterprise-web-8.2.1.war-d/usr/local/tomcat/webapps/xwiki/
2. Download the mysql jdbc driver to the xwiki/WEB-INF/lib directory.
Wget http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.39/mysql-connector-java-5.1.39.jar
It is recommended to go to the official website to manually download the mysql-connector-java-5.1.39_bin.jar and then put the lib directory
3. Modify xwiki/WEB-INF/hibernate. cfg. xml
Comment out the default hsql statement in the region where the database is selected, and then remove the comment from the MySQL section.
<! -- MySQL configuration.
Uncomment if you want to use MySQL and comment out other database deployments.
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"> 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"/>
The two new rows are:
<Property name = "connection. useUnicode"> true </property>
<Property name = "connection. characterEncoding"> UTF-8 </property>
Trial Run and initial installation
1. Run tomact.
2. Open http: // 127.0.0.1: 8080/xwiki in the browser. The initialization and installation settings page is displayed.