Apache和MySQL及依赖包安装
sudo apt-get install apache2 mysql-server mysql-client libapache2-mod-perl2 libapache2-mod-perl2-dev libapache2-mod-perl2-doc perl postfix make gcc g++
MySQL设置
# mysql -u root -p
# password: (You'll need to enter your password)
# mysql > create database bugs;
# mysql > grant all on bugs.* to root@localhost identified by "mypassword";
# mysql > quit
如果出现mysql-config错误,补充安装
apt-get install libmysqld-dev
apt-get install libmysqlclient-dev
Bugzilla下载
wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-x.x.x.tar.gz
将上方x替换为所需bugzilla的版本号
本文均基于bugzilla5.1.1
可从官方网站http://www.bugzilla.org/download/下载或确定所需版本号
从下载下来的bugzilla压缩包中提取文件并重命名:
tar zxvf bugzilla-4.5.2.tar.gz -C /var/www/html/
cd /var/www/html/
mv -v bugzilla-4.5.2 bugzilla
YAML补全(不一定需要,若第二步报错则可返回安装)
下载网址:https://metacpan.org/release/MSTROUT/YAML-0.84/view/lib/YAML.pm
cd /var/www/html/bugzilla/
perl checksetup.pl
显示示例如下:
* This is Bugzilla 5.1.1 on perl 5.22.1
* Running on Linux 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016
Checking for CGI (4.09) ok: found v4.26
Checking for DBI (1.614) not found
Checking for Date::Format (2.23) ok: found v2.24
Checking for DateTime (0.75) not found
Checking for DateTime::TimeZone (1.64) not found
Checking for Digest::SHA (any) ok: found v5.95
Checking for Email::MIME (1.904) not found
Checking for Email::Sender (1.300011) not found
Checking for ExtUtils::MakeMaker (6.55) ok: found v7.04_01
Checking for File::Slurp (9999.13) not found
Checking for JSON::XS (2.01) not found
Checking for List::MoreUtils (0.32) ok: found v0.413
Checking for Math::Random::ISAAC (v1.0.1) not found
Checking for Template (2.24) not found
Checking for URI (1.55) ok: found v1.71
Checking for perl (5.014000) ok: found v5.022001
*** Installation aborted. Read the messages above. ***
输入
perl -MCPAN -e shell ......进入命令行,初次进入会有config设置,不选择automatic(no),manually和sudo选择sudo,接下来大部分可以直接一路回车默认
如果需要改动config设置,输入上条命令后输入:o conf init 再次设定
Looking for CPAN mirrors near you (please be patient) .......................... done! //这一步寻找国内镜像
耐心等,祈祷网好
再输入
install DBD::mysql
补全DBI模块
按照
install+模块名称在命令行内补全所有模块
执行perl checksetup.pl
生成一个localconfig
文件
vi localconfig 修改db_driver(一般为mysql) db_name db_user db_pass
此时如果忘了db设置:
sudo vi /etc/mysql/debian.cnf
即可进入查询修改
修改Apache相关
vi /etc/apache2/apache2.conf
添加如下内容:
<Directory /var/www/html/bugzilla>
AddHandler cgi-script .cgi
Options +Indexes +ExecCGI
DirectoryIndex index.cgi
AllowOverride all
Require all granted
</Directory>
ServerName localhost
DirectoryIndex index.html index.htm index.php index.cgi
添加cgi.load
到mods-enabled
,使用命令创建cgi
模块的软链接:
ln -s ../mods-available/cgi.load cgi.load
再
vi /var/www/html/bugzilla/.htacess
用#注释掉Options -Indexes这一行
修改文件权限
cd /var/www/html
chmod 777 -R bugzilla
/etc/init.d/apache2 restart
/etc/init.d/mysql restart
在浏览器输入localhost/bugzilla或者非服务器端输入服务器地址/bugzilla出现bugzilla首页即为完成