最近在公司搭建了一个mantisBT,网上那些教程讲的看完以后感觉并不是那么实用,所有自己又整理了一份。mantisbt有以下优点:
- 开源、 免费;
- 可与开源的testlink集成,便于统计bug的用例发现率;
- 具有bug关联功能;
- 权限设置灵活,不同角色有不同权限;
- 具有邮件通知功能,每个用户可根据自身的工作特点只订阅相关缺陷状态邮件;
- 提供多维度,多种表现形式的统计数据;
软件环境:
- CentOS 6.5 ;
- MantisBT-1.2.18 ;
- xampp-linux-x64-5.6.3 ;
注:xampp能快速搭建LAMP环境,提高部署效率。
1. xampp环境搭建
1.1. 下载xampp安装包
[root@localhost ~]#cd /tmp |
执行命令(也可以访问http://sourceforge.net/projects/xampp/files/XAMPP%20Linux下载到本地后使用rz命令上传):
[root@localhost tmp]#wget http://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5.6.3/xampp-linux-x64-5.6.3-0-installer.run |
执行过程:
ttp://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5.6.3/xampp-linux-x64-5.6.3-0-installer.run Resolving sourceforge.net... 216.34.181.60 Connecting to sourceforge.net|216.34.181.60|:80... connected. 。。。。。。。 Connecting to jaist.dl.sourceforge.net|150.65.7.130|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 128831805 (123M) [application/x-makeself] Saving to: “xampp-linux-x64-5.6.3-0-installer.run” 100%[=============================================================================================================================>] 128,831,805 4.06M/s in 26s 2015-01-27 21:49:31 (4.71 MB/s) - “xampp-linux-x64-5.6.3-0-installer.run” saved [128831805/128831805] |
1.2. 安装xampp
执行命令:
[root@localhost tmp]#chmod +x xampp-linux-x64-5.6.3-0-installer.run ./xampp-linux-x64-5.6.3-0-installer.run |
执行过程,交互的过程如粗体部分。
---------------------------------------------------------------------------- Welcome to the XAMPP Setup Wizard. ---------------------------------------------------------------------------- Select the components you want to install; clear the components you do not want to install. Click Next when you are ready to continue.
XAMPP Core Files : Y (Cannot be edited) XAMPP Developer Files [Y/n] :y Is the selection above correct? [Y/n]: y ---------------------------------------------------------------------------- Installation Directory XAMPP will be installed to /opt/lampp Press [Enter] to continue: ---------------------------------------------------------------------------- Setup is now ready to begin installing XAMPP on your computer. Do you want to continue? [Y/n]: y ---------------------------------------------------------------------------- Please wait while Setup installs XAMPP on your computer. Installing 0% ______________ 50% ______________ 100% ######################################### ---------------------------------------------------------------------------- Setup has finished installing XAMPP on your computer. |
1.3. 配置xmapp安全策略
[root@localhost tmp]# cd /opt/lampp/htdocs/ |
执行命令:
[root@localhost htdocs]#/opt/lampp/xampp security |
执行内容, 交互的过程如粗体部分。
XAMPP: Quick security check... XAMPP: Your XAMPP pages are NOT secured by a password. XAMPP: Do you want to set a password? [yes] yes XAMPP: Password: XXXXX XAMPP: Password (again): XAMPP: Password protection active. Please use 'xampp' as user name! XAMPP: MySQL is accessable via network. XAMPP: Normaly that's not recommended. Do you want me to turn it off? [yes] y XAMPP: Turned off. XAMPP: MySQL has to run before I can check the security. XAMPP: MySQL has to run before I can check the security. XAMPP: MySQL has a root passwort set. Fine! :) XAMPP: The FTP password for user 'daemon' is still set to 'xampp'. XAMPP: Do you want to change the password? [yes] yes XAMPP: Password: XXXXX XAMPP: Password (again): XAMPP: Reload ProFTPD...not running. XAMPP: Done. |
至此,LAMP环境搭建完成。
1.4. 运维xampp
1. 设置xampp开机自启,执行以下命令:
[root@localhost ~]# ln -s /opt/lampp/lampp /etc/rc.d/rc3.d/S99lampp [root@localhost ~]# ln -s /opt/lampp/lampp /etc/rc.d/rc4.d/S99lampp [root@localhost ~]# ln -s /opt/lampp/lampp /etc/rc.d/rc5.d/S99lampp |
2. 查看xampp运行状态
[root@localhost ~]# /opt/lampp/lampp start #启动lampp [root@localhost ~]# /opt/lampp/lampp stop #停止lampp [root@localhost ~]# /opt/lampp/lampp restart #重启lampp [root@localhost ~]# /opt/lampp/lampp status #查看状态 |
1.5. 修改端口号
安装完xampp启动时可能会遇到
[root@localhost lampp]# /opt/lampp/lampp start Starting XAMPP for Linux 5.6.38-0... XAMPP: Starting Apache... not running. XAMPP: Starting MySQL...ok. XAMPP: Starting ProFTPD...ok. |
这个情况就是Apache启动失败。这种情况大部分是因为端口号80被占用了。
1. 打开文件/opt/lampp/etc/httpd.conf
[root@localhost ~]# vi /opt/lampp/etc/httpd.conf |
2. 搜索“Listen 80”并将其更改为其他端口(例如,Listen 8080)(大概是第40行)
/ Listen 80(直接输入后回车就搜索到了,再按insert键修改)(修改完按esc键推出编辑,输入:wq!按回车) |
3. 打开文件/opt/lampp/etc/extra/httpd-ssl.conf
[root@localhost ~]#vi /opt/lampp/etc/extra/httpd-ssl.conf |
4.搜索“Listen 443”并将其改为其他端口(例如,Listen 8443)(大概是第39行)
/ Listen 80(直接输入后回车就搜索到了,再按insert键修改)(修改完按esc键推出编辑,输入:wq!按回车) |
5.打开"/opt/lampp/lampp"
[root@localhost ~]#vi /opt/lampp/lampp |
6. 搜索端口“testport 80”改为“testport 8080”,在搜索端口“testport 443”改为“testport 8443”(大概在197和214行)
7.运行重启xampp
[root@localhost ~]# /opt/lampp/lampp restart |
2. 安装部署mantisbt
2.1. 安装mantisbt
2.1.1. 下载mantisbt
[root@localhost ~]# cd /tmp |
1. 执行命令,获取mantisbt的安装包,也可以访问http://sourceforge.net/projects/mantisbt/files/mantis-stable下载到本地后使用rz命令上传:
[root@localhost tmp]# wget http://sourceforge.net/projects/mantisbt/files/mantis-stable/1.2.18/mantisbt-1.2.18.tar.gz |
2. 解压mantisbt的压缩包,执行命令
[root@localhost tmp]# tar –zxvf mantisbt-1.2.18.tar.gz |
2.1.2. 部署mantisbt
1. 执行命令(将mantisbt移动到lampp下并重命名)
[root@localhost tmp]# mv /tmp/mantisbt-1.2.18 /opt/lampp/htdocs/mantisbt |
2.1.3. 创建mantisbt的数据库
1. 访问http://IP:端口/mantisbt/index.php,自动跳转到http://IP:端口/mantisbt/admin/install.php页面,在该页面建立mantisbt的数据库;
2. 在以下页面,root的密码为“ ”,直接点击“INSTALL/update database”即可。
3. 数据库创建成功,通过http://IP:端口/phpmyadmin/,可查看bugtracker数据库的创建情况。
2.2. 配置mantisbt
2.2.1. 配置数据库连接
1. [root@localhost mantisbt]#
执行以下命令(如果没有config_inc.php文件可以使用touch config_inc.php创建一个,我的创建完以后就找不到config_inc.php文件):
[root@localhost mantisbt]#cd /opt/lampp/htdocs/mantisbt [root@localhost mantisbt]#touch config_inc.php [root@localhost mantisbt]#vi config_inc.php 修改数据库连接信息 <?php $g_hostname = 'localhost'; $g_db_type = 'mysql'; $g_database_name = 'xx'; #填写设置的数据名称,与2.1.3章节中填写的Database Name一致 $g_db_username = 'xx'; #填写数据库用户名 $g_db_password = 'xx'; #填写数据库密码 ?> |
2. [root@localhost mantisbt]#
2.2.2. Mantisbt汉化
1. 执行命令:
[root@localhost ~]#vi /opt/lampp/htdocs/mantisbt/config_defaults_inc.php 修改:$g_default_language, 将“=”后的english 改为chinese_simplified |
2. 界面更新为中文版
2.2.3. 设置时区
1. 执行命令:
[root@localhost ~]#vi /opt/lampp/htdocs/mantisbt/config_defaults_inc.php 修改为 $g_default_timezone = 'Asia/Shanghai'; |
2. 在个人资料内,点击:更改个人设置,选择时区:shanghai
2.2.4. mantisbt附件设置
1.指定一个上传附件的路径/data/upload新建路径并赋予最高权限
[root@localhost ~]# mkdir /data/upload [root@localhost ~]# chmod -R 777 /data/upload |
2.打开config_inc.php
[root@localhost ~]# vi /opt/lampp/htdocs/mantisbt/config_inc.php
$g_allow_file_upload = ON; $g_file_upload_method = DISK; $g_max_file_size = 50000000;# in bytes(上传文件最大值B为单位) $g_allowed_files = 'txt,jpg,png,jepg,gif,bmp,zip,tar.gz,doc';(上传文件格式) $g_absolute_path_default_upload_folder = '/data/upload/'; # used with DISK, must contain trailing or /.(上传文件保存路径) $g_preview_attachments_inline_max_size=99999999;(预览附件最大值) |