Gentoo:Installation

来自WHY42
imported>Soleverlee2016年12月31日 (六) 11:50的版本 →‎stage3

Reinstall gentoo record:

prepare disk

Disk /dev/sdb: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 19FC4662-CDC6-44A2-A78B-717085B89743

Device         Start       End   Sectors  Size Type
/dev/sdb1       2048    616447    614400  300M Windows recovery environment
/dev/sdb2     616448    821247    204800  100M EFI System
/dev/sdb3     821248   1083391    262144  128M Microsoft reserved
/dev/sdb4    1083392 168855551 167772160   80G Microsoft basic data
/dev/sdb5  168855552 378570751 209715200  100G Microsoft basic data
/dev/sdb6  378570752 378775551    204800  100M Linux filesystem
/dev/sdb7  378775552 382969855   4194304    2G Linux swap
/dev/sdb8  382969856 403941375  20971520   10G Linux filesystem
/dev/sdb9  403941376 468862094  64920719   31G Linux filesystem

delete existing file system.

mount /dev/sdb9 /mnt/gentoo
rm -rf /mnt/gentoo/*
mkdir home boot
mount /dev/sdb6 /mnt/gentoo/boot
mount /dev/sdb8 /mnt/gentoo/home
rm -rf /mnt/gentoo/boot/*

Optional:format file systems(/boot and / partition, no necessary to format /home partition)

mkfs.ext2 /dev/sdb6
mkfs.ext4 /dev/sdb9
mount /dev/sdb9 /mnt/gentoo/
cd /mnt/gentoo/
mkdir boot home
mount /dev/sdb6 /mnt/gentoo/boot/
mount /dev/sdb8 /mnt/gentoo/home/

stage3

Gentoo:安装Stage3 the sohu mirror seems to be wrong.

cd /mnt/gentoo
wget http://mirrors.163.com/gentoo/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-20161229.tar.bz2
sha512sum stage3-amd64-20161229.tar.bz2
cat stage3-amd64-20161229.tar.bz2.DIGESTS

tar xvjpf stage3-*.tar.bz2 --xattrs

then edit /etc/portage/make.conf

CFLAGS="-march=native -O2 -pipe"
MAKEOPTS="-j9"
...
USE="bindist X dbus -gtk -gnome -qt3support -ldap"
CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3"
INPUT_DEVICES="evdev"
VIDEO_CARDS="intel nvidia"
...
GENTOO_MIRRORS="http://mirrors.163.com/gentoo/"

then mount system and chroot to new system:

cp -L /etc/resolv.conf /mnt/gentoo/etc/
mount -t proc proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --make-rslave /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
mount --make-rslave /mnt/gentoo/dev

chroot /mnt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) $PS1"

xxx

livecd gentoo # vim /mnt/gentoo/etc/portage/make.conf
livecd gentoo # cp -L /etc/resolv.conf /mnt/gentoo/etc/
livecd gentoo # mount -t proc proc /mnt/gentoo/proc
livecd gentoo # mount --rbind /sys /mnt/gentoo/sys
livecd gentoo # mount --make-rslave /mnt/gentoo/sys
livecd gentoo # mount --rbind /dev /mnt/gentoo/dev
livecd gentoo # mount --make-rslave /mnt/gentoo/dev
livecd gentoo # chroot /mnt/gentoo /bin/bash
livecd / # source /etc/profile
(chroot) livecd / # emerge-webrsync 
(chroot) livecd / # eselect profile set 8
(chroot) livecd / # eselect profile list

(chroot) livecd / # nano -w /etc/locale.gen 

en_US ISO-8859-1
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8

(chroot) livecd / # locale-gen 
 * Generating locale-archive: forcing # of jobs to 1
 * Generating 3 locales (this might take a while) with 1 jobs
 *  (1/3) Generating en_US.ISO-8859-1 ...                                         [ ok ]
 *  (2/3) Generating en_US.UTF-8 ...                                              [ ok ]
 *  (3/3) Generating zh_CN.UTF-8 ...                                              [ ok ]
 * Generation complete
(chroot) livecd / # clear
(chroot) livecd / # eselect locale list
Available targets for the LANG variable:
  [1]   C
  [2]   POSIX
  [3]   en_US
  [4]   en_US.iso88591
  [5]   en_US.utf8
  [6]   zh_CN.utf8
  [ ]   (free form)
(chroot) livecd / # eselect locale set 6
Setting LANG to zh_CN.utf8 ...
Run ". /etc/profile" to update the variable in your shell.
(chroot) livecd / # 
(chroot) livecd / # env-update && source /etc/profile && export PS1="(chroot) $PS1"
>>> Regenerating /etc/ld.so.cache..

kernel

(chroot) livecd / # emerge --ask gentoo-sources:4.4.39

 * IMPORTANT: 12 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.


These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N     ] sys-devel/bc-1.06.95-r1  USE="readline -libedit -static" 
[ebuild  N     ] sys-kernel/gentoo-sources-4.4.39  USE="-build -experimental -symlink" 

Would you like to merge these packages? [Yes/No] 

tools

(chroot) livecd boot # exit
exit
livecd gentoo # cd
livecd ~ # umount -l /mnt/gentoo/dev
livecd ~ # umount =l /mnt/gentoo/proc 
umount: =l: mountpoint not found
livecd ~ # umount -l /mnt/gentoo/proc 
umount: /mnt/gentoo/proc: not mounted
livecd ~ # umount -l /mnt/gentoo/sys  
livecd ~ # umount -l /mnt/gentoo/boot 
livecd ~ # umount -l /mnt/gentoo/home 
livecd ~ # umount -l /mnt/gentoo/