Gentoo Linux quick installer script

Published on Author Artem Butusov8 Comments


Sometimes working gentoo environment could be needed just right now but typical manual installation is taking time.

Let’s say you need Gentoo running on Virtual Box on you physical box to test some gentoo-specific things or you just like Gentoo more than other distros.

The script I will share with you will save you time. It a little bit naive and straightforward but it is also simple and easy to tune for your needs. Pretty linear bash script.

NOTE: There is full automated script available for Virtual Box here:

What is this doing?

It is actually a minimal set of actions needed to get bootable Gentoo:

  • prepare partitions (boot, swap, root partitions)
  • install latest stage3 and portage snapshot (for x86_64 platform, but that could be altered in script)
  • install bootloader
  • install kernel
    • either quick mode: copy minimal install CD kernel
    • or regular mode: download source and build with genkernel
  • setup dhcp network on first interface
  • enable ssh
  • install your public ssh key for ssh access (password access disabled)
  • all other options like locale, charset, hostname are default, you could login into host and change if you want.


Instruction below are for macOS host OS and guest Virtual Box instance. For windows it is similar but you will need to use Putty for SSH.

By the way, even SSH is optional here. You could technically just type manually a few commands directly in virtual box console session to initiate installation.

  • Install VirtualBox
  • Create new instance (around 15GB is needed for minimal Gentoo)
  • (optional) Setup port forwarding from host to guest for SSH (for example, host 5555 -> guest 22)
  • Download minimal installation CD iso
  • Attach installation CD to instance
  • Boot from installation CD
  • (optional) Set root’s password (could be any, even very simple, used just for this installation session): passwd
  • (optional) Run SSH: /etc/init.d/sshd start
  • (optional) Connect from host over SSH: ssh root@localhost -p 5555
    • If the same host and port was previously used for SSH connection then previous SSH certificate fingerprint need to be remove to connect. It could be done here: ~/.ssh/known_hosts


The link below could be outdated, please follow gist to download revision of script.

The script source code is available here:


  • Download gentoo installer: wget
  • Edit script: nano
    • SSH_PUBLIC_KEY – set to your SSH public key to be able to login into Gentoo after
    • USE_LIVECD_KERNEL – it is up to you, using binary precompiled version is a faster way to get bootable Gentoo.
  • Run script: bash
  • After installation script will beep 10 times and will initiate reboot
  • Do not forget to eject installation CD from instance

Please note, script will stop if any error will happen.

8 Responses to Gentoo Linux quick installer script

  1. Thank you for sharing this script, I tested it today, it worked great.
    The only thing I miss is full disk encryption, I have not found any install script that does that.
    But some bloated gentoo based distros have it (sabayon, redcore, pentoo). Would be nice to
    have a clean system like what your script does – but also with full disk encryption.

    Thanks for sharing this script – saves a lot of time!

  2. Setting USE_LIVECD_KERNEL=0 resulted in an invalid configuration.

    This script is completely broken. You should just delete it so folks don’t waste time attempting to use it.

  3. Hello *,

    @Artem, Butusov
    Thanks you very very much for sharing the script !!!

    @Jeffrey, Walton
    Why when someone shares work with other people , in general someone has something to comment ? Is it that hard to appreciate the work of someone ? I suppose is the nature of human race !
    In case you have better knowledge, you can help in improving the script.

    Wish everyone a wonderful week !


Leave a Reply to stig atle steffensen Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.