2013年10月24日 星期四

[研究] Mantis Bug Tracker 1.2.15 安裝 (CentOS 6.4 x64)

[研究] Mantis Bug Tracker 1.2.15 螳螂除錯管理追蹤工具安裝 (CentOS 6.4 x64)

2013-10-24 初稿
2014-01-07 修訂

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.15/mantisbt-1.2.15.tar.gz/download
tar xzvf mantisbt-1.2.15.tar.gz  -C  /var/www/html
mv  /var/www/html/mantisbt-1.2.15  /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.69 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

(下圖)


(下圖)


(下圖) 第一次登入可用預設帳號 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


******************************************************************************************
PS:如果您想用 Web 介面設定中文化 (不建議),方法如下,每個專案要個別設定,而且 login 畫面仍是英文。

(下圖) 點選 My Account,點選 Preferences



(下圖) Language 切換為 chinese_traditional,按下 Update Prefs 按鈕

(下圖) 警告前一畫面沒有選擇專案 (Project),那就來建立專案吧

(下圖) 點選 Manage,點選 Manage Projects

(下圖) 按下 Create New Project 按鈕

(下圖) 輸入專案名稱,例如 Project1,按下 Add Project 按鈕

(下圖) 會出現 security token,不理會

(下圖) 按下 Manage

(下圖) 按下 Manage Projects,可以看到專案列表有 Project1,表示有建立

(下圖) 按下 Manage Users,按下 administrator

(下圖) Default Project 欄位會自動顯示目前唯一的專案 Project1


(下圖) Language 選 chinese_traditional,按下 Update Prefs 按鈕

(下圖) 按下 Processed

(下圖) 介面變成繁體中文了

(下圖) 登入畫面仍是英文

另外新建帳號時候,發現預設的語系(Language) 仍是 English,也就是每位使用者必須自己切換為繁體中文介面,有點不方便。

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

CREATE DATABASE mantis CHARACTER SET utf8 ;

CREATE DATABASE mantis CHARACTER SET utf8 COLLATE utf8_general_ci;

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

CREATE DATABASE mantis; 

使用部分就不多說了。

(完)

2 則留言:

  1. ....你方法太複雜
    直接在config_inc.php裡面,加入或修改$g_default_language = 'chinese_traditional';即可

    回覆刪除