Jira+Confluence集成环境的搭建(敏捷agile)

公司准备实行敏捷开发,经过一番工具选择,最终选定了jira和confluence,jira用作项目管理,confluence用于文档管理,下面说说这两个系统的搭建过程和集成设置。

一、软硬件准备

1 jira7.2.6软件

官网下载地址 https://downloads.atlassian.com/software/jira/downloads/atlassian-jira-software-7.2.6.tar.gz
备用下载地址 http://peloo.net/download/jira/atlassian-jira-software-7.2.6.tar.gz

2 jdk1.8.0_112

下载页面 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
备用下载地址 http://peloo.net/download/jdk/jdk-8u112-linux-x64.tar.gz

3 confluence5.10.8

官网下载地址 https://downloads.atlassian.com/software/confluence/downloads/atlassian-confluence-5.10.8.tar.gz
备用下载地址 http://peloo.net/download/jira/atlassian-confluence-5.10.8.tar.gz

4 mysql-server 5.6.34

下载地址 http://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.34.tar.gz

5 mysql-connector jar包

MySQL官网下载地址 http://120.52.72.23/cdn.mysql.com/c3pr90ntc0td//Downloads/Connector-J/mysql-connector-java-5.1.40.tar.gz
备用下载地址 http://peloo.net/download/db/mysql-connector-java-5.1.40.tar.gz

6 操作系统 CentOS 6.X

7 服务器两台

强烈建议独立物理机,本人的服务器ip地址分别为172.25.0.105和172.25.0.107,分别部署jira和confluence

二、基础环境搭建

1 Java环境安装与配置

两台服务器均配置相同的Java环境,并且jira和confluence要求的jdk版本都是1.8.x,这里以一台服务器的配置为例。
- 到上文提到的oracle官网链接下载jdk1.8.0_112版本到/tmp目录下,也可以用如下命令下载,速度稍慢

wget -c -P /tmp http://peloo.net/download/jdk/jdk-8u112-linux-x64.tar.gz
cd /tmp
tar zxvf jdk-8u112-linux-x64.tar.gz
\cp -av jdk-8u112-linux-x64/ /opt/
  • 设置jdk目录为root所有
chown -R root.root /opt/jdk1.8.0_112
chmod -R 755 /opt/jdk1.8.0_112
  • 编辑/etc/profile文件,添加或修改如下环境变量,
JAVA_HOME=/opt/jdk1.8.0_112
JRE_HOME=$JAVA_HOME/jre
CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib
PATH=$JAVA_HOME/bin:$JRE_HOME/bin:/usr/local/php56/bin:/usr/local/mysql/bin:$PATH
export JAVA_HOME JRE_HOME CLASSPATH PATH
  • 生效添加的环境变量,生效后所有用户都有添加的环境变量,若需要特定用户运行指定版本的jdk,则编辑用户家目录下的~/.bash_profile添加以上变量
source /etc/profile

2 MySQL服务器的安装与配置

注:两台服务器均安装MySQL服务器,公司DBA配置的MySQL可能参数过多,有些参数与jira、confluence的程序冲突,本人深受其苦,confluence用的是DBA配置的数据库,但是安装完confluence后,总是再创建文件的时候无限转圈,最后在172.25.0.107上单独部署MySQL才解决问题。
- 若系统已通过yum方式安装其他版本的MySQL,则用以下命令卸载

yum remove -y `rpm -qa | grep -i mysql`
  • 安装编译所需依赖软件
yum install -y cmake gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* glibc
  • 添加mysql组和用户
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
  • 新建MySQL工程主目录/usr/local/mysql和数据目录/usr/local/mysql/data
mkdir -p /usr/local/mysql/data
  • 下载mysql-server软件介质并解压
wget -c -P /tmp http://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.34.tar.gz
cd /tmp
tar zxvf mysql-5.6.34.tar.gz
  • 开始最关键的一步,编译和安装,如果遇到错误,百度解决,后文也有些FAQ
cd /tmp/mysql-5.6.34
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306
make
make install
  • 安全起见,设置MySQL主目录和数据目录权限
chown -R root /usr/local/mysql
chown -R mysql /usr/local/mysql/data
  • 如果编译安装通过,恭喜你,开始执行初始化数据库脚本
sh scripts/mysql_install_db.sh  –user=mysql  –basedir=/usr/local/mysql
  • 配置环境变量并生效
echo 'export PATH=/usr/local/mysql/bin:$PATH' >> /etc/profile
source /etc/profile
  • 拷贝MySQL提供的my.cnf配置文件到/etc目录下
\cp /tmp/mysql-5.6.34/support-files/my-default.cnf /etc/my.cnf
  • 修改MySQL配置文件/etc/my.cnf,主要是socket、data目录、主目录,这里给出个实例,亲测可正常运行,直接清空原来的文件内容,拷贝下面的内容即可
# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M – 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "–help" option.
# The following options will be passed to all MySQL clients
[client]
#password    = your_password
port        = 3306
socket        = /usr/local/mysql/data/mysql.sock
default-character-set=utf8
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
datadir=/usr/local/mysql/data
basedir=/usr/local/mysql
port        = 3306
socket        = /usr/local/mysql/data/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 256M
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
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin
# binary logging format – mixed recommended
binlog_format=mixed
# required unique id between 1 and 2^32 – 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id    = 1
# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) –
#    the syntax is:
#
#    CHANGE MASTER TO MASTER_HOST=, MASTER_PORT=,
#    MASTER_USER=, MASTER_PASSWORD= ;
#
#    where you replace , ,  by quoted strings and
#     by the master's port number (3306 by default).
#
#    Example:
#
#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#    MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
#    start replication for the first time (even unsuccessfully, for example
#    if you mistyped the password in master-password and the slave fails to
#    connect), the slave will create a master.info file, and any later
#    change in this file to the variables' values below will be ignored and
#    overridden by the content of the master.info file, unless you shutdown
#    the slave server, delete master.info and restart the slaver server.
#    For that reason, you may want to leave the lines below untouched
#    (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 – 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id       = 2
#
# The replication master for this slave – required
#master-host     =   
#
# The username the slave will use for authentication when connecting
# to the master – required
#master-user     =   
#
# The password the slave will authenticate with when connecting to
# the master – required
#master-password =   
#
# The port the master is listening on.
# optional – defaults to 3306
#master-port     =  
#
# binary logging – not required for slaves, but recommended
log-bin=mysql-bin
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /usr/local/mysql/data
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /usr/local/mysql/data
# You can set .._buffer_pool_size up to 50 – 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 1224M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 56M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
innodb_file_per_table = ON
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
  • 添加MySQL为系统服务
\cp /tmp/mysql-5.6.34/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
  • 启动MySQL服务器,又是关键的一步,如果报错,下文有些常见错误的解决方法
service mysqld start
  • 运行mysql命令,进入MySQL命令行,创建jira和confluence数据库并配置字符集和collation
mysql>create database jira;
mysql>alter database jira default character set utf8 collate utf8_bin;
mysql>create database confluence;
mysql>alter database confluence default character set utf8 collate utf8_bin;
  • 修改confluence数据库的两个参数max_allowed_packet为512M,innodb_log_file_size为2G,下面的sql语句可即时生效,
mysql> SET GLOBAL max_allowed_packet=536870912;
mysql> SET GLOBAL innodb_log_file_size=2147483648;
  • 需要永久生效,可修改my.cnf文件,添加两个参数如下,
[mysqld]
……
……
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 1224M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 2G
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
innodb_file_per_table = ON
[mysqldump]
quick
max_allowed_packet = 512M
  • 创建jira用户并赋予拥有数据库jira的所有权限,这里的密码统一设置为123456,生产环境建议密码复杂些
mysql>CREATE USER 'jira'@'localhost' IDENTIFIED BY123456’;
mysql>UPDATE mysql.user SET PASSWORD=PASSWORD('123456') WHERE User='jira';
mysql>GRANT ALL PRIVILEGES ON jira.* TO jira@'localhost';
  • 创建confluence用户并赋予拥有数据库confluence的所有权限
mysql>CREATE USER 'confluence'@'localhost' IDENTIFIED BY123456’;
mysql>UPDATE mysql SET PASSWORD=PASSWORD('123456') WHERE User='confluence';
mysql>GRANT ALL PRIVILEGES ON confluence.* TO confluence@'localhost';  
mysql>FLUSH PRIVILEGES;  
  • MySQL启动报错failed to update pid file,本人遇到此种情况,最有效的解决方法:
    删除mysql主目录下的data目录所有文件和文件夹,重新运行初始化脚本mysql_install_db.sh
    其他问题可能的原因有多种,具体什么原因最好的办法是先查看下错误日志,常见FAQ如下,

    • 可能是/usr/local/mysql/data/mysql.pid文件没有写的权限
      解决方法 :给予权限,执行 “chown -R mysql:mysql /var/data” “chmod -R 755 /usr/local/mysql/data” 然后重新启动mysqld!
    • 可能进程里已经存在mysql进程
      解决方法:用命令“ps -ef|grep mysqld”查看是否有mysqld进程,如果有使用“kill -9 进程号”杀死,然后重新启动mysqld!
    • 可能是第二次在机器上安装mysql,有残余数据影响了服务的启动。
      解决方法:去mysql的数据目录/data下的内容看看,如果存在mysql-bin.index,就赶快把它删除掉吧,它就是罪魁祸首了。本人就是使用第三条方 法解决的
    • mysql在启动时没有指定配置文件时会使用/etc/my.cnf配置文件,请打开这个文件查看在[mysqld]节下有没有指定数据目录(datadir)。
      解决方法:请在[mysqld]下设置这一行:datadir = /usr/local/mysql/data
    • skip-federated字段问题
      解决方法:检查一下/etc/my.cnf文件中有没有没被注释掉的skip-federated字段,如果有就立即注释掉吧。
    • 错误日志目录不存在
      解决方法:使用“chown” “chmod”命令赋予mysql所有者及权限
    • selinux惹的祸,如果是centos系统,默认会开启selinux
      解决方法:关闭它,打开/etc/selinux/config,把SELINUX=enforcing改为SELINUX=disabled后存盘退出重启机器试试。

三、安装jira

  • jira的安装在服务器172.25.0.105上,建议关闭防火墙,当然如果对防火墙配置熟悉,可放行8080端口
service iptables stop
  • 下载并解压jira到/tmp目录
wget -c -P /tmp https://downloads.atlassian.com/software/jira/downloads/atlassian-jira-software-7.2.6.tar.gz
cd /tmp
tar zxvf atlassian-jira-software-7.2.6.tar.gz
cp -rv atlassian-jira-software-7.2.6-standalone/ /opt/
  • 创建软链接,注意jira目录后不要带“/”,/opt/jira就作为jira的安装目录
ln -sv /opt/atlassian-jira-software-7.2.6-standalone /opt/jira
  • 创建jira用户并设置密码为”123456“
/usr/sbin/useradd –create-home –comment "Account for running JIRA Software"shell /bin/bash jira
echo "123456" | passwd –stdin jira
  • 设置jira目录只允许jira用户访问
chown -R jira.jira /opt/jira/
chmod -R 700 /opt/jira/
  • 创建jira家目录,用于log、搜索索引等文件的存储,并限制只允许jira用户访问
mkdir /home/jira/jirasoftware-home
chown -R jira.jira /home/jira/jirasoftware-home
chmod -R 700 /home/jira/jirasoftware-home
  • 设置/opt/jira/atlassian-jira/WEB-INF/classes/jira-application.properties文件,在末尾去除注释并修改为上面设置的jira家目录路径,
jira.home=/home/jira/jirasoftware-home
  • 配置家目录的环境变量
echo 'JIRA_HOME=/home/jira/jirasoftware-home' >> /etc/profile
echo 'export JIRA_HOME' >> /etc/profile
source /etc/profile
  • 检查端口是否被占用,jira默认运行的端口有8005和8080,Server port (8005) and the Connector port (8080) ,如果被占用,可打开/opt/jira/conf/server.xml文件修改端口,如果防火墙打开,则放行修改后的端口,下面的例子是修改成5005和5050,
<Server port="5005" shutdown="SHUTDOWN"><Service name="Catalina">
<Connector port="5050"
maxThreads="150"
minSpareThreads="25"
connectionTimeout="20000"
enableLookups="false"
maxHttpHeaderSize="8192"
protocol="HTTP/1.1"
useBodyEncodingForURI="true"
redirectPort="8443"
acceptCount="100"
disableUploadTimeout="true"/>
  • 下载mysql数据库连接jar包并拷贝到jira的lib目录下
wget -c -P /tmp http://120.52.72.23/cdn.mysql.com/c3pr90ntc0td//Downloads/Connector-J/mysql-connector-java-5.1.40.tar.gz
cd /tmp
tar zxvf mysql-connector-java-5.1.40.tar.gz
cd mysql-connector-java-5.1.40
\cp mysql-connector-java-5.1.40-bin.jar /opt/jira/lib/
  • 切换到jira用户并启动jira工程
su jira
cd /opt/jira/bin/
./start-jira.sh
  • 浏览器中输入http://172.25.0.105:8080/即可进入jira的安装界面,一步一步很简单明了,这里不做过多赘述
  • 安装完成后,系统自带的support tools可能会检测到数据库配置有误, 数据库参数设置具体参考官网链接
    https://confluence.atlassian.com/kb/how-to-fix-the-collation-and-character-set-of-a-mysql-database-744326173.html

四、安装Confluence

  • confluence的安装在服务器172.25.0.107上,建议关闭防火墙,当然如果对防火墙配置熟悉,可放行8090端口
service iptables stop
  • 下载并解压jira到/tmp目录
wget -c -P /tmp https://downloads.atlassian.com/software/confluence/downloads/atlassian-confluence-5.10.8.tar.gz
cd /tmp
tar zxvf atlassian-confluence-5.10.8.tar.gz
cp -rv atlassian-confluence-5.10.8/ /opt/
  • 创建软链接,注意jira目录后不要带“/”,/opt/confluence就作为confluence的安装目录
ln -sv /opt/atlassian-confluence-5.10.8 /opt/confluence
- 创建confluence用户并设置密码为”123456“
/usr/sbin/useradd –create-home –comment "Account for running confluence"shell /bin/bash confluence
echo "123456" | passwd –stdin confluence
  • 设置jira目录只允许jira用户访问
chown -R confluence.confluence /opt/confluence/
chmod -R 700 /opt/confluence/
  • 创建jira家目录,用于log、搜索索引等文件的存储,并限制只允许confluence用户访问
mkdir /home/jconfluence/confluence-home
chown -R confluence.confluence /home/confluence/confluence-home
chmod -R 700 /home/confluence/confluence-home
  • 设置/opt/jira/atlassian-jira/WEB-INF/classes/jira-application.properties文件,在末尾去除注释并修改为上面设置的jira家目录路径,
jira.home=/home/confluence//confluence-home
  • 检查端口是否被占用,jira默认运行的端口有8000和8090, Change the Server port (8000) and the Connector port (8090),如果被占用,可打开/opt/jira/conf/server.xml文件修改端口,如果防火墙打开,则放行修改后的端口,下面的例子是修改成Server port to 5000 and the Connector port to 5050.
Server port="5000" shutdown="SHUTDOWN" debug="0">
"Tomcat-Standalone">
"5050" connectionTimeout="20000" redirectPort="8443"
maxThreads="48" minSpareThreads="10"
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"
protocol="org.apache.coyote.http11.Http11NioProtocol" />
  • 下载mysql数据库连接jar包并拷贝到jira的lib目录下
wget -c -P /tmp http://120.52.72.23/cdn.mysql.com/c3pr90ntc0td//Downloads/Connector-J/mysql-connector-java-5.1.40.tar.gz
cd /tmp
tar zxvf mysql-connector-java-5.1.40.tar.gz
cd mysql-connector-java-5.1.40
\cp mysql-connector-java-5.1.40-bin.jar /opt/confluence/confluence/WEB-INF/lib/

- 切换到confluence用户并启动jira工程

su confluence
cd /opt/confluence/bin/
./start-confluence.sh
“`

  • 浏览器中输入 http://172.25.0.107:8090/即可进入confluence的安装界面
  • 点击“generate an evaluation license online”链接,去官网注册个账号并申请试用license,如下图:
  • 获取license后,拷贝到安装页面对应输入框,下一步,选择“production installation”,点击下一步
  • 在页面选择的external database 为“mysql”,点击下一步
  • 选择direct jdbc接口,点击下一步
  • 填写mysql连接相关的用户名、密码和URL,注意URL要修改成页面提示的那样,在末尾加上 &useUnicode=true&characterEncoding=utf8,回车后创建数据库需要几分钟
  • 创建完成数据库后选择建立example site,
  • 集成jira和confluence,下图中选择connect to jira,输入jira的管理员密码后,修改用户组为jira-software-user,点击next即可完成jira和confluence的集成。

你可能感兴趣的:(Agile)