商务合作:179001057@qq.com

gentoo 安装笔记 2009.07.10

技术2022-05-11  0


某平台价值19860元的编程课程资料免费领取【点我领取】


历经N遍失败,终于成功了。做个笔记。

 

0. 环境 Ubuntu 8.04 - Hardy Heron virtual-box 3.0 0.1 虚拟机配置 常规 -> Linux / gentoo system -> processor -> pae/nx 去掉 memory -> 256M

1. 准备 1.1 光盘启动 boot: gentoo-nofb nox(选项用于加快启动速度) 2. 安装 格式化并加载磁盘 livecd root # cfdisk /dev/hda 分区概况: hda1: 200M /boot ext3 hda2: 8000M / hda3: 389M swap livecd root # mkfs.jfs /dev/hda1 livecd root # mkfs.jfs /dev/hda2 livecd root # mkswap /dev/hda3 livecd root # mount /dev/hda2 /mnt/gentoo/ livecd root # mkdir /mnt/gentoo/boot livecd root # mount /dev/hda1 /mnt/gentoo/boot/ livecd root # swapon /dev/hda3 下载 stage3, portage 文件 livecd root # mkdir /mnt/gentoo/install livecd root # cd /mnt/gentoo/install livecd install # sftp pjx@192.168.0.107 >mget po* >mget st* 安装 stage3 livecd install # tar xjpf stage3-*.tar.bz2 -C /mnt/gentoo 安装 portage livecd install # tar xjpf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr 环境准备 livecd root # cd livecd root # vi /mnt/gentoo/etc/make.conf CFLAGS="-O2 -march=pentium4 -pipe" CXXFLAGS="${CFLAGS}" CHOST="i686-pc-linux-gnu" MAKEOPTS="-j2" USE="-gtk -gnome -qt3 -qt4 -kde" GENTOO_MIRRORS="http://ftp.jaist.ac.jp/pub/Linux/Gentoo/ " SYNC="rsync://rsync.asia.gentoo.org/gentoo-portage" livecd root # mirrorselect -i -o >> /mnt/gentoo/etc/make.conf livecd root # mirrorselect -i -r -o >> /mnt/gentoo/etc/make.conf livecd root # cp -L /etc/resolv.conf /mnt/gentoo/etc/ livecd root # mount -t proc none /mnt/gentoo/proc livecd root # mount -o bind /dev /mnt/gentoo/dev 进入chroot livecd root # chroot /mnt/gentoo /bin/bash livecd / # env-update livecd / # source /etc/profile livecd / # export PS1="(chroot) $PS1" 更新 portage (chroot) livecd / # emerge --sync --quiet (chroot) livecd / # emerge --oneshot portage (chroot) livecd / # etc-update 选择 make.profile (chroot) livecd / # ls -FGg /etc/make.profile lrwxrwxrwx 1 48 May 18 10:22 /etc/make.profile -> ../usr/portage/profiles/default/linux/x86/2008.0/ 设置 make.conf USE USE="acpi xml unicode dbus hal bzip2" 生成 locale (chroot) livecd etc # nano -w locale.gen en_US ISO-8859-1 en_US.UTF-8 UTF-8 ja_JP.EUC-JP EUC-JP ja_JP.UTF-8 UTF-8 zh_CN.GBK GBK zh_CN.GB18030 GB18030 zh_CN.UTF-8 UTF-8 (chroot) livecd etc # locale-gen 设置时区 (chroot) livecd etc # cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 安装源码(大约55M) (chroot) livecd / # emerge gentoo-sources 配置内核(耗费时间最长,也是最重要的一步) (chroot) livecd / # cd /usr/src/linux (chroot) livecd linux # make menuconfig 添加 jfs 文件系统支持 虚拟机要添加 AMD PCNet32 网卡驱动 其他适当剪裁 编译安装 (chroot) livecd linux # make && make modules_install (chroot) livecd linux # cp arch/i386/boot/bzImage /boot/kernel-2.6.29-gentoo 修改 fstab (chroot) livecd linux # cd / (chroot) livecd / # nano /etc/fstab /dev/sda1               /boot           jfs             noauto,noatime  1 2 /dev/sda2               /               jfs             noatime         0 1 /dev/sda3               none            swap            sw              0 0 /dev/cdrom              /mnt/cdrom      auto            noauto,ro       0 0 配置网络 (chroot) livecd / # vi /etc/conf.d/hostname (chroot) livecd / # vi /etc/hosts 127.0.0.1       localhost ::1             localhost 192.168.0.1     gw.home gw 192.168.0.107   pjx-laptop.home pjx-laptop (chroot) livecd / # vi /etc/conf.d/net dns_domain_lo="home" config_eth0=( "dhcp" ) (chroot) livecd / # rc-update add net.eth0 default (chroot) livecd / # passwd (chroot) livecd / # vi /etc/conf.d/clock CLOCK="local" TIMEZONE="Asia/Shanghai" 安装系统日志工具 (chroot) livecd / # emerge syslog-ng (chroot) livecd / # rc-update add syslog-ng default 安装Cron守护进程 (chroot) livecd / # emerge vixie-cron (chroot) livecd / # rc-update add vixie-cron default 安装文件系统工具 (chroot) livecd root # emerge jfsutils 安装 dhcp 客户端 # emerge dhcpcd 安装 pci 工具

# emerge pciutils

安装GRUB (chroot) livecd / # emerge grub (chroot) livecd / # vi /boot/grub/grub.conf default 0 timeout 30 title Gentoo Linux 2.6.29 root (hd0,0) kernel /boot/kernel-2.6.29-gentoo root=/dev/sda2 使用grub-install安装GRUB (chroot) livecd / # grep -v rootfs /proc/mounts > /etc/mtab (chroot) livecd / # grub-install --no-floppy /dev/hda 退出 chroot 环境 (chroot) livecd / # exit livecd root # umount /mnt/gentoo/boot /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo livecd root # halt 再开机,就可以用了。

 

后记:虽然是选用的 IDE 设备,安装的时候也确实是操作的 hda,但是虚拟机启动以后,认为是 sda,

所以在配置 grub 和 fstab 时就得注意了。

 


最新回复(0)