NotePublic/Software/Applications/BugZilla/Ubuntu_18.04_安装和配置_BugZilla.md

91 lines
2.1 KiB
Markdown

# Ubuntu 18.04 安装和配置 BugZilla
## 安装基本环境
```bash
apt install wget vim build-essential apache2 mysql-server libmysqld-dev libmysqlclient-dev libnet-ssleay-perl libcrypt-ssleay-perl libapache-asp-perl mysql-server mysql-client pkg-config libgd-dev
# 开启相关服务
service apache2 start
service mysql start
```
## 配置 MySQL
```bash
# 配置 MySQL
$ mysql_secure_installation
Enter current password for root (enter for none):[password]
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] n
Reload privilege tables now? [Y/n] Y
# 创建 BugZilla 用户和表
$ mysql -u root -p
mysql> CREATE DATABASE bugs;
mysql> CREATE USER 'bugs'@'%' IDENTIFIED BY 'password';
mysql> GRANT ALL ON bugs.* TO 'bugs'@'%' IDENTIFIED BY 'password';
mysql> FLUSH privileges;
mysql> quit;
# 重启 MySQL 服务
$ service mysql restart
```
## 下载和安装 BugZilla
```bash
# 下载和解压
wget https://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-5.0.6.tar.gz
tar -xvf bugzilla-5.0.6.tar.gz -C ./
mv bugzilla-5.0.6 /var/www/html/bugzilla
chown www-data:www-data -R /var/www/html/bugzilla
cd /var/www/html/bugzilla
# 安装所有缺失的依赖
perl install-module.pl --all
```
修改服务器目录下的 localconfig 文件,以对 BugZilla 服务器进行配置,主要修改的位置有:
```bash
$webservergroup = 'www-data';
$db_driver = 'mysql';
$db_host = 'localhost';
$db_name = 'bugs';
$db_user = 'bugs';
$db_pass = 'password';
$db_port = 3306;
```
配置完成后,运行 checksetup.pl 完成服务器的配置安装:
```bash
# 安装 BugZilla
perl checksetup.pl
```
## 配置 Apache2
修改 /etc/apache2/apache2.conf 文件,在 Directory 段加入:
```bash
<Directory /var/www/html/>
AddHandler cgi-script .cgi
Options +ExecCGI
DirectoryIndex index.cgi index.html
AllowOverride All
</Directory>
```
然后,需要开启 Apache2 的以下模块:
```bash
ln -s /etc/apache2/mods-available/cgi.load cgi.load
a2enmod cgi headers expires
```
最后通过以下命令开启 MySQL 和 Apache2 服务:
```bash
service mysql start
service apache2 start
```