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
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 |
- Configure Your Browser To Use Tor On Ubuntu/Debian/Linux Mint : Tor, The Onion Router, is a network of Virtual Tunnels that allows users to communicate securely and...2 comments |
- Setup A Full Featured ITIL Management System Using Integria IMS On CentOS 6 : Integria IMS is a fully featured ITIL management system, featuring a ticketing system, inventory/C...2 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 |
- Install lamp with 1 command in Ubuntu 12.10, 13.04 Raring Ringtail & LinuxMint13 : Updated: 10/09/2012 :LAMP (Linux, Apache, MySQL and PHP) is an open source Web development platform ...0 comments |
- Install and Configure Samba share in Ubuntu 13.10 'Saucy Salamander' , 13.04| Howto : Updated 05-04-2013: One of the most asked features for Samba is a graphical user interface to help w...0 comments |
- OpenLDAP Installation and Configuration in Ubuntu 12.10/13.04/13.10 And Debian 6/7
- Configure Your Browser To Use Tor On Ubuntu/Debian/Linux Mint
- Setup A Full Featured ITIL Management System Using Integria IMS On CentOS 6
- Install LibreOffice 4.1.3 in Elementary OS ‘Luna’
- How To Install Simple Scan in Crunchbang ‘Waldorf’
- Selene Media Encoder: Convert Audio, Video Files To Most Popular Formats
- Linux Kernel 3.12.2 Is Available For Download! Install / Upgrade Instructions
- CentOS 6.5 Has Been Officially Released!
- Format Junkie: Convert Media Files To All Popular Formats
- Setup Squid Proxy Server On openSUSE 13.1
This work by unixmen.com is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Copyright © 2008-2013 Unixmen.com .