1.安装和配置 MySQL

1.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/lib64/libevent-2.0.so.5

#ln -s /usr/local/lib/libevent-2.0.so.5  /usr/lib/libevent-2.0.so.5

 

1.2安装cmake

# tar zxvf  cmake-2.8.9tar.gz

# cd cmake-2.8.9

# ./bootstrap

# make && make install

1.3 建立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

1.4 安装配置

# 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=system -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=/tmp/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

1.5 初始化数据库

# /data/mysql/scripts/mysql_install_db --basedir=/data/mysql/ --user=mysql --datadir=/data/db/mysql_data/

1.6修改配置文件 

#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

1.7 后台启动

# 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 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.

1.8添加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

# vim /etc/ld.so.conf

/data/mysql/lib

# ldconfig -v |grep mysql

/data/mysql/lib:

libmysqlclient.so.18 -> libmysqlclient_r.so.18.0.0

1.9 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";

1.10 创建bugzilla数据库和用户

创建数据库bugs

create database bugs;

show databases;

use bugs;

创建用户bugs

grant select,insert,update,delete,index,alter,create,lock tables,drop,references on bugs.* to bugs@localhost identified by '123456';

flush privileges;

2. 安装和配置Apache

2.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.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

2.3 启动HTTP服务

[root@localhost opt]#service httpd start

安装完毕,启动httpd,输入“http://ip”能看到“it works”证明成功。

3. 安装和配置Bugzilla

3.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

3.2 安装perl模块

由于默认的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"'

安装需要把Apacheapxs路径:/data/apache2/bin/apxs

#cd /data/apache2/htdocs/bugzilla

#./checksetup.pl

进行插件检查和导入数据库,添加登陆用户,设置登陆密码,生产localconfig文件。

3.3配置启动apache

httpd.conf 中添加(或者去除注释)以下这一行:

AddHandler cgi-scrīpt .cgi

httpd.conf DirectoryIndex 那一行,修改为:

DirectoryIndex index.html index.html.var index.cgi

 指定Bugzilla的访问目录,在最后添加:

<Directory /var/www/html/bugzilla>

AddHandler cgi-script .cgi

Options +Indexes +ExecCGI

DirectoryIndex index.cgi

AllowOverride Limit FileInfo Indexes

</Directory>

3.4 配置bugzilla

#cd /data/apache2/htdocs/bugzilla

#vi localconfig

根据数据库的实际情况修改如下参数:

$db_name = 'bugs';

$db_user = 'bugs';

$db_pass = '123456';

$db_port = 3306;

$db_sock = '/tmp/mysqld.sock';

$index_html = 1;

3.5 修改目录权限,登陆bugzilla

# chmod 777 bugzilla

在浏览器输入:http://XXX.XXX.XXX.XXX/bugzilla

输入用户名和密码,登陆bugzilla