Thursday, January 31, 2008

Install Gentoo VM on Macbook -1

I use Minimum CD, the installation is more hard than using a liveCD, so I failed a bunch of times. And as my learning, I started installation with stage3, so I don't need to catch stage1 and stage2, but even stage3, is a lot to me. Every time with Minimum CD, I have to get stage3 and portage, so at last I save them to another machine that I can easily get with ssh.

0 startup with Minimum CD
vmware: other linux 2.6.x
connected: NAT

1 check network
- ifconfig => eth0
- dhcpcd => some times need it if eth0 did not show ip address
- ssh => connect with my file server where I save stage3 and portage etc.
/etc/init.d/sshd start
ssh 192.168.0.104

2 prepare disks...
- fdisk /dev/sda
=> /dev/sda1 for boot
=> /dev/sda2 for swap
=> /dev/sda3 for / (the root)
mkfs.ext2 /dev/sda1
mkfs.ext3 /dev/sda3
mkswap /dev/sda2
swapon /dev/sda2
mount /dev/sda3 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/sda1 /mnt/gentoo/boot

3 install stage3 and portage
scp -p -r 192.168.0.104:/root/gentoo .
cd /mnt/gentoo
tar xjpf stage3-<>.tar.bz2
tar xjf portage-<>.tar.bz2 -C /mnt/gentoo/usr

4. env setup
vi /mnt/gentoo/etc/make.conf
CFLAGS as "-O2 -march=prescott -fomit-frame-pointer -pipe"
mirrorselect -i -o >> /mnt/gentoo/etc/make.conf
cp -L /etc/resolv.conf /mnt/gentoo/etc
mount -t proc none /mnt/gentoo/proc
mount -o bind /dev /mnt/gentoo/dev
chroot /mnt/gentoo /bin/bash
env-update
source /etc/profile
export PS1="{chroot} $PS1"


5. emerge -sync --quiet
emerge vim lilo subversion

6. vi /etc/fstab
7. network
vi /etc/conf.d/hostname => "gentoovm"
vi /etc/conf.d/net => for dhcp: config_eth0="dhcp", but i did not set.
rc-update add net.eth0 default => boot eth0 as default
emerge dhcpcd => MUST
vi /etc/hosts
=> 127.0.0.1 gentoovm.homenetwork gentoovm localhost

8. System
passwd => MUST
useradd
emerge syslog-ng vixie-cron
rc-update add syslog-ng default
rc-update add vixie-cron default

9. lilo
vi /etc/lilo.conf
prepare the default kernel (from ssh) and save to /boot
/sbin/lilo

10 reboot