Step6.Configuring the Compile Options – this is the next step. The compilation options are kept in the /mnt/gentoo/etc/make.conf file. You can edit this file by executing:
# nano -w /mnt/gentoo/etc/make.conf
Navigate using arrow keys to the end of the file and add line: MAKEOPTS=”-j2″.
Then add mirrors by executing:
# mirrorselect -i -o >> /mnt/gentoo/etc/make.conf # mirrorselect -i -r -o >> /mnt/gentoo/etc/make.conf
A window will be displayed with a list of options. Navigate using up and down arrow keys and use to select a mirror you prefer (one in your country or next to your country). Then hit <Enter>.
Test the if the values have been added to make.conf: (Two new lines containing GENTOO_MIRRORS=”some link” and SYNC=”some link” should be added to the file)
# cat /mnt/gentoo/etc/make.conf
Step7.Mounting the /proc and /dev filesystems
# mount -t proc none /mnt/gentoo/proc # mount --rbind /dev /mnt/gentoo/dev # mount --bind /dev/pts /mnt/gentoo/dev/pts
Step8.Entering the new Environment
# source /etc/profile # export PS1="(chroot) $PS1" # chroot /mnt/gentoo # env-update >> Regenerating /etc/ld.so.cache...
Edit the root password:
# passwd New password: (Enter your new password) Re-enter password: (Re-enter your password)
Create a user and edit the password for it:
# useradd -m -G users jules # passwd jules New password: (Enter jules's password) Re-enter password: (Re-enter jules's password)
And to give this user the right to switch to root user we do the following:
# nano -w /etc/pam.d/su
And we comment the line containing “auth required pam_wheel.so use_uid” by placing an # in front of it. Save: CTRL+X, Y, .
- Updating the portage tree:
# emerge --sync (If you do not want to see a lot of text scrolling on your window use emerge --sync --quiet )
- Configuring the USE variable: set with a list of flags. (A use flag embodies support and dependency-information for a certain concept.) For the machine I am trying to install I need the following set of flags which have to be added to the USE variable. In order to do this, we will edit the make.conf file, by adding: (I recommend the same syntax, it’s easier to understand in the small VirtualBox window)
- USE=”X cairo expat firefox glut gmp gnutls handbook innodb java java6″
- USE=”$USE jpeg kde libnotify mysql nsplugin oracle pam pdf perl python”
- USE=”$USE postgres qt4 semantic-desktop slang soap sockets subversion”
- USE=”$USE syslog udev usb xml xulrunner”
- IConfiguring the kernel:
# emerge grub gentoo-sources # emerge genkernel # genkernel all
And now you wait a lot … If it crashes just run genkernell all again and wait a lot.Again.
- Adding your partition in fstab file: (to let your operating system know which mount point is associated to what partition)
# nano -w /etc/fstab
You will see some sample lines in the file. Comment them by putting # in front of them and write your own, which should look like this:
# /dev/sda1 none swap sw 0 0 # /dev/sda2 / ext3 defaults 0 1
Step10.Setting parameters for boot loader:
# cd /boot # ln -s kernel-genkernel-x86-3.0.6-gentoo vmlinuz # ln -s System.map-genkernel-x86-3.0.6-gentoo System.map # ln -s initramfs-genkernel-x86-3.0.6-gentoo initramfs # rc-update add net.eth0 boot (Adding the network initialization at boot time) # nano -w grub/menu.lst
You will see a line with timeout 30 on it. Modify it to timeout 5. Then add the following lines:
# cd /boot # title [My First Gentoo] (Or whatever name you want for your OS) # root (hd0,1) # kernel /boot/vmlinuz root=/dev/ram0 real_root=/dev/sda2 # initrd /boot/initramfs
Create or edit the partition file for grub:
# cd /etc # nano -w mtab(Usually this file does not exist, so it has to be created) Write the following line: /dev/sda2 / ext3 rw 0 0 and save. (CTRL+X, Y ) # grub-install --no-floppy /dev/sda
Step11. Restarting the machine. We give the following command:
# init 0
Which tells our machine to shut down. After the window disappears we go to the VirtualBox main window and edit our VM by removing the installation CD image, to force our system to boot from the virtual hard drive. Select the VM from the list, right-click on it and select Settings from the menu. A window is displayed with a menu on the left side. Click on Storage. On the right side there is a list of devices under the header Storage Tree. Right click on IDE Controller and click the Remove Attachement menu option(Click here for sample image). Then click ok and start your machine. (This is how my vm looks at boot time.) You should be able now to log on with your root or other user you created. This is the base Gentoo operating System. If you want to install a user interface try KDE. How can you install it? By executing:
# emerge -p kde-meta
The “-p” option means “pretend”, so the previous command just pretends to install KDE in order to check dependencies. The result of the pretend installation is shown on the screen and some extra USE flags might be needed. If you followed all the steps mentioned the only flags you have to add in the make.conf file will be: dbus and qt3support. See Step9 on how to add USE Flags, just edit the make.conf file by adding those two flags on the last line with spaces between them. The file can be found now in the /etc directory and you can get there by executing:
# cd /etc
in your console. To check if the file is there use:
# ls make.conf
The name of the file will be printed again if found, otherwise a message will be printed on the screen saying: ls:cannot access make.conf: No such file or directory
Also you might be required to use the option –autounmask-write, to allow kde to use deprecated packages. So the following must be executed:
# emerge --autounmask-write kde-meta (when asked to choose an option press 1,then q, then 1 again,then Y <Enter> - read what the system wants from you, you will figure out what key you need) # etc-update # emerge kde-meta
And now you wait a lot. Again. After that you do the following:
# emerge kdm # emerge --autounmask-write xorg-x11 (1,1,Y <enter> then 2,1,Y <enter>) # etc-update # emerge xorg-x11 # nano -w /etc/conf.d/xdm -> DISPLAYMANAGER="kdm" # rc-update add dbus default # rc-service dbus start # rc-update add xdm default # init 6
And now you have a full Gentoo virtual machine with interface too.
[Later Edit]: I have redone the steps, creating a second VM and corrected the missing details or moved some steps where they were supposed to be. I am happy to announce you that by executing these steps exactly in a few hours (~3) will be the proud owner of a base Gentoo system in a VirtualBox VM.