- http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?full=1
- http://wiki.gentoo.org/wiki/MediaTomb
Below is a list of the commands I used to prepare a KVM virtual machine hosted on RHEL 6. It starts with preparing the virtual disk which in this case a an LVM Logical Volume:
On host that is preparing Gentoo "/" file system (not chroot):
1020 lvcreate -m 1 --mirrorlog mirrored -L10G -n vm_mediatomb-ROOT JD
1021 fdisk /dev/JD/vm_mediatomb-ROOT
1022 cfdisk /dev/JD/vm_mediatomb-ROOT
1023 kpartx -l /dev/JD/vm_mediatomb-ROOT
1024 kpartx -a /dev/JD/vm_mediatomb-ROOT
1025 mkfs.ext4 -L mediatomb-ROOT /dev/mapper/JD-vm_mediatomb--ROOT1
1027 cd /mnt
1028 mkdir mediatomb
1029 mount /dev/mapper/JD-vm_mediatomb--ROOT1 mediatomb
mkdir /root/tmp
cd /root/tmp
wget http://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3/stage3-amd64-20131226.tar.bz2
1030 cd /mnt/mediatomb/
1032 tar xvjpf /root/tmp/stage3-amd64-20131226.tar.bz2
1034 cd etc
1037 cp -L /etc/resolv.conf .
1038 vim resolv.conf
vim portage/make.conf
• CFLAGS="-march=native -O2 -pipe"
• USE="mmx sse sse2 aac faac jpeg2k mmxext mp3 ssse3 threads twolame vorbis x264 xvid"
• MAKEOPTS="-j4"
• GENTOO_MIRRORS="rsync://rsync.au.gentoo.org"
• PORTAGE_RSYNC_INITIAL_TIMEOUT=45
• DONT_MOUNT_BOOT=1
ls ../usr/share/zoneinfo/Australia/Canberra
echo "Australia/Canberra" >timezone
cat timezone
vim locale.gen
blkid
vim fstab
vim conf.d/hostname
• hostname="mediatomb"
vim conf.d/net
• config_eth0="dhcp"
cd ..
mount -t proc none proc
mount --rbind /sys sys
mount --rbind /dev dev
chroot /mnt/mediatomb /bin/bash
On Gentoo chroot environment:
source /etc/profile
export PS1="(chroot) $PS1"
4 ls -l /etc
5 emerge-webrsync # failed. Played with mirrors and eventually "emerge --sync" worked instead.
6 emerge --sync
9 eselect news list
14 eselect news read 1
15 eselect news read 2
16 eselect news read 3
17 eselect news read 4
18 eselect news read 5
19 eselect news read 6
20 eselect news purge
21 eselect news list
22 eselect profile list
23 emerge --config sys-libs/timezone-data
24 locale-gen
25 locale -a
26 eselect locale list
27 eselect locale set 4
28 env-update && source /etc/profile
29 emerge gentoo-sources
30 cd /etc/init.d
34 ls
35 ln -s net.lo net.eth0
36 ls -l
37 rc-update add net.eth0 default
38 cd /usr/src
41 ls -l
42 cd linux
43 make menuconfig
44 make && make modules_install
49 cp arch/x86_64/boot/bzImage /boot/kernel-3.10.17-gentoo
52 ls -hl /boot/kernel-3.10.17-gentoo
passwd
emerge -av vim syslog-ng logrotate vixie-cron dhcpcd sys-boot/grub
rc-update add sshd default
rc-update add syslog-ng default
vim /etc/conf.d/hwclock
emerge -av mediatomb
I could not get Grub2 to install from the above chroot-ed environment as the running virtual machine is just too different from this. Therefore I used a Gentoo Installation ISO to start the VM and finish the Grub2 installation:
grub2-install /dev/vda
grub2-mkconfig -o /boot/grub/grub.cfg