2.5. UNIX (non-root) Installation Notes

2.5.1. Introduction

If you are running a *NIX OS as non-root, either due to lack of access (web hosts, for example) or for security reasons, this will detail how to install Bugzilla on such a setup. It is recommended that you read through the Section 2.1 first to get an idea on the installation steps required. (These notes will reference to steps in that guide.)

2.5.2. MySQL

You may have MySQL installed as root. If you're setting up an account with a web host, a MySQL account needs to be set up for you. From there, you can create the bugs account, or use the account given to you.

Warning

You may have problems trying to set up GRANT permissions to the database. If you're using a web host, chances are that you have a separate database which is already locked down (or one big database with limited/no access to the other areas), but you may want to ask your system administrator what the security settings are set to, and/or run the GRANT command for you.

Also, you will probably not be able to change the MySQL root user password (for obvious reasons), so skip that step.

2.5.2.1. Running MySQL as Non-Root

2.5.2.1.1. The Custom Configuration Method

Create a file .my.cnf in your home directory (using /home/foo in this example) as follows....


[mysqld]
datadir=/home/foo/mymysql
socket=/home/foo/mymysql/thesock
port=8081

[mysql]
socket=/home/foo/mymysql/thesock
port=8081

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/home/foo/mymysql/the.log
pid-file=/home/foo/mymysql/the.pid
              

2.5.2.1.2. The Custom Built Method

You can install MySQL as a not-root, if you really need to. Build it with PREFIX set to /home/foo/mysql, or use pre-installed executables, specifying that you want to put all of the data files in /home/foo/mysql/data. If there is another MySQL server running on the system that you do not own, use the -P option to specify a TCP port that is not in use.

2.5.2.1.3. Starting the Server

After your mysqld program is built and any .my.cnf file is in place, you must initialize the databases (ONCE).


              bash$
              mysql_install_db
            

Then start the daemon with


              bash$
              safe_mysql &
            

After you start mysqld the first time, you then connect to it as "root" and GRANT permissions to other users. (Again, the MySQL root account has nothing to do with the *NIX root account.)

Note

You will need to start the daemons yourself. You can either ask your system administrator to add them to system startup files, or add a crontab entry that runs a script to check on these daemons and restart them if needed.

Warning

Do NOT run daemons or other services on a server without first consulting your system administrator! Daemons use up system resources and running one may be in violation of your terms of service for any machine on which you are a user!

2.5.3. Perl

On the extremely rare chance that you don't have Perl on the machine, you will have to build the sources yourself. The following commands should get your system installed with your own personal version of Perl:


        bash$
        wget http://perl.com/CPAN/src/stable.tar.gz
        bash$
        tar zvxf stable.tar.gz
        bash$
        cd perl-5.8.1 (or whatever the version of Perl is called)
        bash$
        sh Configure -de -Dprefix=/home/foo/perl
        bash$
        make && make test && make install
      

Once you have Perl installed into a directory (probably in ~/perl/bin), you'll have to change the locations on the scripts, which is detailed later on this page.

2.5.4. Perl Modules

Installing the Perl modules as a non-root user is probably the hardest part of the process. There are two different methods: a completely independant Perl with its own modules, or personal modules using the current (root installed) version of Perl. The independant method takes up quite a bit of disk space, but is less complex, while the mixed method only uses as much space as the modules themselves, but takes more work to setup.

2.5.4.1. The Independant Method

The independant method requires that you install your own personal version of Perl, as detailed in the previous section. Once installed, you can start the CPAN shell with the following command:


            bash$
            /home/foo/perl/bin/perl -MCPAN -e 'shell'
          

And then:


            cpan>
            install Bundle::Bugzilla
          

With this method, module installation will usually go a lot smoother, but if you have any hang-ups, you can consult the next section.

2.5.4.2. The Mixed Method

First, you'll need to configure CPAN to install modules in your home directory. The CPAN FAQ says the following on this issue:


5)  I am not root, how can I install a module in a personal directory?

    You will most probably like something like this:

      o conf makepl_arg "LIB=~/myperl/lib \
                         INSTALLMAN1DIR=~/myperl/man/man1 \
                         INSTALLMAN3DIR=~/myperl/man/man3"
    install Sybase::Sybperl

    You can make this setting permanent like all "o conf" settings with "o conf commit".

    You will have to add ~/myperl/man to the MANPATH environment variable and also tell your Perl programs to
    look into ~/myperl/lib, e.g. by including

      use lib "$ENV{HOME}/myperl/lib";

    or setting the PERL5LIB environment variable.

    Another thing you should bear in mind is that the UNINST parameter should never be set if you are not root.

So, you will need to create a Perl directory in your home directory, as well as the lib, man, man/man1, and man/man3 directories in that Perl directory. Set the MANPATH variable and PERL5LIB variable, so that the installation of the modules goes smoother. (Setting UNINST=0 in your "make install" options, on the CPAN first-time configuration, is also a good idea.)

After that, go into the CPAN shell:


            bash$
            perl -MCPAN -e 'shell'
          

From there, you will need to type in the above "o conf" command and commit the changes. Then you can run through the installation:


            cpan>
            install Bundle::Bugzilla
          

Most of the module installation process should go smoothly. However, you may have some problems with Template. When you first start, you will want to try to install Template with the XS Stash options on. If this doesn't work, it may spit out C compiler error messages and croak back to the CPAN shell prompt. So, redo the install, and turn it off. (In fact, say no to all of the Template questions.) It may also start failing on a few of the tests. If the total tests passed is a reasonable figure (90+%), force the install with the following command:


            cpan>
            force install Template
          

You may also want to install the other optional modules:


          cpan>
          install GD
          cpan>
          install Chart::Base
          cpan>
          install MIME::Parser
        

2.5.5. HTTP Server

Ideally, this also needs to be installed as root and run under a special webserver account. As long as the web server will allow the running of *.cgi files outside of a cgi-bin, and a way of denying web access to certain files (such as a .htaccess file), you should be good in this department.

2.5.5.1. Running Apache as Non-Root

You can run Apache as a non-root user, but the port will need to be set to one above 1024. If you type httpd -V, you will get a list of the variables that your system copy of httpd uses. One of those, namely HTTPD_ROOT, tells you where that installation looks for its config information.

From there, you can copy the config files to your own home directory to start editing. When you edit those and then use the -d option to override the HTTPD_ROOT compiled into the web server, you get control of your own customized web server.

Note

You will need to start the daemons yourself. You can either ask your system administrator to add them to system startup files, or add a crontab entry that runs a script to check on these daemons and restart them if needed.

Warning

Do NOT run daemons or other services on a server without first consulting your system administrator! Daemons use up system resources and running one may be in violation of your terms of service for any machine on which you are a user!

2.5.6. Bugzilla

If you had to install Perl modules as a non-root user (Section 2.5.4) or to non-standard directories, you will need to change the scripts, setting the correct location of the Perl modules:

perl -pi -e
        's@use strict\;@use strict\; use lib \"/home/foo/perl/lib\"\;@'
        *cgi *pl Bug.pm processmail syncshadowdb
Change /home/foo/perl/lib to your personal Perl library directory. You can probably skip this step if you are using the independant method of Perl module installation.

When you run ./checksetup.pl to create the localconfig file, it will list the Perl modules it finds. If one is missing, go back and double-check the module installation from the CPAN shell, then delete the localconfig file and try again.

Warning

The one option in localconfig you might have problems with is the web server group. If you can't successfully browse to the index.cgi (like a Forbidden error), you may have to relax your permissions, and blank out the web server group. Of course, this may pose as a security risk. Having a properly jailed shell and/or limited access to shell accounts may lessen the security risk, but use at your own risk.