Gentoo in VirtualBox
My first try with Gentoo
Background
I have heard about Gentoo for a long time, but it said that to install and configure was too hard for a Linux beginner, especially the complex configurations of the system. From Wiki, I learned that I need to compile all the source code locally according to my settings, that’s cool for sure. So I’d like to firstly install it on my Windows OS within a virtual machine: VirtualBox. My environment is list below:
OS: Windows 7 - 32bits
VirtualBox version: 4.2.18
Installation
The main reference document is the official x86 quick install guide. Firstly, I googled a lot about Gentoo and prepared the virtual box with a 512 RAM and 20GB static virtual disk and set the VirtrualBox’s net as NAT by default. Secondly, I download the CD ISO from the host nearest to me (the inner educational net), and set the ISO to the virtual CD. Finally, the installation starts. Boot to the livecd:
boot: gentoo-nofb
I test the network with ping www.google.com
, and it was OK. So there is nothing to tune up with the network configuration. I did not use any ssh client to connect to my virtual system. Next, by using cfdisk I parted my virtual disk as recommended by Wiki and use mkfs.ext4
command to format the partitions. Then enable the swap partition:
mkswap /dev/sda2
swapon /dev/sda2
Get the disk prepared, I mounted the file systems together with set a correct time using date MMDDhhmmYYYY
.
Then download the stage3 file from the host by:
wget ftp://xdlinux.info/.../current-stage3/stage3-*.tar.bz2
Under the /mnt/gentoo
directory, unpack the stage3 file by
tar xjpf stage3*
Next is the important point where the root will be changed to the /mnt/gentoo
, type the command according to the Wiki carefully, do not miss any command, especially cp -L /etc/resolv.conf /mnt/gentoo/etc/
which enable the network of the chroot environment. Next step is to retrieve the portage directly by the command emerge-webrsync
, after you create a new folder as /usr/portage
.
Set the time zone and date information before going on.
Select the desktop profile and set the host name and domain name.
Next comes with the most time-consuming stage, kernel source codes downloading and compiling. The cost time depending on the performance of your computer.
emerge gentoo-sources
cd /usr/src/linux
make menuconfig
make -j2
make modules_install
cp arch/iXXX/boo/bzImage /boot/kernel
where the XXX refer to the platform you choose, it is i386 here for x86.
Then you must change the /etc/fstab
to declare where the system will mound the partitions.
I escaped the network setting for the NAT mode can guarantee the access to the internet.
Then set your password for root and some necessary tools. Finally, install a boot-loader such as GRUB. After configured it and unmount
the mounted partitions you can reboot.
As usual, add a new user to the system by useradd -g users -G lp,wheel,audio -m jerry && passwd jerry
. Then, log-in jerry and enjoy!
Conclusion
The basic Gentoo system can be installed by following the guide, and the further configurations are needed to enhance it as a daily used system. I will enrich it in the future.