2014年8月15日 星期五

[研究] Mantis Bug Tracker 1.2.17 螳螂除錯管理追蹤工具安裝 (CentOS 6.5 x86_64)

[研究] Mantis Bug Tracker 1.2.17 螳螂除錯管理追蹤工具安裝 (CentOS 6.5 x86_64)

2014-08-15

Mantis 是螳螂的意思,Bug 是程式的臭蟲,Tracker 是追蹤,所以這是一套除錯管理追蹤工具。

官方網站
http://www.mantisbt.org/

下載
http://sourceforge.net/projects/mantisbt/files/mantis-stable/1.2.15/mantisbt-1.2.15.tar.gz/download

安裝

# 基本安裝
yum -y install httpd php php-pdo php-mysql php-gd mysql mysql-server php-mbstring
chkconfig httpd on
chkconfig mysqld on
service mysqld restart
service httpd restart

# 設定時區(一定要設定),重新啟動 httpd

/etc/php.ini
找到 ;date.timezone =
下面增加一行
date.timezone = "Asia/Taipei"
重新啟動 httpd 讓設定生效
service httpd restart


sed -i 's/;date\.timezone =/date.timezone = Asia\/Taipei/' /etc/php.ini
cat /etc/php.ini | grep date.timezone
service httpd restart


# 下載解壓 mantis

wget http://sourceforge.net/projects/mantisbt/files/mantis-stable/1.2.17/mantisbt-1.2.17.tar.gz/download  -O    mantisbt-1.2.17.tar.gz
tar xzvf mantisbt-1.2.17.tar.gz  -C  /var/www/html
mv  /var/www/html/mantisbt-1.2.17  /var/www/html/mantis
chown -R apache:apache /var/www/html/mantis

# 設定 MySQL 的 root 密碼 (除 root 帳號的密碼要輸入,其他都按下 Enter,使用預設值)

[root@localhost ~]# /usr/bin/mysql_secure_installation




NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n]
New password:          (設定 root 密碼)
Re-enter new password:    (再設定一次)
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
 ... Success!

Cleaning up...



All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


[root@localhost ~]#


# 建立 Mantis 系統使用的資料庫,稱為 mantis,連線帳號 mantisuser,密碼 123456

[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database mantis;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on mantis.* to mantisuser@localhost identified by '123456';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
[root@localhost ~]#

或 (假設 MySQL 資料庫 root 帳號密碼為 DEFG )
mysql -e "create database mantis; "  -pDEFG
mysql -e "rant all privileges on mantis.* to mantisuser@localhost identified by '123456'; "  -pDEFG
mysql -e "flush privileges; "   -pDEFG


# 設定 Mantis

在瀏覽器裡輸入http://ip/mantis,此時瀏覽器會跳轉到http://ip/mantis/admin/install.php

建議解析度 1024x768

(下圖)




(下圖) 第一次登入可用預設帳號 administrator,預設密碼 root,然後盡快改掉密碼




(下圖) 登入畫面說 Warning : Admin directory should be removed.

(下圖) 執行   rm  -fr   /var/www/html/mantis/admin 刪除 admin 目錄,按下 F5 更新瀏覽器畫面,應該不會有警告了



繁體中文化,可以修改 /var/www/html/mantis/config_inc.php
增加一行  $g_default_language = 'chinese_traditional';

[root@localhost mantis]# vi  /var/www/html/mantis/config_inc.php

<?php
        $g_hostname = 'localhost';
        $g_db_type = 'mysql';
        $g_database_name = 'mantis';
        $g_db_username = 'mantisuser';
        $g_db_password = '123456';
$g_default_language = 'chinese_traditional';
?>

或 (在 g_db_password字串存在的行之後插入一行)
sed -i -e "/g_db_password/a\$g_default_language = 'chinese_traditional';"   /var/www/html/mantis/config_inc.php

或 (直接產生 config_inc.php 內容)
echo "<?php"  > /var/www/html/mantis/config_inc.php
echo "        \$g_hostname = 'localhost';"  >> /var/www/html/mantis/config_inc.php
echo "        \$g_db_type = 'mysql';"  >> /var/www/html/mantis/config_inc.php
echo "        \$g_database_name = 'mantis';"  >> /var/www/html/mantis/config_inc.php
echo "        \$g_db_username = 'mantisuser';"  >> /var/www/html/mantis/config_inc.php
echo "        \$g_db_password = '123456';"  >> /var/www/html/mantis/config_inc.php
echo "        \$g_default_language = 'chinese_traditional';"  >> /var/www/html/mantis/config_inc.php
echo "?>"  >> /var/www/html/mantis/config_inc.php



另外某些文章提到無法輸入中文字的問題,必須指定用 utf8 語系建立資料才行 (如下)

CREATE DATABASE mantis CHARACTER SET utf8 ;

CREATE DATABASE mantis CHARACTER SET utf8 COLLATE utf8_general_ci;

實際測試,目前 MySQL 預設建立的資料庫就是 utf8,不需要特別指定,直接用下面即可

CREATE DATABASE mantis; 

使用部分就不多說了。

(完)

相關

[研究] Mantis Bug Tracker 1.2.17 螳螂除錯管理追蹤工具安裝 (CentOS 6.5 x86_64)
http://shaurong.blogspot.com/2014/08/mantis-bug-tracker-1217-centos-65-x8664.html

[研究] Mantis Bug Tracker 1.2.17 螳螂除錯管理追蹤工具安裝 (CentOS 7.0 x86_64)(失敗)
http://shaurong.blogspot.com/2014/08/mantis-bug-tracker-1217-centos-70-x8664.html

[研究] Mantis Bug Tracker 1.2.15 安裝 (CentOS 6.4 x64)
http://shaurong.blogspot.com/2013/10/mantis-bug-tracker-1215-centos-64-x64.html

[研究] TestLink 1.9.8 測試管理工具安裝 + 繁體中文化 (CentOS 6.4 x64)
http://shaurong.blogspot.com/2013/10/testlink-198-centos-64-x64.html

沒有留言:

張貼留言