About Gentoo

启动内核

gentoo dopcmcia dosshd

加载8139too模块

modprobe 8139too

设置密码

passwd

创建分区

fdisk /dev/sda

显示磁盘当前的分区配置

p

删除一个分区

d

创建BIOS引导分区

n
p
1
2048
+2M

创建引导分区

n
p
2
(Enter)
+128M

创建swap分区

n
p
3
(Enter)
+512M

创建根分区

n
p
4
(Enter)
(Enter)

设置引导分区类型

t
2
ef

设置swap分区类型

t
3
82

标记可引导的标记

a
2

保存分区布局

w

格式化分区

mkfs.fat -F 32 /dev/sda2
mkfs.ext4 /dev/sda4
mkswap /dev/sda3
swapon /dev/sda3

挂载 root 分区

mount /dev/sda4 /mnt/gentoo

设置时钟

ntpd -q -g

下载stage压缩包

cd /mnt/gentoo
wget https://mirrors.tuna.tsinghua.edu.cn/gentoo/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-*.tar.xz # 在镜像站查询
tar xpvf stage3-*.tar.xz –xattrs-include=’*.*’ –numeric-owner

配置编译选项

nano -w /mnt/gentoo/etc/portage/make.conf

COMMON_FLAGS=”-march=native -O2 -pipe”
MAKEOPTS=”-jx” #x为CPU核心数+1
GENTOO_MIRRORS=”https://mirrors.tuna.tsinghua.edu.cn/gentoo”

完成软件仓库的配置

mkdir –parents /mnt/gentoo/etc/portage/repos.conf
cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf

修改软件仓库的配置

nano -w /mnt/gentoo/etc/portage/repos.conf/gentoo.conf

sync-uri = rsync://rsync1.cn.gentoo.org/gentoo-portage

复制DNS信息

cp –dereference /etc/resolv.conf /mnt/gentoo/etc/

挂载必要的文件系统

mount –types 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}”

挂载 boot 分区

mount /dev/sda2 /boot

配置Portage

emerge-webrsync
emerge –ask –verbose –update –deep –newuse @world

选择时区

echo “Asia/Shanghai” > /etc/timezone
emerge –config sys-libs/timezone-data

配置地区

nano -w /etc/locale.gen

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

locale-gen

eselect locale list
eselect locale set 6
env-update && source /etc/profile && export PS1=”(chroot) ${PS1}”

安装源码

emerge –ask sys-kernel/gentoo-sources

emerge –ask sys-apps/pciutils

cd /usr/src/linux
make menuconfig

编译安装

make -jx && make modules_install && make install #x为CPU核心数+1

生成initramfs

etc-update
emerge –ask sys-kernel/genkernel

genkernel –install initramfs

安装固件

emerge –ask sys-kernel/linux-firmware

设置挂载

nano -w /etc/fstab

/dev/sda2 /boot ext2 defaults,noatime 0 2
/dev/sda3 none swap sw 0 0
/dev/sda4 / ext4 noatime 0 1

设置主机名

nano -w /etc/conf.d/hostname

hostname=”yourhostname”

配置网络 #enp3s0为目标网卡

emerge –ask –noreplace net-misc/netifrc

nano -w /etc/conf.d/net

config_enp3s0=”dhcp”

cd /etc/init.d
ln -s net.lo net.enp3s0
rc-update add net.enp3s0 default

设置密码

passwd

开机启动ssh

rc-update add sshd default

安装DHCP

emerge –ask net-misc/dhcpcd

设置引导

emerge –ask –verbose sys-boot/grub:2

grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

添加用户

useradd -m -G users,wheel,audio,cdrom,floppy,usb,video -s /bin/bash iriszero
passwd iriszero

重启

exit
cd
umount -l /mnt/gentoo/dev{/shm,/pts,}
umount -R /mnt/gentoo
reboot

Portage

更新 Gentoo 软件仓库

emerge --sync

更新系统

emerge --update --deep --with-bdeps=y --newuse @world

Xfce

## https://wiki.gentoo.org/wiki/Xorg/Guide
## https://wiki.gentoo.org/wiki/Xfce/Guide
## https://wiki.gentoo.org/wiki/Xfce
## https://wiki.gentoo.org/wiki/Non_root_Xorg
## https://wiki.gentoo.org/wiki/X_server

emerge --ask --oneshot xfce-extra/xfce4-notifyd
emerge --ask xfce-base/xfce4-meta
env-update && source /etc/profile
emerge --ask x11-terms/xfce4-terminal

# https://wiki.gentoo.org/wiki/Elogind
# https://wiki.gentoo.org/wiki/D-Bus
# https://wiki.gentoo.org/wiki/Udev

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注