最新修改部分错误及增加一些内容http://www.linuxpf.com.cn/bbs/vi
... &extra=page%3D1进入公司第一件事情就是搭建一个版本控制环境,为公司软件开发团队提供方便,由于以前从来没有接确,在查找资料的时候走了很多弯路,故记录于此,希望可以给刚接触SVN,jira的朋友带来帮助!
其实LINUX工作并不难,重要的是细心和耐心,每个人的情况并不一样,所以安装过中会有许多问题,凡事说起来容易,但做起来难!这些安装过程相信大家将会体会,不正确的地方,请大家指点并改正,更多文章:
=================================================================================
本文预期效果:
创建基于apache的svn服务器,采用JIRA用户数据库,真正实行单点认证,便于实际工作中管理。同时JIRA中能够很好集成SVN,很简单地通过viewvc查看相应版本的改动,只需在客户端更新文件并在提交过程中在messages指定相应KEY
平台:centos4.6
定制软件
apache2.0.53
svn1.4.2
mysql5.0.69
jira 3.12.3
viewvc1.0
jdk-1_5_0_08
由于本文SVN,APACHE不是重点,估采用YUM
yum install httpd httpd-devel gcc gcc-c++ zlib zlib-devel
注:由于安装软件众多,考虑速度问题,本人事先已经下载到FTP服务器上:相关文件自己到官方下载:
step1:安装JIRA配置java环境
下载JDK:
wget
ftp://192.168.123.99/soft/jdk-1_5_0_08-linux-i586-rpm.bin
#sh jdk-1_5_0_08-linux-i586-rpm.bin
设置环境变量
#vi /etc/profile在文件末尾加入以下内容:
JAVA_HOME=/usr/java/jdk1.5.0_08
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME
export PATH
export CLASSPATH
#logout
[root@jirasvn ~]# echo $JAVA_HOME
/usr/java/jdk1.5.0_08
[root@jirasvn ~]# java -version
java version "1.5.0_08"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.5.0_08-b03)
Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed
mode, sharing)
[root@jirasvn ~]#
step2:下载JIRA并安装MYSQL
最新版本JIRA3.12.3,由于JIRA默认是采用HSQL,本文采用MYSQL数据库方式,便于与其它数据库管理!
下载mysql:
wget
ftp://192.168.123.99/soft/MySQL- ... 67-0.rhel4.i386.rpm
wget
ftp://192.168.123.99/soft/MySQL- ... 67-0.rhel4.i386.rpm
wget
ftp://192.168.123.99/soft/mysql-connector-java-3.1.14.tar.gz
wget
ftp://192.168.123.99/soft/MySQL- ... 67-0.rhel4.i386.rpm
wget
ftp://192.168.123.99/soft/atlass
... 3-standalone.tar.gz
[root@jirasvn soft]# rpm -ivh
MySQL-shared-community-5.0.67-0.rhel4.i386.rpm
warning: MySQL-shared-community-5.0.67-0.rhel4.i386.rpm:
V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing...
###########################################
[100%]
1:MySQL-shared-community ###########################################
[100%]
[root@jirasvn soft]# rpm -ivh MySQL-client-community-5.0.67-0.rhel4.i386.rpm
warning: MySQL-client-community-5.0.67-0.rhel4.i386.rpm:
V3 DSA signature: NOKEY, key ID 5072e1f5
error: Failed dependencies:
perl(DBI) is
needed by MySQL-client-community-5.0.67-0.rhel4.i386
Suggested resolutions:
/home/buildcentos/CENTOS/en/4.0/i386/CentOS/RPMS/perl-DBI-1.40-8.i386.rpm
[quote]
提示缺少perl-DBI
于是[quote]
[root@jirasvn soft]# yum install perl-DBI
[root@jirasvn soft]# rpm -ivh
MySQL-client-community-5.0.67-0.rhel4.i386.rpm
warning: MySQL-client-community-5.0.67-0.rhel4.i386.rpm:
V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing...
###########################################
[100%]
1:MySQL-client-community ###########################################
[100%]
[root@jirasvn soft]# rpm -ivh MySQL-server-community-5.0.67-0.rhel4.i386.rpm
warning: MySQL-server-community-5.0.67-0.rhel4.i386.rpm:
V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing...
###########################################
[100%]
1:MySQL-server-community ###########################################
[100%]
step3:安装jira
#tar -zxvf atlassian-jira-enterprise-3.12.3-standalone.tar.gz
#mv atlassian-jira-enterprise-3.12.3-standalone /home/jira
[root@jirasvn soft]# cd /home/jira
[root@jirasvn jira]# ls
atlassian-jira common external-source logs
README.html server temp
webapps
bin
conf licenses
NOTICE README.txt shared tomcat-docs work
1.修改JIRA配置文件Configure your application server to connect
to MySQL
由于采用mysql,估计稍作一些修改,修改备份该文件
cp server.xml server.xml.bak这样修改后可以对比一下,就能够发现那里有问题!
修改
#vi /home/jira/conf/server.xml
<Context
path="" docBase="${catalina.home}/atlassian-jira"
reloadable="false">
<Resource
name="jdbc/JiraDS" auth="Container"
type="javax.sql.DataSource"
username="jirauser"
password="jira"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/jiradb?autoReconnect=true&useUnicode=true&characterEncoding=UTF8"
/>
[quote]
[quote]
<Server port="8005" shutdown="SHUTDOWN">
<Service name="Catalina">
<Connector port="8080"
maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25"
maxSpareThreads="75"
enableLookups="false"
redirectPort="8443" acceptCount="100"
c disableUploadTimeout="true"
/>
<Engine name="Catalina"
defaultHost="localhost">
<Host name="localhost"
appBase="webapps" unpackWARs="true"
autoDeploy="true">
<Context
path="" docBase="${catalina.home}/atlassian-jira"
reloadable="false">
<Resource
name="jdbc/JiraDS" auth="Container"
type="javax.sql.DataSource"
username="[enter
db username]"
password="[enter
db password]"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/jiradb?autoReconnect=true&useUnicode=true&characterEncoding=UTF8"
[
delete the minEvictableIdleTimeMillis and timeBetweenEvictionRunsMillis
params here ]
/>
<Resource
name="UserTransaction" auth="Container"
type="javax.transaction.UserTransaction"
factory="org.objectweb.jotm.UserTransactionFactory"
jotm.timeout="60"/>
<Manager
className="org.apache.catalina.session.PersistentManager"
save/>
</Context>
</Host>
</Engine>
</Service>
</Server>
修改后对比文件!
[root@jirasvn conf]# diff server.xml.bak
server.xml
14,20c14,18
<
username="sa"
<
password=""
<
driverClassName="org.hsqldb.jdbcDriver"
<
url="jdbc:hsqldb:${catalina.home}/database/jiradb"
<
minEvictableIdleTimeMillis="4000"
<
timeBetweenEvicti
<
maxActive="20" />
---
>
username="jirauser"
>
password="jira"
>
driverClassName="com.mysql.jdbc.Driver"
>
url="jdbc:mysql://localhost/jiradb?autoReconnect=true&useUnicode=true&characterEncoding=UTF8"
>
/>
[root@jirasvn conf]#
修改要细心,以免自己误操作,而导致没有必要的错误!
url="jdbc:mysql://localhost/jiradb?autoReconnect=true&useUnicode=true&characterEncoding=UTF8
中要注意修改自己的相应路径这里采用数据库jiradb
2.Configure the JIRA Entity Engine
Edit atlassian-jira/WEB-INF/classes/entityengine.xml (if
you are using JIRA Standalone) or edit-webapp/WEB-
INF/classes/entityengine.xml (JIRA WAR/EAR), and change
the field-type-name attribute to mysql. (If you forget
to do this and
start JIRA, it may create database tables incorrectly.
See this page if this happens to you.) Also delete the
schema-
name="PUBLIC" attribute, if it exists:
编辑atlassian-jira/WEB-INF/classes/entityengine.xml文件定位100行,修改为myql,且删除
schema-name="PUBLIC"
[root@jirasvn jira]# cd atlassian-jira/WEB-INF/classes/
[root@jirasvn classes]# ls |grep entity
entitydefs
entityengine.xml
[root@jirasvn classes]# vi entityengine.xml
<!-- DATASOURCE - You will
need to update this tag for your installation.
-->
<datasource name="defaultDS"
field-type-name="mysql"
[ delete
this, if it exists: schema-name="PUBLIC"
]
helper-class="org.ofbiz.core.entity.GenericHelperDAO"
check-on-start="true"
use-foreign-keys="false"
...
[quote]
3.创建数据库
[quote]
[root@jirasvn jira]# mysqladmin -u root password yourpassword
[root@jirasvn jira]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands
end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.67-community MySQL Community Edition
(GPL)
Type 'help;' or '\h' for help. Type '\c' to clear
the buffer.
mysql>
注意修改数据库格式为utf-8,创建用户jira,密码为jira,授予查看数据库权限
mysql> create database jiradb character set utf8;
mysql>create user jirauser identified by 'jira';
mysql> grant all privileges on *.* to 'jirauser'@'%'
identified by 'jira' with grant option;
mysql> grant all privileges on *.* to 'jirauser'@'localhost'
identified by 'jira' with grant option;
mysql> flush privileges;
验证下:
mysql> quit
Bye
[root@jirasvn jira]# mysql -u jirauser -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| jiradb
|
| mysql |
| test
|
+--------------------+
4.拷贝MYSQL驱动程序:
下载地址:http://www.mysql.com/products/connector/j/
注意的是下载3.11以下老版本,可能会出现问题
1. Download the
MySQL Connector/J JDBC driver, eg. version 3.1.12
(tar.gz or zip) which we have verified to work. NOTE:
the older 3.1.11 driver is broken.
Note
A user has reported encountering
problems using the Resin JDBC driver for MySQL. However,
the Connector/J driver from
MySQL works correctly (except for version 3.1.11).
2. Add the MySQL JDBC driver jar (mysql-connector-java-3.x.x-bin.jar)
to the common/lib/ directory. NOTE: Do not place the
Debug Driver (mysql-connector-java-3.x.x-bin-g.jar)
on the CLASSPATH as this can cause issues (JRA-8674).
[quote]
5.创建用户,以后用此用户启动JIRA
#useradd jira
# passwd jira
Changing password for user jira.
New UNIX password:
BAD PASSWORD: it is too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@jirasvn home]# chown -R jira.jira jira
[root@jirasvn home]# ls -al
total 48
drwxr-xr-x 5 root root 4096
Sep 9 15:48 .
drwxr-xr-x 23 root root 4096
Sep 9 15:19 ..
drwxr-xr-x 15 jira jira 4096
Sep 9 16:08 jira
drwx------ 2 root root 16384 Sep 9 2008
lost+found
drwxr-xr-x 3 root root 4096
Sep 9 16:06 soft
[root@jirasvn home]#
6.编写自启动脚本
[quote]
[root@jirasvn bin]# cd /etc/rc.d/init.d/
[root@jirasvn init.d]# vi jira
#!/bin/bash
# Jira startup script
RUN_AS_USER=jira
CATALINA_HOME=/home/jira/
start() {
echo "Starting
Jira: "
if [ "x$USER"
!= "jira" ]; then
su - $RUN_AS_USER
-c "$CATALINA_HOME/bin/startup.sh"
else
$CATALINA_HOME/bin/startup.sh
fi
echo "done."
}
stop() {
echo "Shutting
down Jira: "
if [ "x$USER"
!= "x$RUN_AS_USER" ]; then
su - $RUN_AS_USER
-c "$CATALINA_HOME/bin/shutdown.sh"
else
$CATALINA_HOME/bin/shutdown.sh
fi
echo "done."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 10
#echo "Hard
killing any remaining threads.."
#kill -9 `cat
$CATALINA_HOME/work/catalina.pid`
start
;;
*)
echo "Usage:
$0 {start|stop|restart}"
esac
exit 0
保存后退出
#chmod +x jira
# ln -s /etc/rc.d/init.d/jira /etc/rc.d/rc3.d/S89jira
# ln -s /etc/rc.d/init.d/jira /etc/rc.d/rc3.d/K89jira
这样以后就能够在文体模式自启动了!
记得
#chown -R jira.jira jira/
7.现在可以启动JIRA
[root@jirasvn jira]# /etc/rc.d/init.d/jira start
Starting Jira:
If you encounter issues starting up JIRA Standalone Edition,
please see the Troubleshooting guide at
http://confluence.atlassian.com/ ... oubleshooting+Guide
Using CATALINA_BASE: /home/jira
Using CATALINA_HOME: /home/jira
Using CATALINA_TMPDIR: /home/jira/temp
Using JRE_HOME: /usr/java/jdk1.5.0_08
done.
[root@jirasvn jira]#
8.在浏览器中输入192.168.123.70:8080
无法显示,防火墙阻止:
#iptables -I INPUT -p tcp --dport 8080
-j ACCEPT
如果仍然无法打开,请查看日志文件
#tail /home/jira/logs/catalina.out
正常就会出现:下图
申请一个试用注册码,关于破解本人不是重点,企业强烈要求购买,反正也不贵
jira license key:
mrPntaCPMgvChDaqIAmBAckHmQTXXopncpCKpvFMDOkwav
mi2KjrsUnQ>JPXPaA<FFCwgj2KgJRyoJo4M7pddI2V6Xhn
pqMxTOQRmmonqQmnPPtWRmNMpqPPQrnrQVvSSsxVxVtxom
nUUnonvupnvqnoppUUnonvupnvqnoppUUifkrucXkp
9.关于设置向导参考官方手册:
http://www.atlassian.com/software/jira/docs/v3.13/setup.html
如果有问题请到论坛来讨论!
如图:
|