Build a Gentoo chroot environment

You can create a base Gentoo system by using the stage 3 installer. You will have to also mount both dev and proc filesystem for your base system to be usable for chroot. These are the outline of the process.

  1. Create your chroot folder
    $ mkdir chroot-gentoo
  2. Download Gentoo stage 3 installer
    $ wget ftp://rsync4.jp.gentoo.org/GENTOO/releases/x86/current/stages/stage3-x86-2008.0.tar.bz2
  3. Extract it
    $ tar xf stage3-x86-2008.0.tar.bz2 -C chroot-gentoo
  4. Mount proc and dev filesystem.
    $ sudo mount -o bind /dev chroot-gentoo/dev
    $ sudo mount -o bind /proc chroot-gentoo/proc
  5. Start chrooting
    $ sudo chroot chroot-gentoo /bin/bash
  6. Unmount the dev and proc filesystem once you exited your chroot environment.
    $ sudo umount chroot-gentoo/dev chroot-gentoo/proc

Sign up for Learn Linux in 5 Days and Level Up Your Career and many other great courses on Udemy to learn more.

Learn Linux in 5 Days and Level Up Your Career

Use the in-demand Linux skills you learn in this course to get promoted or start a new career as a Linux professional!

Written by Mohd Shakir Zakaria.

Last updated on 2019-02-12.