Chapter 3 Installation

Tinderbox now determines where to do all of its work relative to the location of the tc program, passed around to other functions by means of the ${pb} environmental variable (think: package build). Historically, this was the /space/ directory (tc was usually found in /space/scripts/tc).

Henceforth, the top-level directory will be referred to as ${pb}, which you should substitute for whatever root directory you're using.

  1. Create directories ${pb} and ${pb}/scripts/.

  2. Extract the Tinderbox distribution into ${pb}/scripts/.

  3. Run tc to setup configuration files and initialize the Tinderbox database:

    # cd ${pb}/scripts && ./tc Setup

    If you are going to be using the web front-end, edit webui/inc_ds.php.dist for your database setup. Then copy this file to inc_ds.php.

    If your Tinderbox host does not have administrative access to the database server, you must perform the next few steps by hand. Else, skip to step 7.

  4. Edit ${pb}/scripts/ds.ph.dist for your setup. Once this file has been edited, copy it to ds.ph.

  5. Create the database and database user on the host that you defined within ds.ph.

    Tip: The database can live on the same server as Tinderbox. Just set $DB_HOST to localhost in ds.ph. The tinderbox user must be granted the following permissions on the Tinderbox database (for security purposes no other permissions should be granted) [MySQL only]:

    • Select_priv

    • Insert_priv

    • Update_priv

    • Delete_priv

    For PostgreSQL users, make sure the Tinderbox user owns the Tinderbox database as well as all the tables within that database.

  6. Populate the database with the Tinderbox schema:

    MySQL:

    # cd sql
    # ./genschema mysql | mysql -u{DB_ADMIN} -p -h {DB_HOST} {DB_NAME}

    PostgreSQL:

    # cd sql
    # ./genschema pgsql | psql -U {DB_USER} -W -h {DB_HOST} -d {DB_NAME}

    Where {DB_HOST} and {DB_NAME} are the values of $DB_HOST and $DB_NAME from ds.ph respectively, {DB_ADMIN} is the database administrator username, and {DB_USER} is the Tinderbox user.

    Caution: Do not do this if you are upgrading! If you do, you will overwrite all of your previous data. If schema changes are required for upgrading, a separate upgrade schema file will be included, and instructions will be available at http://tinderbox.marcuscom.com.

  7. Edit ${pb}/scripts/tinderbox.ph.dist for your environment (if you are using the web front-end, also edit webui/inc_tinderbox.php.dist). Once these files have been edited they must be copied to tinderbox.ph and inc_tinderbox.php respectively.

  8. Initialize the Tinderbox:

    # cd ${pb}/scripts && ./tc init
  9. Tinderbox can use either NFS or nullfs to mount the required file systems within the build chroots (called Builds in Tinderbox). If you wish to use nullfs, skip to step 12.

  10. Setup the Tinderbox server as an NFS server by adding the following to /etc/exports:

    ${pb} -alldirs -maproot=0:0 localhost

    Important: ${pb} CANNOT be a symlink. It should be a real, fully qualified path (hint: use realpath on your desired ${pb} to find out what this needs to be).

  11. Add the following to /etc/rc.conf to enable the NFS client and server:

    nfs_client_enable="YES"
    nfs_server_flags="-u -t -n 20"
    rpcbind_enable="YES"
    nfs_server_enable="YES"
    nfs_reserved_port_only="YES"
  12. Create the required Jails using the tc command. A Jail is nothing more than a version of FreeBSD. For example, to create a Jail for FreeBSD 8.2-RELEASE:

    # cd ${pb}/scripts && ./tc createJail -j 8.2 -d "FreeBSD 8.2-RELEASE" \
      -t RELENG_8_2_0_RELEASE -u CVSUP

    or

    # cd ${pb}/scripts && ./tc createJail -j 8.2 -d "FreeBSD 8.2-RELEASE" \
      -t 8.2-RELEASE -u LFTP -H ftp.freebsd.org

    The first method will download source via cvsup and use make world to compile a complete FreeBSD installation.

    The second method will instead download binary release sets (used on CDs) and install them, making the process much shorter. As the command suggests, the second method requires lftp (ftp/lftp) to be installed. You need to specify what release (not the CVS tag, as opposed to the first method) you want to download with the -t option. Also note that you need to provide an FTP server to download the sets from (with the -H option).

    Important: All Jail names MUST begin with their FreeBSD major version number. That is, the following is an illegal jail name: “FreeBSD-8.2”.

    Tip: It is recommended that the Jail begin with the FreeBSD major.minor version (i.e. “8.2-FreeBSD” instead of just “8-FreeBSD”) as this may prove useful when using things such as Hooks (Section 8.8).

  13. Create the required PortsTrees using the tc command. A PortsTree is a set of ports you wish to build. A PortsTree does not have to be a complete FreeBSD ports tree. However, all ports within a tree must have all of their dependencies within the same tree.

    For example, to create a portstree that tracks the full FreeBSD ports tree:

    # cd ${pb}/scripts && ./tc createPortsTree -p FreeBSD \
      -d "FreeBSD ports tree" \
      -w http://www.freebsd.org/cgi/cvsweb.cgi/ports/
  14. Create the required Builds using the tc command. A Build is a combination of a Jail and a PortsTree. The build is the object in which packages are created. To create a build that combines a 8.2 Jail with the FreeBSD ports tree:

    # cd ${pb}/scripts && ./tc createBuild -b 8.2-FreeBSD -j 8.2 \
      -p FreeBSD -d "8.2-RELEASE with FreeBSD ports tree"

    Note: the recommended way to name Builds is “Jail-PortsTree”. All builds must also begin with their FreeBSD major version number.

Note: tc uses cvsup12 as its default cvsup mirror. If you would like to use another server or enable cvsup compression use the -H and -C line arguments to the tc script respectively. For example, to use cvsup2.freebsd.org and enable cvsup compression for all Jail updates, use the following command:

# cd ${pb}/scripts && ./tc createJail -j 8-STABLE \
  -d "FreeBSD 8-STABLE" -t RELENG_8 -u CVSUP -C \
  -H cvsup2.freebsd.org

Tip: It is possible to suppress spurious setuid warnings from periodic if ${pb} is on a dedicated partition. Simply add the nosuid flag to the partition; for UFS in /etc/fstab:

/dev/ad5s1f  /usr/local/tinderbox  ufs  rw,nosuid  1  1

and for ZFS:

# zfs set setuid=off $(zfs list ${pb} | tail -n 1 | cut -d ' ' -f 1)