編寫背景:
這幾天開始梳理和總結測試環境維護管理方面的工作,bugzilla和Testlink也該升級了,找了臺機器重新安裝這兩個軟件,先試試;順帶整理相關安裝文檔給測試人員進行安裝學習并錄像,便于以后要用或培訓時可以拿出來分享。放在這里希望對測試新手有幫助。
參考資料:http://3708841.blog.51cto.com/3698841/1020932
安裝環境:redhat enterprise linux 5 + mysql-5.5.27+httpd-2.2.23+bugzilla-4.2.3
安裝方法:編譯安裝
安裝步驟:
一、安裝程序包下載
下載mysql-5.5.27所需的如下安裝文件:
libevent-2.0.20-stable.tar.gz
cmake-2.8.9tar.gz
下載mysql-5.5.27的安裝包:mysql-5.5.27.tar.gz
下載httpd-2.2.23的安裝包:httpd-2.2.23.tar.bz2
下載bugzilla-4.2.3的安裝包:bugzilla-4.2.3.tar.gz
下載bugzilla安裝的相關組件包:DBD-mysql-4.0.22.tar.gz
二、卸載linux安裝后自動安裝上的mysql和httpd所有相關包,具體如下:
1. 用下面命令查看系統自動安裝的mysql和http相關的包有哪些
rpm –qa|grep mysql
rpm –qa|grep http
2. 用下面命令刪除系統自動安裝的mysql和http的包
3. rpm -e –nodeps mysql已經安裝的文件包名
三、安裝mysql并創建bugzilla數據庫
1. 安裝libevent
# tar zxvf libevent-2.0.20-stable.tar.gz
# cd libevent-2.0.20-stable
# ./configure
# make
# make install
# ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5
2. 安裝cmake
安裝前確認系統是否安裝了ncurses包,具體如下:
#rpm -qa|grep ncurses
ncurses-5.5-24.20060715
ncurses-devel-5.5-24.20060715
# tar zxvf cmake-2.8.9tar.gz
# cd cmake-2.8.9
# ./bootstrap
# make
# make install
3. 安裝mysql
1)建立mysql用戶
# groupadd mysql
# useradd -g mysql -s /sbin/nologin mysql
# mkdir -p /data/db/mysql_data
# mkdir -p /data/mysql
# mkdir -p /etc/mysql
# mkdir /data/db/innodb_data/ -p
# mkdir /data/db/mysql_logs/binary_log -p
# mkdir /data/db/mysql_logs/innodb_log -p
# mkdir /data/db/mysql_logs/query_log -p
# mkdir /data/db/mysql_logs/slow_query_log -p
# mkdir /data/db/mysql_logs/error_log -p
# chown mysql. /data/db/* -R
2)安裝配置
# tar zxvf mysql-5.5.27.tar.gz
#cd mysql-5.5.27
# cmake . -DCMAKE_INSTALL_PREFIX=/data/mysql/ -DMYSQL_DATADIR=/data/db/mysql_data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_SSL=bundled -DWITH_ZLIB=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DSYSCONFDIR=/etc/mysql -DMYSQL_TCP_PORT=3306 -DWITH_DEBUG=0 -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysqld.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1
# make && make install
3)初始化數據庫
# /data/mysql/scripts/mysql_install_db --basedir=/data/mysql/ --user=mysql --datadir=/data/db/mysql_data/
4)創建配置文件
#vi /etc/mysql/my.cnf
[client]
#password = [your_password]
port = 3306
socket = /tmp/mysqld.sock
default-character-set=utf8
[mysqld]
wait_timeout=7200
port = 3306
socket = /tmp/mysqld.sock
character_set_server=utf8
basedir=/data/mysql
datadir=/data/db/mysql_data
back_log = 500
log-error=/data/db/mysql_logs/error_log/server.err
max_connections = 1024
max_connect_errors = 10
table_open_cache = 2048
max_allowed_packet = 16M
binlog_cache_size = 1M
max_heap_table_size = 64M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
join_buffer_size = 8M
thread_cache_size = 128
thread_concurrency = 8
query_cache_size = 64M
query_cache_limit = 2M
ft_min_word_len = 4
#default-storage-engine = MYISAM
default-storage-engine = innodb
thread_stack = 192K
transaction_isolation = REPEATABLE-READ
tmp_table_size = 64M
log-bin=/data/db/mysql_logs/binary_log/db-bin
expire_logs_days=10
binlog_format=mixed
#general_log=1
#general_log_file=/data/db/mysql_logs/query_log/query.log
slow_query_log=1
long_query_time = 2
slow_query_log_file=/data/db/mysql_logs/slow_query_log/slow_query.log
server-id = 1
key_buffer_size = 200M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 300M
innodb_data_file_path = ibdata1:100M;ibdata2:100M;ibdata3:100M;ibdata4:100M:autoextend
innodb_data_home_dir=/data/db/innodb_data/
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 8M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_log_group_home_dir=/data/db/mysql_logs/innodb_log
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
open-files-limit = 8192
5)后臺啟動
# cp support-files/mysql.server /etc/init.d/mysqld
# chmod 755 /etc/init.d/mysqld
# vim /etc/init.d/mysqld
basedir=/data/mysql
datadir=/data/db/mysql_data
# /etc/init.d/mysqld start
Starting MySQL……………..[ OK ]
# netstat -an |grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
# vim /etc/profile
用#注釋掉之前的export內容,追加如下內容
export PATH=$PATH:/data/mysql/bin
# source /etc/profile
# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.27-log Source distribution
Copyright (c) 2000, 2012, 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.
6)添加Mysql自啟動服務
# ln -sf /data/mysql/bin/mysql /sbin/mysql
# ln -sf /data/mysql/bin/mysqladmin /sbin/mysqladmin
# chkconfig mysqld on
# chkconfig --level 24 mysqld off
# chkconfig --list mysqld
mysqld 0:off 1:off 2:off 3:on 4:off 5:on 6:off
# vi /etc/ld.so.conf
用#注釋掉文件內容,增加如下內容
/data/mysql/lib
# ldconfig -v |grep mysql
/data/mysql/lib:
libmysqlclient.so.18 -> libmysqlclient_r.so.18.0.0
7)為mysql數據庫root用戶設置密碼
# mysqladmin -uroot password "qwe123"
# mysql –uroot –p
use mysql
Grant all privileges on *.* to 'root'@'%' identified by 'qwe123' with grant option;
flush privileges;
select host, user, password from user;
增加遠程登錄權限
刪除匿名用戶:
delete from user where user=' ';
設置所有root密碼
update user set password=password( "qwe123") where user= "root";
4. 創建bugzilla數據庫和用戶
1)創建數據庫bugs
create database bugs;
show databases;
use bugs;
2)創建用戶bugs
grant select,insert,update,delete,index,alter,create,lock tables,drop,references on bugs.* to bugs@localhost identified by '123456';
flush privileges;
四、安裝httpd
1. 安裝apache
# tar jxvf httpd-2.2.23.tar.bz2
# cd httpd-2.2.23
# ./configure --prefix=/data/apache2 --enable-so --enable-rewrite --enable-vhost-alias=shared --enable-cache=shared --enable-file-cache=shared --enable-disk-cache=shared --enable-mem-cache=shared --enable-proxy=shared --enable-proxy-http=shared --enable-proxy-ajp=shared --enable-proxy-balancer=shared --enable-proxy-connect=shared --enable-dav --enable-dav-fs --disable-proxy-ftp --disable-userdir --disable-asis --enable-ssl --with-mpm=worker
# make
# make install
2. 添加apache自啟動腳本
#cp /data/apache2/bin/apachectl /etc/init.d/httpd
#vi /etc/init.d/httpd
在第三行添加以下兩行內容
#chkconfig:345 85 15
#description: Start and stops the Apache HTTP Server.
[root@localhost opt]#chkconfig httpd on
3. 啟動HTTP服務
[root@localhost opt]#service httpd start
安裝完畢,啟動httpd,輸入“http://ip”能看到“it works”證明成功。
五、安裝bugzilla
1. 安裝bugzilla
# tar zxvf bugzilla-4.2.3.tar.gz
# mv bugzilla-4.2.3 /data/apache2/htdocs/bugzilla
#chmod 777 /data/apache2/htdocs/bugzilla –R
2. 安裝bugzilla所需模塊
由于默認的perl安裝包缺少一些bugzilla需要的模塊,所以需要補充一些模塊,最好是在線進行,不要一個一個的自己安裝。以root身份運行在聯網情況下用以下命令安裝所需的最少perl模塊:
#perl -MCPAN -e 'install "Bundle::Bugzilla"'
Are you ready for manual configuration? [yes] no
of modules we are processing right now? [yes] 敲回車,以后都敲回車!
#/usr/bin/perl install-module.pl -all
# perl -MCPAN -e 'install "mod_perl2"'
安裝需要把Apache的apxs路徑:/data/apache2/bin/apxs
#cd /data/apache2/htdocs/bugzilla
#./checksetup.pl
再次執行安裝相關包命令
# /usr/bin/perl install-module.pl –all
安裝DBD-mysql-4.0.22.tar.gz
# tar zxvf DBD-mysql-4.0.22.tar.gz
# cd DBD-mysql-4.0.22
# perl Makefile.PL --mysql_config=/usr/local/mysql/bin/mysql_config
# make
# make install
# perl -MCPAN -e 'install "mod_perl2"'
安裝需要把Apache的apxs路徑:/data/apache2/bin/apxs
3. 配置bugzilla
#cd /data/apache2/htdocs/bugzilla
#vi localconfig
根據數據庫的實際情況修改如下參數:
$db_name = 'bugs';
$db_user = 'bugs';
$db_pass = '123456';
$db_port = 3306;
$db_sock = '/var/lib/mysql/mysqld.sock';
$index_html = 1;
4. 配置啟動apache
在 httpd.conf 中添加(或者去除注釋)以下這一行:
AddHandler cgi-scrīpt .cgi
到 httpd.conf 中 DirectoryIndex 那一行,修改為:
DirectoryIndex index.html index.html.var index.cgi
指定Bugzilla的訪問目錄,在最后添加:
<Directory /data/apache2/htdocs/bugzilla>
AddHandler cgi-script .cgi
Options +Indexes +ExecCGI
DirectoryIndex index.cgi
AllowOverride Limit FileInfo Indexes
</Directory>
5. 安裝bugzilla數據庫配置和文件權限設置
#cd /data/apache2/htdocs/bugzilla
#./checksetup.pl
開始自動安裝bugzilla數據庫表并設置管理員賬號
# cd /data/apache2/htdocs/
# chmod 777-R bugzilla
編輯hosts文件:
# vi /etc/hosts
增加如下一行
127.0.0.1 localhost.localdomain localhost MYHOST
在瀏覽器輸入:http://XXX.XXX.XXX.XXX/bugzilla,用剛才設置的管理員賬號登陸即可。