build_setup.md 1.43 KB
Newer Older
isaagar's avatar
isaagar committed
1 2 3 4
# `Setting up chroot`

For building packages on jenkins , we use `debian stretch` chroot.

isaagar's avatar
isaagar committed
5 6
**Steps for setting up chroot using `schroot`**
=
isaagar's avatar
isaagar committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57


## 1. Installing required packages

```
# apt-get install debootstrap schroot
```

## 2. Create chroot

Create new empty directory in /srv
```
# mkdir /srv/stretch-amd64
```

Now, debootrap the system where `testing` is the distribution name

```
# debootstrap --arch=amd64 testing stretch-amd64/ http://ftp.us.debian.org/debian
```

## 3. Updating schroot.conf

Open `/etc/schroot/schroot.conf` to add entry of newly created chroot

```
# nano /etc/schroot/schroot.conf
```

Add following lines to the file
```
[stretch-amd64]
description=debian stretch 64 bit
type=directory
directory=/srv/stretch-amd64
groups=sbuild-security
users=jenkins
root-groups=jenkins,root
```
Save and close the file.

## 4. Running schroot
To list available schroot
```
$ schroot -l
```
To run schroot as `root` user
```
# schroot -c stretch-amd64 -u root
```

isaagar's avatar
isaagar committed
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
**Steps for setting up  chroot using `pbuilder`**
=

## 1. Installing required packages
```
# sudo apt-get install pbuilder pdebuild
```

## 2. Creating chroot

Following command creates debian stretch amd64 chroot 
```
# sudo pbuilder --create --distribution testing --architecture amd64 --basetgz /var/cache/pbuilder/stretch-amd64 --mirror http://ftp.uk.debian.org/debian
```

isaagar's avatar
isaagar committed
73 74 75 76
## 3. Running pbuilder chroot
```
# sudo pbuilder --login --basetgz /var/cache/pbuilder/stretch-amd64 
```