Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wiki:schroot-centos [2013/07/09 10:52] (current)
Line 1: Line 1:
 +====== Setup a CentOS schroot on Debian ======
 +
 +Inspired by the setup of Debian chroot for sbuild:
 +  * http://​wiki.debian.org/​sbuild?​rev=19
 +  * http://​wiki.debian.org/​mk-sbuild
 +
 +<code bash>
 +$ apt-get install schroot sbuild btrfs-tools
 +</​code>​
 +
 +We will use the btrfs flavor of schroot.
 +
 +Since btrfs is still experimental,​ I choose to create loopback device formated with btrfs and mounted as follows:
 +
 +<code bash>
 +$ cat <EOF >> /etc/fstab
 +/​home/​schroot-btrfs ​    /​srv/​chroot ​    ​btrfs ​  ​defaults ​       0       0
 +EOF
 +
 +/​home/​schroot-btrfs is a 20G file (to created if, please help yourself)
 +</​code>​
 +
 +Create the centos6 schroot configuration file:
 +
 +<code bash>
 +$ cat < '​EOF'​ > /​etc/​schroot/​chroot.d/​centos6-amd64
 +[centos6-amd64]
 +type=btrfs-snapshot
 +description=CentOS 6/amd64 autobuilder
 +groups=root,​sbuild
 +root-groups=root,​sbuild
 +profile=sbuildrpm
 +btrfs-source-subvolume=/​srv/​chroot/​centos6-amd64
 +btrfs-snapshot-directory=/​srv/​chroot/​snapshots
 +EOF
 +</​code>​
 +
 +Setup the filesystem subvolume and snapshots
 +
 +<code bash>
 +$ btrfs subvolume create /​srv/​chroot/​centos6-amd64
 +
 +$ mkdir -p /​srv/​chroot/​snapshots
 +</​code>​
 +
 +Bootstrap the centos system:
 +
 +<code bash>
 +$ cat EOF >> /​etc/​rinse/​rinse.conf
 +[centos-6]
 +mirror ​      = http://​ftp.ciril.fr/​pub/​linux/​centos/​6/​os/​i386/​Packages/​
 +mirror.amd64 = http://​ftp.ciril.fr/​pub/​linux/​centos/​6/​os/​x86_64/​Packages/​
 +EOF
 +
 +$ rinse --distribution centos-6 --arch amd64 --directory /​srv/​chroot/​centos6-amd64/ ​
 +</​code>​
 +
 +We copy the /dev from a Debian schroot (rinse'​s one one is buggy)
 +<code bash>
 +$ cp -a /​srv/​chroot/​sid-amd64-sbuild/​dev /​srv/​chroot/​centos6-amd64/​
 +</​code>​
 +
 +Finally, we do some customizations to make the centos system schroot friendly
 +
 +<code bash>
 +$ echo centos6-amd64 > /​srv/​chroot/​centos6-amd64/​etc/​debian_chroot
 +$ cat << '​EOF'​ > /​srv/​chroot/​centos6-amd64/​etc/​profile.d/​debian_chroot.sh
 +# set variable identifying the chroot you work in (used in the prompt below)
 +if [ -z "​${debian_chroot:​-}"​ ] && [ -r /​etc/​debian_chroot ]; then
 +    debian_chroot=$(cat /​etc/​debian_chroot)
 +fi
 +
 +# set a fancy prompt (non-color, overwrite the one in /​etc/​profile)
 +PS1='​${debian_chroot:​+($debian_chroot)}\u@\h:​\w\$ '
 +
 +EOF
 +</​code>​
 +
 +
 +Test
 +<code bash>
 +$ sudo adduser <​user>​ sbuild
 +</​code>​
 +(logout and login again)
 +
 +Enter the snapshoted chroot:
 +<code bash>
 +$ schroot -c chroot:​centos6-amd64 ...
 +</​code>​
 +
 +Enter the source chroot (to upgrade the base system for instance)
 +<code bash>
 +$ sudo schroot -c source:​centos6-amd64 ..
 +</​code>​
 +
 +You can then use sbuildrpm or any other test in the CentOS schroot environement...
  
wiki/schroot-centos.txt ยท Last modified: 2013/07/09 10:52 (external edit)
Recent changes RSS feed GNU Free Documentation License 1.3 Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki