Skip to content

Instantly share code, notes, and snippets.

@am0c
Forked from aanoaa/gist:3979758
Created October 30, 2012 11:59
Show Gist options
  • Save am0c/3979793 to your computer and use it in GitHub Desktop.
Save am0c/3979793 to your computer and use it in GitHub Desktop.
bugzilla-install.sh
#!/bin/sh
BZ_ADMIN_EMAIL='<user>@gmail.com'
BZ_ADMIN_PASSWORD='****'
BZ_ADMIN_REALNAME='realname'
BZ_SERVER_NAME='bz4.localhost'
BZ_URLBASE='http://bz4.localhost/'
BZ_APACHE_GROUP='www-data'
BZ_INSTALL_PATH='/home/bugzilla/public_html/bugzilla'
BZ_LOG_ACCESS='${APACHE_LOG_DIR}/bugzilla4-access.log'
BZ_LOG_ERROR='${APACHE_LOG_DIR}/bugzilla4-error.log'
BZ_MYSQL_DATABASE='bugzilla4'
BZ_MYSQL_PASSWORD='bugzilla4'
BZ_MYSQL_ROOT_PASSWORD='****'
BZ_MYSQL_USER='bugzilla4'
BZ_USER='bugzilla'
BZ_VERSION='4.2.3'
#
# Update Package
#
apt-get update
apt-get upgrade
#
# Install Dependency Modules
#
apt-get install \
libapache2-mod-perl2 \
libapache2-mod-perl2-dev \
libgd2-xpm-dev \
libmysqlclient-dev \
make \
mysql-client \
mysql-server \
patchutils \
patchutils \
tmux \
tree \
vim \
libauthen-radius-perl \
libauthen-sasl-perl \
libcgi-pm-perl \
libchart-perl \
libdatetime-perl \
libdatetime-timezone-perl \
libdbd-mysql-perl \
libdbi-perl \
libdigest-sha-perl \
libemail-mime-perl \
libemail-send-perl \
libencode-detect-perl \
libgd-graph-perl \
libgd-text-perl \
libgraphviz-perl \
libhtml-parser-perl \
libhtml-scrubber-perl \
libjson-rpc-perl \
libjson-xs-perl \
liblist-moreutils-perl \
libmath-random-isaac-perl \
libmime-tools-perl \
libnet-ldap-perl \
libsoap-lite-perl \
libtemplate-perl \
libtemplate-plugin-gd-perl \
libtest-taint-perl \
libtheschwartz-perl \
libtimedate-perl \
liburi-perl \
libwww-perl \
libxml-twig-perl
#
# Bugzilla User
#
adduser --gecos="Bugzilla" --disabled-password $BZ_USER
adduser $BZ_USER $BZ_APACHE_GROUP
#
# Apache Setting
#
CWD=`pwd`
cd /etc/apache2/mods-enabled
ln -sf ../mods-available/expires.load
ln -sf ../mods-available/headers.load
cd /etc/apache2/sites-available
cat > $BZ_SERVER_NAME <<END
<VirtualHost *:80>
ServerName $BZ_SERVER_NAME
ServerAdmin $BZ_ADMIN_EMAIL
DocumentRoot $BZ_INSTALL_PATH/
# remove below comment if you want to use with mod_perl
#PerlSwitches -I$BZ_INSTALL_PATH -I$BZ_INSTALL_PATH/lib -w -T
#PerlConfigRequire $BZ_INSTALL_PATH/mod_perl.pl
<Directory "$BZ_INSTALL_PATH">
AddHandler cgi-script .cgi
Options +ExecCGI +FollowSymLinks
DirectoryIndex index.cgi
AllowOverride Limit FileInfo Indexes Options
</Directory>
ErrorLog $BZ_LOG_ERROR
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog $BZ_LOG_ACCESS combined
</VirtualHost>
END
cd /etc/apache2/sites-enabled
rm -rf 000-default
ln -sf ../sites-available/$BZ_SERVER_NAME
service apache2 reload
cd $CWD
#
# MySQL: create user & database
#
mysql -uroot -p"$BZ_MYSQL_ROOT_PASSWORD" <<END
GRANT ALL PRIVILEGES ON $BZ_MYSQL_DATABASE.* TO $BZ_MYSQL_USER@localhost IDENTIFIED by "$BZ_MYSQL_PASSWORD";
DROP DATABASE IF EXISTS $BZ_MYSQL_DATABASE;
CREATE DATABASE $BZ_MYSQL_DATABASE DEFAULT CHARACTER SET utf8;
END
#
# Bugzilla Installation
#
sudo -u $BZ_USER bash -s <<END
INSTALL_DIR=`dirname $BZ_INSTALL_PATH`
INSTALL_BASE=`basename $BZ_INSTALL_PATH`
mkdir -p \$INSTALL_DIR
cd \$INSTALL_DIR
wget -c http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-$BZ_VERSION.tar.gz
tar xvzf bugzilla-$BZ_VERSION.tar.gz
ln -sf bugzilla-$BZ_VERSION \$INSTALL_BASE
cd $BZ_INSTALL_PATH
perl install-module.pl Apache2::SizeLimit
perl install-module.pl Daemon::Generic
perl install-module.pl Email::MIME
perl install-module.pl Email::MIME::Attachment::Stripper
perl install-module.pl Email::Reply
perl install-module.pl PatchReader
cat > bz-answer <<END_ANSWER
\\\$answer{'webservergroup'} = '$BZ_APACHE_GROUP';
\\\$answer{'db_name'} = '$BZ_MYSQL_DATABASE';
\\\$answer{'db_user'} = '$BZ_MYSQL_USER';
\\\$answer{'db_pass'} = '$BZ_MYSQL_PASSWORD';
\\\$answer{'urlbase'} = '$BZ_URLBASE';
\\\$answer{'ADMIN_EMAIL'} = '$BZ_ADMIN_EMAIL';
\\\$answer{'ADMIN_REALNAME'} = '$BZ_ADMIN_REALNAME';
\\\$answer{'ADMIN_PASSWORD'} = '$BZ_ADMIN_PASSWORD';
END_ANSWER
./checksetup.pl bz-answer
./checksetup.pl bz-answer
END
@StasToken
Copy link

Твае говно не ртаботает блять!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment