Gentoo:Installation:修订间差异

来自WHY42
imported>Soleverlee
imported>Soleverlee
 
(未显示同一用户的13个中间版本)
第19行: 第19行:
/dev/sdb8  382969856 403941375  20971520  10G Linux filesystem
/dev/sdb8  382969856 403941375  20971520  10G Linux filesystem
/dev/sdb9  403941376 468862094  64920719  31G Linux filesystem
/dev/sdb9  403941376 468862094  64920719  31G Linux filesystem
</pre>
</pre>
 
delete existing file system.
<source lang="bash">
<source lang="bash">
mount /dev/sdb9 /mnt/gentoo
mount /dev/sdb9 /mnt/gentoo
第30行: 第29行:
rm -rf /mnt/gentoo/boot/*
rm -rf /mnt/gentoo/boot/*
</source>
</source>
Optional:format file systems(/boot and / partition, no necessary to format /home partition)
<source lang="bash">
mkfs.ext2 /dev/sdb6
mkfs.ext4 /dev/sdb9


<pre>
e2label /dev/sdb6 boot
livecd ~ # mkfs.ext2 /dev/sdb6
e2label /dev/sdb9 gentoo
mke2fs 1.43.1 (08-Jun-2016)
mount /dev/sdb9 /mnt/gentoo/
/dev/sdb6 contains a ext2 file system labelled 'boot'
cd /mnt/gentoo/
        last mounted on /boot on Thu Dec 29 21:09:49 2016
mkdir boot home
Proceed anyway? (y,n) y
mount /dev/sdb6 /mnt/gentoo/boot/
Discarding device blocks: done                           
mount /dev/sdb8 /mnt/gentoo/home/
Creating filesystem with 102400 1k blocks and 25688 inodes
</source>
Filesystem UUID: 667051f1-6014-4661-8aac-ff520f78c8f9
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729
 
Allocating group tables: done                           
Writing inode tables: done                           
Writing superblocks and filesystem accounting information: done
 
livecd ~ # mkfs.ext4 /dev/sdb9
mke2fs 1.43.1 (08-Jun-2016)
/dev/sdb9 contains a ext4 file system labelled 'gentoo'
        last mounted on / on Thu Dec 29 21:08:00 2016
Proceed anyway? (y,n) y
Discarding device blocks: done                           
Creating filesystem with 8115089 4k blocks and 2031616 inodes
Filesystem UUID: d314e554-3e1c-470d-b90d-0be9214e0114
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624
 
Allocating group tables: done                           
Writing inode tables: done                           
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 
 
</pre>
<pre>
livecd gentoo # mount /dev/sdb9 /mnt/gentoo/
livecd gentoo # cd /mnt/gentoo/
livecd gentoo # ls
lost+found
livecd gentoo # mkdir boot home
livecd gentoo # mount /dev/sdb6 /mnt/gentoo/boot/
livecd gentoo # mount /dev/sdb8 /mnt/gentoo/home/
</pre>


=stage3=
=stage3=
[[Gentoo:安装Stage3]]
[[Gentoo:安装Stage3]]
<pre>
the [http://mirrors.sohu.com/gentoo/releases/amd64/autobuilds/current-stage3-amd64/ sohu mirror] seems to be wrong.
wget http://mirrors.sohu.com/gentoo/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-20161222.tar.bz2
<source lang="bash">
wget http://mirrors.sohu.com/gentoo/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-20161222.tar.bz2.DIGESTS
cd /mnt/gentoo
livecd gentoo # sha512sum stage3-amd64-20161222.tar.bz2
wget http://mirrors.163.com/gentoo/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-20161229.tar.bz2
31b75cf5b00559f3ae4a2770895148c2e5e0bb610ef9f02484a94ace9b0e23654a5e4091d646a2d83b0e24a045bbd24d3673eb645224c805274c0cd892ffcb50  stage3-amd64-20161222.tar.bz2
sha512sum stage3-amd64-20161229.tar.bz2
livecd gentoo # cat stage3-amd64-20161222.tar.bz2.DIGESTS
cat stage3-amd64-20161229.tar.bz2.DIGESTS
# SHA512 HASH
 
31b75cf5b00559f3ae4a2770895148c2e5e0bb610ef9f02484a94ace9b0e23654a5e4091d646a2d83b0e24a045bbd24d3673eb645224c805274c0cd892ffcb50  stage3-amd64-20161222.tar.bz2
tar xvjpf stage3-*.tar.bz2 --xattrs
</source>
then edit /etc/portage/make.conf
<source lang="lua">
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"
...
...
livecd gentoo # tar xvjpf stage3-*.tar.bz2 --xattrs
GENTOO_MIRRORS="http://mirrors.163.com/gentoo/"
</source>
then mount system and chroot to new system:
<source lang="bash">
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


livecd gentoo # vim /mnt/gentoo/etc/portage/make.conf
chroot /mnt/gentoo /bin/bash
livecd gentoo # cp -L /etc/resolv.conf /mnt/gentoo/etc/
source /etc/profile
livecd gentoo # mount -t proc proc /mnt/gentoo/proc
export PS1="(chroot) $PS1"
livecd gentoo # mount --rbind /sys /mnt/gentoo/sys
</source>
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


then update protage, and set a plamsa profile.
<source lang="bash">
emerge-webrsync
eselect profile list
eselect profile set 8
</source>
edit /etc/locale.gen
<source lang="lua">
en_US ISO-8859-1
en_US ISO-8859-1
en_US.UTF-8 UTF-8
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
</source>
and regenerate locale:
<source lang="bash">
locale-gen
eselect locale list
eselect locale set 6
echo "Asia/Shanghai" > /etc/timezone
emerge --config sys-libs/timezone-data


(chroot) livecd / # locale-gen
env-update && source /etc/profile && export PS1="(chroot) $PS1"
* Generating locale-archive: forcing # of jobs to 1
</source>
* Generating 3 locales (this might take a while) with 1 jobs
 
* (1/3) Generating en_US.ISO-8859-1 ...                                        [ ok ]
=kernel=
* (2/3) Generating en_US.UTF-8 ...                                             [ ok ]
<source lang="bash">
*  (3/3) Generating zh_CN.UTF-8 ...                                              [ ok ]
emerge --ask gentoo-sources:4.4.39
  * Generation complete
</source>
(chroot) livecd / # clear
it's better to open another terminal(not the chroot one) and config the kernel in X mode.
(chroot) livecd / # eselect locale list
*https://wiki.gentoo.org/wiki/NVidia/nvidia-drivers
Available targets for the LANG variable:
*https://wiki.gentoo.org/wiki/Xorg/Guide
  [1]  C
*https://wiki.gentoo.org/wiki/NVIDIA/Optimus
  [2]  POSIX
then make the kernel
  [3]  en_US
<source lang="bash">
  [4]  en_US.iso88591
make && make modules_install
  [5]  en_US.utf8
make install
  [6]  zh_CN.utf8
 
  [ ]  (free form)
emerge --ask sys-kernel/genkernel
(chroot) livecd / # eselect locale set 6
genkernel --install initramfs
Setting LANG to zh_CN.utf8 ...
cd /boot
Run ". /etc/profile" to update the variable in your shell.
mv initramfs-genkernel-x86_64-4.4.39-gentoo initramfs-4.4.39-gentoo
(chroot) livecd / #
</source>
(chroot) livecd / # env-update && source /etc/profile && export PS1="(chroot) $PS1"
=tools=
>>> Regenerating /etc/ld.so.cache..
edit host name and set clock to local, then change the root passwd:
<source lang="bash">
nano -w /etc/conf.d/hostname
nano -w /etc/conf.d/hwclock
 
passwd
 
emerge --ask app-admin/sysklogd
rc-update add sysklogd default
emerge --ask net-misc/dhcpcd
</source>
=fstab=
=umount and reboot into new system=
<source lang="bash">
umount -l /mnt/gentoo/dev
umount /mnt/gentoo/boot  
umount /mnt/gentoo/proc
umount /mnt/gentoo/sys
umount /mnt/gentoo/home
umount /mnt/gentoo
</source>
 
=tools=
<source lang="bash">
emerge --ask eix
emerge --ask gentoolkit
</source>
=xorg-server=
<source lang="bash">
emerge --ask x11-base/xorg-server
emerge --ask twm xterm xclock
env-update && source /etc/profile
emerge --ask kde-plasma/plasma-meta
emerge --ask x11-misc/sddm
 
useradd -m -G users,wheel,audio,video -s /bin/bash riguz
passwd riguz
 
sddm --example-config > /etc/sddm.conf
emerge --ask wqy-microhei
</source>
 
<pre>
/etc/conf.d/xdm
DISPLAYMANAGER="sddm"
</pre>
</pre>


=kernel=
<source lang="bash">
/etc/init.d/xdm start
</source>
[[Category:Linux/Unix]]
[[Category:Linux/Unix]]

2017年1月1日 (日) 01:54的最新版本

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

e2label /dev/sdb6 boot
e2label /dev/sdb9 gentoo
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"

then update protage, and set a plamsa profile.

emerge-webrsync
eselect profile list
eselect profile set 8

edit /etc/locale.gen

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

and regenerate locale:

locale-gen
eselect locale list
eselect locale set 6
echo "Asia/Shanghai" > /etc/timezone
emerge --config sys-libs/timezone-data

env-update && source /etc/profile && export PS1="(chroot) $PS1"

kernel

emerge --ask gentoo-sources:4.4.39

it's better to open another terminal(not the chroot one) and config the kernel in X mode.

then make the kernel

make && make modules_install
make install

emerge --ask sys-kernel/genkernel
genkernel --install initramfs
cd /boot
mv initramfs-genkernel-x86_64-4.4.39-gentoo initramfs-4.4.39-gentoo

tools

edit host name and set clock to local, then change the root passwd:

nano -w /etc/conf.d/hostname
nano -w /etc/conf.d/hwclock

passwd

emerge --ask app-admin/sysklogd
rc-update add sysklogd default
emerge --ask net-misc/dhcpcd

fstab

umount and reboot into new system

umount -l /mnt/gentoo/dev
umount /mnt/gentoo/boot  
umount /mnt/gentoo/proc
umount /mnt/gentoo/sys
umount /mnt/gentoo/home 
umount /mnt/gentoo

tools

emerge --ask eix
emerge --ask gentoolkit

xorg-server

emerge --ask x11-base/xorg-server
emerge --ask twm xterm xclock
env-update && source /etc/profile
emerge --ask kde-plasma/plasma-meta
emerge --ask x11-misc/sddm

useradd -m -G users,wheel,audio,video -s /bin/bash riguz
passwd riguz

sddm --example-config > /etc/sddm.conf
emerge --ask wqy-microhei
/etc/conf.d/xdm
DISPLAYMANAGER="sddm"
/etc/init.d/xdm start