This article is a guide on installing Gentoo in another Linux distribution (Arch, in this case). Look at it like a BSD Jail. It’s not a true install, merely a chroot–a virtual machine.
Why, you ask? I think we’re all aware of and experienced with visualization technology. One of its drawbacks is that the user is unable to utilize all the resources of the running system. If one is not very comfortable with installing a distribution like Gentoo, this is a very good way of familiarizing yourself. You’ll optimize it for your system, not a VBox hard drive. So it can be ported as a true install to your computer if you need it using dd.
Not all of us have spare systems to test on, you know!
- A running Linux environment (obviously)
- Gentoo Stage 3 tarball
- Portage tarball
- Free space (15-20 GB will be enough)
You can get the tarballs from gentoo.org. Head over to the “mirrors” hyperlink and select the one closest to you.
For the Stage 3 tarball, go to Architecture > current-stage3 and download the latest .tar.bz2 file.
To get the portage tarball (portage is Gentoo’s package manager, by the way), click on Snapshots and download the latest .tar.bz2 or tar.xz file. It’s worth noting that the xz files are more compressed in comparison to bz2.
Starting the installation
First of all, we need to create a virtual hard drive to hold all that data. For this purpose, we will use dd. dd is a utility which dumps data crudely from a source to a target:
$ dd if=/dev/zero of=gentoo.img bs=1M count=0 seek=30720
In the example above, I have create a img file of size 30720MB (30 GB) which contains nothing at all. It exists in the current working directory.
Now, we format it to a file system of our requirements. I have used ext4:
$ mkfs.ext4 gentoo.img
Create a mount point for your Gentoo jail. I am using ~/gentoo:
$ mkdir ~/gentoo
Mount the .img file:
$ mount -o loop gentoo.img ~/gentoo
Navigate to that directory and become root:
$ cd ~/gentoo && su
Instead of using ‘su’ once and getting root privileges until you exit, you can also use ‘sudo’ per command. It is safer, just 2 characters more per command.
From now on, you should see a hash (#) before a command. This will mean that it is supposed to be executed as root.
Decompress the stage3 tarball:
# tar xfv /path/to/stage3
I don’t use a compression filter argument like -j or -x because I can’t remember them and tar is smart enough to find it on its own.
Jump to that ‘usr‘ directory which is inside ~/gentoo and unzip portage:
# cd usr
# tar xfv /path/to/portage
Chrooting into the base install (finally… )
Copy /etc/resolv.conf from your system to your mountpoint:
# cp /etc/resolv.conf ~/gentoo/etc/resolv.conf
There are multiple ways to chroot. One is the conventional way – chroot /path/to/root /bin/shell
With this, you’ll have to mount all the temporary file systems manually. So let me introduce you to arch-install-scripts.
Arch users can just install arch-install-scripts from the official repositories and ignore the rest. Others have two choices, either to download arch-chroot from the arch-install-scripts package or carry on normally.
Note: After chrooting, you do not need to use use ‘su’ or ‘sudo’
# arch-chroot ~/gentoo /bin/bash
# mount -o bind /dev ~/gentoo/dev
# mount -t proc none ~/gentoo/proc
# chroot ~/gentoo /bin/bash
source /etc/profile && env-update
Define a PS1:
export PS1='[\u@gentoo \W]\$
Congratulations! You’re in your base Gentoo system.
A few tips
You can also mount your host’s /usr/src in your chroot system to take advantage of kernel sources (which your Gentoo system will use a lot, trust me).
# mount -o bind /usr/src ~/gentoo/usr/src
This step needs to be taken before chrooting.
Since portage has a pretty huge cache, I suggest that you mount that in your host system as well if you’re using a .img file of a smaller size.
Like us on Facebook
We need your assistance to stay live
This week Top Posts
- Top Things To Do After Installing Ubuntu 13.10 'Saucy Salamander' : Ubuntu 13.10 Saucy Salamander will be released on coming October 17th with many new salient featur...0 comments |
- Wow! Linux Foundation To Offer Free Linux Course This Summer Worth $2,400 on EdX : Wow! Early last week it was all over the internet, if you haven't heard it yet then this is the t...0 comments |
- Grive: An Unofficial, Open Source Linux Client For Google Drive : A couple of months before, we have featured a Linux client for Google Drive named Syncdrive, which w...0 comments |
- How To Upgrade From Ubuntu 13.04 Raring To Ubuntu 13.10 Saucy Salamander : Ubuntu 13.10 Saucy will be released on October 17th. Hope it will come with lot of improvements and ...0 comments |
- How To "Fix E: Could not open file /var/lib/dpkg/status" : QUESTION: I get the following error when I use sudo apt-get update: E: Could not open file /var/...0 comments |
- Install LAMP Server (Apache, MySQL or MariaDB, PHP) On Ubuntu 13.10 : Updated January 12, 2014 LAMP is a combination of operating system and open-source software stack. ...0 comments |
- Install Sublime Text 3 In Fedora Easily With Fedy
- Grive: An Unofficial, Open Source Linux Client For Google Drive
- Install nSnake Game In Terminal
- How To “Fix E: Could not open file /var/lib/dpkg/status”
- Wow! Linux Foundation To Offer Free Linux Course This Summer Worth $2,400 on EdX
- Fedora 21 Scheduled For Release In October
- Install Uget Download Manager In Ubuntu, Fedora, Debian
- Download Elementary OS ‘Luna’ Official Wallpapers
- Install Power Commands 0.1.5 On Ubuntu 14.04/13.10/12.10/12.04
- 5 Android Apps that’s Going to Make Running Your Business Less Stressful
This work by unixmen.com is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Copyright © 2008-2013 Unixmen.com .