Gentoo Linux安装详解--根据官方WiKi整理
2014-06-25 16:34
375 查看
1. 前期准备
远程登录:
开启ssh服务:/etc/init.d/sshd start设置密码:
passwd以便使用putty、ssh client远程登录上传stage等(有时在线下载很慢,而局域网上传很快)
准备磁盘:
分区:fdisk /dev/sda/dev/sda1 : /boot 100M(32-100M) 设启动笔记-a
/dev/sda2 : / 20G
/dev/sda3 : /home 20G
/dev/sda5 : /swap 1G (内存< 512 MB,分区分配2倍内存大小的空间;> 1024 MB,可以分配较少的空间甚至不需要swap 分区。)-t 82创建文件系统:
mkfs.ext4 /dev/sda1 mkfs.ext4 /dev/sda2 mkfs.ext4 /dev/sda3 mkswap /dev/sda5挂载分区:
mount /dev/sda2 /mnt/gentoo mkdir /mnt/gentoo/boot mount /dev/sda1 /mnt/gentoo/boot mkdir /mnt/gentoo/home mount /dev/sda3 /mnt/gentoo/home swapon /dev/sda5
2. 安装系统
安装stage及portage:
正确设置日期/时间:date如果显示的日期/时间不正确,可以使用date MMDDhhmmYYYY命令下载Stage3 Tarbll:
cd /mnt/gentoo links http://www.gentoo.org/main/en/mirrors.xml[/code]选择国内速度较快的镜像,进入releases/x86/autobuilds/目录里。你将会看到所有适合你的计算机体系结构的stage文件(它们也可能放在各个独立的子体系名称的子目录里)。选择一个,然后按D来下载。下载完以后,再按Q退出浏览器。或使用SSH Secure Shell登录上传stage3文件解开Stage3 Tarball:tar xvjpf stage3-*.tar.bz2下载Portage:
打开links(或者lynx)然后到我们的Gentoo镜像列表。选择一个离你最近的镜像,打开snapshots/目录。然后选择最新的Portage快照(portage-latest.tar.bz2)并按D来下载它。links http://www.gentoo.org/main/en/mirrors.xml[/code]或使用SSH Secure Shell登录上传portage文件解压Portage:tar -xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr (install a Portage snapshot)编译前准备:
配置编译选项:nano -w /mnt/gentoo/etc/portage/make.confCFLAGS="-march=native -O2 -pipe"
CXXFLAGS="${CFLAGS}" # 两个变量使用相同的设置
MAKEOPTS="-j3" #MAKEOPTS定义在安装软件的时候同时可以产生并行编译的数目,CPU数目加一是个不错的选择查看cpu信息:cat proc/cpuinfo选择镜像站点:mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf mirrorselect -i -r -o >> /mnt/gentoo/etc/portage/make.conf拷贝DNS信息:cp -L /etc/resolv.conf /mnt/gentoo/etc/3. Chroot进入新系统环境:
Chroot:
挂载 /proc, /dev, /sys文件系统:mount -t proc none /mnt/gentoo/proc mount --rbind /dev /mnt/gentoo/dev mount --rbind /sys /mnt/gentoo/sys进入新的系统环境:chroot /mnt/gentoo /bin/bash source /etc/profile export PS1="(chroot) $PS1"新环境配置:
更新portage树:emerge --sync (Updating the Portage tree) 或 emerge-webrsync(fetch the latest portage snapshot)选择Profile:eselect profile list eselect profile set ×设置时区:ls /usr/share/zoneinfo echo "Europe/Brussels" > /etc/timezone emerge --config sys-libs/timezone-data设置locale:nano -w /etc/locale.gen locale-gen更新环境变量:env-update && source /etc/profile4. 编译内核:
安装内核源码:
选择内核:如gentoo-sourcesemerge gentoo-sources ls -l /usr/src/linux手动编译内核:
cd /usr/src/linux make menuconfig必须启用的选项:
显卡:Xorg/Configuration
声卡:ALSA
网卡:根据具体网卡芯片型号,查看wiki。
网卡芯片驱动查询:Linux Wireless
其他选项根据需要添加,不了解保持默认即可:
编译内核与模块:make && make modules_install拷贝内核到启动分区:cp arch/x86_64/boot/bzImage /boot/kernel-3.10.10-gentoo使用genkernel编译内核:
emerge genkernel可选:复制安装光盘上的内核配置文件:zcat /proc/config.gz > /usr/share/genkernel/arch/x86_64/kernel-config编译:genkernel --menuconfig all一旦genkernel运行完成,一个包括全部模块和initrd的内核将被建立。在后面配置引导程序时我们将会用到这个内核和initrd。请记下内核和 initrd的名字,因为您将在配置引导程序的时候用到他们。initrd将会在启动真正的系统前自动识别硬件(如同安装光盘一样)。ls /boot/kernel* /boot/initramfs*5. 配置系统
系统信息:
文件系统信息:
创建/etc/fstabnano -w /etc/fstab网络信息:
Host name, Domainname, etcnano -w /etc/conf.d/hostnameConfiguring Networknano -w /etc/conf.d/net系统信息:
Gentoo uses /etc/rc.conf to configure the services, startup, and shutdown of your system.nano -w /etc/rc.confRoot PasswordpasswdGentoo uses /etc/conf.d/hwclock to set clock options.nano -w /etc/conf.d/hwclock安装系统工具软件:
可选:PCMCIA使用lspci查看硬件信息:emerge pcmciautilsSystem Logger:emerge syslog-ng rc-update add syslog-ng default可选:File Indexing:emerge mlocate可选:Remote Access:rc-update add sshd default可选:DHCP Client:emerge dhcpcd配置启动项:
Using GRUB2:emerge sys-boot/grub grub2-install /dev/sdaGenerating GRUB2 configuration:grub2-mkconfig -o /boot/grub/grub.cfg可选:Using GRUB Legacy:emerge sys-boot/grub:0编辑配置文件:nano -w /boot/grub/grub.confExample grub.conf:# 默认选择哪个列表来引导。0表示第一个, 1表示第二个,以此类推。 default 0 # 引导默认列表前等待多少秒 timeout 30 # 使用漂亮、“臃肿”的spalsh图像来增加一点趣味:) # 如果您没有安装显卡,请将这行注释掉 splashimage=(hd0,0)/boot/grub/splash.xpm.gz title Gentoo Linux 3.10.10 # 内核镜像(或者操作系统)所在分区 root (hd0,0) kernel /boot/kernel-3.10.10-gentoo root=/dev/sda2 title Gentoo Linux 3.10.10 (rescue) # 内核镜像(或者操作系统)所在分区 root (hd0,0) kernel /boot/kernel-3.10.10-gentoo root=/dev/sda2 init=/bin/bb # 接下来的四行只有在您与Windows系统进行双启动的情况下才需要。 # 本例中,windows系统位于/dev/sda6。 title Windows XP rootnoverify (hd0,5) makeactive chainloader +1 #win7***释掉makeactiveSetting up GRUB using grub-install:
Creating /etc/mtab:grep -v rootfs /proc/mounts > /etc/mtabInstall GRUB:grub-install --no-floppy /dev/sda重启系统:
exit cd umount -l /mnt/gentoo/dev{/shm,/pts,} umount -l /mnt/gentoo{/boot,/proc,} reboot6. 安装X桌面环境:
安装Xorg:
检测显卡信息:dmesg | grep video lspci | grep -i VGA配置INPUT_DEVICE、VIDEO_CARDS变量:
在安装Xorg之前,你需要在/etc/portage/make.conf文件中设置两个重要的变量。(For mouse, keyboard, and Synaptics touchpad support) INPUT_DEVICE="evdev synaptics" (对nVidia显卡) VIDEO_CARDS="nvidia" (或,对ATI Radeon显卡) VIDEO_CARDS="radeon" (VMware虚拟机) VIDEO_CARDS="vmware" (VirtualBox虚拟机) VIDEO_CARDS="virtualbox"安装xorg-server“emerge -pv xorg-driversFirst of all, make sure udev is in your USE flags:echo "x11-base/xorg-server udev" >> /etc/portage/package.use注:现在比较新的版本的Xorg(大概是 1.5 以后的吧) 使用 evdev 替换了 keyboard 和 mouse ,确保 udev 标记在安装 xorg-server 时被启用。Next, install Xorg:emerge -av xorg-server更新环境变量:env-update source /etc/profile使用startx:
安装 twm 和 xterm 之后 执行 startx 测试 X 是否正常。
测试正常之后可以删除 twm 和 xterm。emerge -v twm xterm startx安装桌面环境:
lxde:
awesome:
本文出自 “博主:孤逐王” 博客,请务必保留此出处http://aceking.blog.51cto.com/3681913/1430801
相关文章推荐
- Gentoo Linux安装详解--根据官方WiKi整理
- Linux基于yum安装Mariadb(根据官方文档记录)
- Gentoo Linux安装详解
- Linux下ati官方驱动(非开源)的安装配置
- Linux下软件安装详解
- 【转载】在Linux平台上安装和配置Ruby on Rails详解
- 在Linux平台上安装和配置Ruby on Rails详解
- Linux下软件安装详解
- linux下安装eva qq configure 错误详解[转]
- Linux下软件安装详解
- gentoo安装步骤整理
- Linux下常用WebMail服务器安装整理
- Linux下软件安装详解
- LINUX的KDE安装详解
- linux安装配置jdk1.5、tomcat5.5、eclipse3.2详解
- 在Linux平台上安装和配置Ruby on Rails详解(含lighttpd的安装与自启动)
- linux下软件安装详解
- Linux下软件安装详解- -
- RedHat AS 4安装详解-Linux学习日记
- 在Linux平台上安装和配置Ruby on Rails详解