https://www.gentoo.org/downloads/
http://distfiles.gentoo.org/releases/amd64/autobuilds/20160505/install-amd64-minimal-20160505.iso
1) boot
输入 gentoo dopcmcia
Enter 进入 LiveCD 的 gentoo 系统
2) 配置 root 户口
# passwd root
3) 开启 ssh 服务
# /etc/init.d/sshd start
4) 系统分区
# fdisk -l
Disk /dev/sda: 50 GiB
# fdisk /dev/sda
Command (m for help):
sda1分区: n,p,1,Enter,+200M
sda2分区: n,p,2,Enter,+1024M
sda3分区: n,p,3,Enter,Enter
设置sda2分区为swap分区格式: t,2,82
保存而且退出: w
# partx -a /dev/sda
partx: /dev/sda: error adding partitions 1-3
# mkfs.ext2 /dev/sda1
# mkfs.ext4 /dev/sda3
# mkswap /dev/sda2
# swapon /dev/sda2
# swapon -s
* 可以用 cfdisk /dev/sda 看看
* boot (/dev/sda1) 盘必须要用 ext2, 引导开机程序 grub 只支持 ext2 而已
5) 创建系统临时挂载点
# mount /dev/sda3 /mnt/gentoo
# mkdir /mnt/gentoo/boot
# mount /dev/sda1 /mnt/gentoo/boot
6) 设置系统时间 (重要)
# date
Fri May 12 08:47:10 UTC 2016
// 如不正确, 可用以下命令配置
# date -s 05/13/2016
# date -s 20:59:59
7) 下载/解压/安装 stage3-amd64-20160505.tar.bz2 (239M) 和 portage-latest.tar.bz2 (72M)
# cd /mnt/gentoo
# links http://mirrors.sohu.com * 这个只是拿来测试网络有没问题
# wget http://distfiles.gentoo.org/releases/amd64/autobuilds/20160505/stage3-amd64-20160505.tar.bz2
# wget http://distfiles.gentoo.org/snapshots/portage-latest.tar.bz2
# ls
# tar jxvf stage3-amd64-20160505.tar.bz2 -C /mnt/gentoo
# tar jxvf portage-latest.tar.bz2 -C /mnt/gentoo/usr
撤除
# rm -rf stage3-amd64-20160505.tar.bz2
# rm -rf portage-latest.tar.bz2
8) 配置编译选项
# nano -w etc/portage/make.conf
USE="bindist unicode bash-completion vim-syntax jpeg png mmx sse sse2"
MAKEOPTS="-j3"
# 要换其它源, 可在这里找 https://www.gentoo.org/downloads/mirrors/
GENTOO_MIRRORS="http://mirrors.sohu.com/gentoo/"
SYNC="rsync://rsync.cn.gentoo.org/gentoo-portage"
APACHE2_MODULES="authz_host cgi dir mime actions alias asis auth_basic auth_digest authn_alias authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_owner authz_user autoindex cache cern_meta cgid charset_lite dav dav_fs dav_lock dbd deflate disk_cache dumpio env expires ext_filter file_cache filter headers ident imagemap include info log_config log_forensic logio mem_cache mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http reqtimeout rewrite setenvif speling status substitute unique_id userdir usertrack version vhost_alias unixd socache_shmcb authn_core authz_core"
NGINX_MODULES_HTTP="addition fastcgi flv geo geoip sub access auth_basic charset dav gzip gzip_static image_filter limit_req limit_zone map memcached perl proxy realip referer rewrite secure_link ssi stub_status upstream_ip_hash userid xslt random autoindex browser cache_purge degradation empty_gif headers_more push random_index scgi split_clients uwsgi slowfs_cache upload upload_progress"
NGINX_MODULES_MAIL="imap pop3 smtp"
ACCEPT_LICENSE="*"
PHP_TARGETS="php5-4"
PHP_INI_VERSION="production"
LINGUAS="en_US zh_CN zh_TW"
9) 切换系统到 /dev/sda3 根分区上并更新系统环境变量
# cd /
# mount -t proc proc /mnt/gentoo/proc
# mount -o bind /dev /mnt/gentoo/dev
# cp -L /etc/resolv.conf /mnt/gentoo/etc/
# chroot /mnt/gentoo /bin/bash
# env-update && source /etc/profile
# export PS1="(chroot) $PS1"
10) 设置时区
去 /usr/share/zoneinfo 找找你要用的时区
# cp -rvf /usr/share/zoneinfo/Asia/Kuala_Lumpur /etc/localtime
11) 编辑 /etc/locale.gen
# nano -w /etc/locale.gen
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_CN.GBK GBK
# locale-gen
12) 设置主机名
# echo "127.0.0.1 gentoo" > /etc/hosts
# nano -w /etc/hosts
# sed -i -e's/hostname.*/hostname="gentoo"/' /etc/conf.d/hostname
# hostname gentoo
# nano -w /etc/conf.d/hostname
13) 配置与编译内核
# emerge -avt gentoo-sources genkernel
* 确认下 /usr/share/genkernel/arch/x86_64/kernel-config, 应该存在
# zcat /proc/config.gz > /usr/share/genkernel/arch/x86_64/kernel-config
# genkernel --color --loglevel=5 --menuconfig --save-config --makeopts=-j9 --kernel-config=/usr/share/genkernel/arch/x86_64/kernel-config all
* 这个网卡 driver 是用于 vmware
Networking support —>
Device Drivers —>
Network device support —>
Ethernet driver support —>
Intel devices
<M> Intel(R) PRO/1000 Gigabit Ethernet support
Networking support —>
Device Drivers —>
Fusion MPT device support
<M> Fusion MPT ScsiHost drivers for SPI
<M> Fusion MPT ScsiHost drivers for FC
<M> Fusion MPT ScsiHost drivers for SAS
(128) Maximum number of scatter gather entries (16 – 128)
<M> Fusion MPT misc device (ioctl) driver
<M> Fusion MPT LAN driver
File systems —>
<M> Second extended fs support
[*] The Extended 4 (ext4) filesystem
[*] Ext4 POSIX Access Control Lists
[*] Ext4 Security Labels
[*] Ext4 debugging support
14) 文件系统挂载点
# nano -w /etc/fstab
/dev/sda1 /boot ext2 noauto,noatime 1 2
/dev/sda3 / ext4 noatime 0 1
/dev/sda2 none swap sw 0 0
15) 系统基本配置
# ifconfig -a * 可以知道网络介面名 eno16777728
# nano -w /etc/conf.d/net
config_eno16777728="192.168.247.200 netmask 255.255.255.0 brd 192.168.247.255"
routes_eno16777728="default via 192.168.247.2"
# nano -w /etc/resolv.conf
domain localdomain
nameserver 192.168.247.2
# passwd
安装一些其它东西
# emerge -avt syslog-ng vixie-cron pciutils gentoolkit
开机自动启动
# rc-update add sshd default
# rc-update add syslog-ng default
# rc-update add vixie-cron default
###### emerge sys-apps/mlocate #安装文件索引locate,重启后记得updatedb新建库
16) 配置与安装引导程序 grub
# emerge grub
# grub2-install --no-floppy /dev/sda
# grub2-mkconfig -o /boot/grub/grub.cfg
* 编译内核后
/boot/ 会多出 kernel-genkernel-x86_64-4.4.6-gentoo 和 initramfs-genkernel-x86_64-4.4.6-gentoo
# nano -w /boot/grub/grub.conf
default 0
timeout 30
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
title Gentoo Linux 4.4.6
root (hd0,0)
kernel /boot/kernel-genkernel-x86_64-4.4.6-gentoo root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/sda3 rootfstype=ext4
initrd /boot/initramfs-genkernel-x86_64-4.4.6-gentoo
# exit
# umount /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo/boot /mnt/gentoo
# reboot
17) 现在可以拿走 install-amd64-minimal-20160505.iso 了
18) 更新系统
# 进入 root 户口
# emerge --sync
# emerge -avt gentoolkit
# emerge --update --deep --newuse -avt @world
# revdep-rebuild
# etc-update
没有评论:
发表评论