@sasaki
2016-04-23T23:43:46.000000Z
字数 5796
阅读 5418
Pricatice
@Title 搭建Confluence——企业级团队协作工具
@Version v1.0
@Timestamp 2015-04-23 00:44
@Author Nicholas
@Mail redskirt@outlook.com
Confluence为团队提供一个协作环境。在这里,团队成员齐心协力,各擅其能,协同地编写文档和管理项目。从此打破不同团队、不同部门以及个人之间信息孤岛的僵局,Confluence真正实现了组织资源共享。
Confluence使用简单,但它强大的编辑和站点管理特征能够帮助团队成员之间共享信息、文档协作、集体讨论。
本文记录了我在CentOS 6.5平台下搭建Confluence的全部过程。
详细步骤参考Confluence官方“Installing Confluence on Linux”:
https://confluence.atlassian.com/doc/installing-confluence-on-linux-143556824.html
下载地址
https://www.atlassian.com/software/confluence/download?os=linux
选择Linux环境的安装包,当前最新版本5.9.9。
由于是在Windows环境中下载的,用FTP工具put到服务器中,执行安装时出现以下异常。警告中意思说的很清楚,安装包是二进制编码的,应该是上传文件的时候使用的ASCII编码传输。重新上传,在FTP中传输方式选择为Binary。
[root@master tmp]# chmod 755 atlassian-confluence-5.9.9-x64.bin
[root@master tmp]# ./atlassian-confluence-5.9.9-x64.bin
gzip: sfx_archive.tar.gz: not in gzip format
I am sorry, but the installer file seems to be corrupted.
If you downloaded that file please try it again. If you
transfer that file with ftp please make sure that you are
using binary mode.
再次执行安装过程,根据操作提示连续回答几个问题,设置需要的配置。因为无特殊配置,此处选择了使用默认配置,使用默认的安装路径和数据存放路径,默认端口为8090。
[root@master tmp]# chmod 755 atlassian-confluence-5.9.9-x64.bin
[root@master tmp]# ./atlassian-confluence-5.9.9-x64.bin
Unpacking JRE ...
Starting Installer ...
Apr 22, 2016 12:33:41 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
This will install Confluence 5.9.9 on your computer.
OK [o, Enter], Cancel [c]
o
Choose the appropriate installation or upgrade option.
Please choose one of the following:
Express Install (uses default settings) [1],
Custom Install (recommended for advanced users) [2, Enter],
Upgrade an existing Confluence installation [3]
1
See where Confluence will be installed and the settings that will be used.
Installation Directory: /opt/atlassian/confluence
Home Directory: /var/atlassian/application-data/confluence
HTTP Port: 8090
RMI Port: 8000
Install as service: Yes
Install [i, Enter], Exit [e]
i
Extracting files ...
Please wait a few moments while Confluence starts up.
Launching Confluence ...
Installation of Confluence 5.9.9 is complete
Your installation of Confluence 5.9.9 is now ready and can be accessed via
your browser.
Confluence 5.9.9 can be accessed at http://localhost:8090
Finishing installation ...
在MySQL中为Confluence建立数据库环境,当然,服务器必须预先安装MySQL,如果本地没有数据库则使用远程的也可,Confluence的持久层是用Hibernate框架。数据库的访问地址在Web UI引导安装界面会有。
新建好数据库后注意把mysql连接的jar文件放到Confluence安装目录的web项目中的lib下,需要驱动文件才能建立数据库连接。
# 建立confluence数据库
mysql> CREATE DATABASE confluence CHARACTER SET utf8 COLLATE utf8_bin;
# 配置confluence用户对数据库的访问权限
mysql> GRANT ALL PRIVILEGES ON confluence.* TO 'confluenceuser'@'localhost' IDENTIFIED BY 'confluencepass';
Query OK, 0 rows affected (0.00 sec)
# 拷贝驱动jar文件到lib目录
[root@master lib]# pwd
/opt/atlassian/confluence/confluence/WEB-INF/lib
[root@master lib]# cp /usr/application/tmp/mysql-connector-java-5.1.35.jar .
至此,安装过程结束,根据官方wiki的说明,还需在安装目录下新建或修改以下配置文件
# 在<CONFLUENCE_HOME>创建一个confluence.cfg.xml文件
[root@master confluence]# pwd
/opt/atlassian/confluence
[root@master confluence]# ls
bin install.reg LICENSE NOTICE RELEASE-NOTES uninstall
conf jre licenses README.html RUNNING.txt webapps
confluence lib logs README.txt temp work
[root@master confluence]# touch confluence.cfg.xml
# 在server.xml中<Context ></Context>配置语句块中新增以下内容,即配置MySql Datasource
[root@master confluence]# vim conf/server.xml
<Resource name="jdbc/confluence" auth="Container" type="javax.sql.DataSource"
username="yourusername"
password="yourpassword"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/confluence?useUnicode=true&characterEncoding=utf8"
maxTotal="25"
maxIdle="10"
defaultTransactionIsolation="READ_COMMITTED"
validationQuery="Select 1" />
# 在web.xml文件中<web-app></web-app>配置语句块中新增以下内容,引用Datasource
[root@master confluence]# vim conf/web.xml
<resource-ref>
<description>Connection Pool</description>
<res-ref-name>jdbc/confluence</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
# 在以上新建的confluence.cfg.xml文件中贴入以下内容,配置hibernate框架对Datasource的访问
[root@master confluence]# vim confluence.cfg.xml
<property name="hibernate.setup"><![CDATA[true]]></property>
<property name="hibernate.dialect"><![CDATA[com.atlassian.hibernate.dialect.MySQLDialect]]></property>
<property name="hibernate.connection.datasource"><![CDATA[java:comp/env/jdbc/confluence]]></property>
执行启动脚本,实际上是Tomcat容器的启动脚本。
[root@localhost confluence]# pwd
/opt/atlassian/confluence
[root@localhost confluence]# bin/start-confluence.sh
To run Confluence in the foreground, start the server with start-confluence.sh -fg
executing using dedicated user: confluence1
If you encounter issues starting up Confluence, please see the Installation guide at http://confluence.atlassian.com/display/DOC/Confluence+Installation+Guide
Server startup logs are located in /opt/atlassian/confluence/logs/catalina.out
Using CATALINA_BASE: /opt/atlassian/confluence
Using CATALINA_HOME: /opt/atlassian/confluence
Using CATALINA_TMPDIR: /opt/atlassian/confluence/temp
Using JRE_HOME: /opt/atlassian/confluence/jre/
Using CLASSPATH: /opt/atlassian/confluence/bin/bootstrap.jar:/opt/atlassian/confluence/bin/tomcat-juli.jar
Using CATALINA_PID: /opt/atlassian/confluence/work/catalina.pid
Tomcat started.
# 查看8090端口已被监听,此时可打开浏览器访问confluence
[root@localhost confluence]# netstat -atpl|grep 8090
tcp 0 0 *:8090 *:* LISTEN 15188/java
# 停止confluenct服务
[root@master confluence]# bin/stop-confluence.sh
executing using dedicated user
If you encounter issues starting up Confluence, please see the Installation guide at http://confluence.atlassian.com/display/DOC/Confluence+Installation+Guide
# Configuring a MySQL Datasource in Apache Tomcat
Server startup logs are located in /opt/atlassian/confluence/logs/catalina.out
Using CATALINA_BASE: /opt/atlassian/confluence
Using CATALINA_HOME: /opt/atlassian/confluence
Using CATALINA_TMPDIR: /opt/atlassian/confluence/temp
Using JRE_HOME: /opt/atlassian/confluence/jre/
Using CLASSPATH: /opt/atlassian/confluence/bin/bootstrap.jar:/opt/atlassian/confluence/bin/tomcat-juli.jar
Using CATALINA_PID: /opt/atlassian/confluence/work/catalina.pid
Tomcat stopped.
以下为Confluence UI引导安装界面的截图,具体步骤不再赘述。