Gentoo/教程

来自OSSmedia

本页面介绍gentoo安装的过程并提供一些指令速查。可以加速gentoo的安装过程。

安装核检表

  • root密码
  • 具有sudo权限的用户
  • 时区
  • 主机名称
  • systemd-networkd systemd-resolved NetworkManager

安装 stage

反正下载一下就行

https://mirrors.bfsu.edu.cn/gentoo/releases/amd64/autobuilds/current-stage3-amd64-desktop-systemd/
tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner -C /mnt/gentoo

配置portage

GRUB

GRUB_PLATFORMS="emu efi-32 efi-64 pc"

USE

USE="X fcitx5 tkip kcm cjk"

协议

ACCEPT_LICENSE="* -@EULA"

显卡

VIDEO_CARDS="nvidia amdgpu radeon radeonsi intel mesa"

#请根据自己的需要配置

cpu flag

echo "*/* $(cpuid2cpuflags)" > /etc/portage/package.use/00cpu-flags

studio.use

#kernel
sys-kernel/installkernel dracut grub
# kde
kde-plasma/plasma-meta networkmanager kwallet display-manager sddm wacom systemd sdk rdp plymouth oxygen-theme gtk grub discover bluetooth smart
kde-plasma/kde-apps-meta admin education games graphics multimedia network pim sdk utils
# latex
app-text/texlive X cjk context extra games graphics humanities luatex metapost music pdfannotextractor png pstricks publishers science tex4ht texi2html truetype xetex xml 

软件包

# 基础配置包
mirrorselect bash-completion net-misc/networkmanager app-portage/cpuid2cpuflags sudo glances app-misc/screen
# 内核
sys-kernel/installkernel sys-kernel/linux-firmware sys-kernel/gentoo-kernel
# 桌面环境
plasma-meta kde-apps-meta
# 浏览器
firefox chromium
# latex 编辑器
app-editors/kile app-text/texlive

fcitx

输入法,带上kcm USE 安装 fcitx-configtools

编辑 .xprofile

export XMODIFIERS="@im=fcitx"
export QT_IM_MODULE=fcitx
export GTK_IM_MODULE=fcitx


字体

media-fonts/arphicfonts \
media-fonts/noto-cjk \
media-fonts/source-han-sans \
media-fonts/wqy-microhei \

自制脚本

请在挂载磁盘后运行(默认位置 /mnt/gentoo)

# URL of the Gentoo mirror
MIRROR_URL="https://mirrors.bfsu.edu.cn/"
# Fetch the latest signed file
SIGNED_FILE=$(curl -s "${MIRROR_URL}gentoo/releases/amd64/autobuilds/current-stage3-amd64-desktop-systemd/latest-stage3-amd64-desktop-systemd.txt")

tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner -C /mnt/gentoo

cp --dereference /etc/resolv.conf /mnt/gentoo/etc/
arch-chroot /mnt/gentoo
echo 'RUSTFLAGS="${RUSTFLAGS} -C target-cpu=native"' >> /etc/portage/make.conf
sed -i '/^COMMON_FLAGS=/ s/"$/ -march=native"/' /etc/portage/make.conf
echo "*/* $(cpuid2cpuflags)" > /etc/portage/package.use/00cpu-flags

tee -a /etc/portage/make.conf <<EOF

GRUB_PLATFORMS="emu efi-32 efi-64 pc"
USE="X fcitx5 tkip kcm cjk"
ACCEPT_LICENSE="* -@EULA"
VIDEO_CARDS="nvidia amdgpu radeon radeonsi intel mesa"

EOF

tee -a /etc/portage/package.use/01studio <<EOF
# testing 
*/* ~amd64
# kernel
sys-kernel/installkernel dracut grub
# kde
kde-plasma/plasma-meta networkmanager kwallet display-manager sddm wacom systemd sdk rdp plymouth oxygen-theme gtk grub discover bluetooth smart
kde-plasma/kde-apps-meta admin education games graphics multimedia network pim sdk utils
# latex
app-text/texlive X cjk context extra games graphics humanities luatex metapost music pdfannotextractor png pstricks publishers science tex4ht texi2html truetype xetex xml
EOF
touch /etc/portage/package.use/zz-autoconfig

cp /usr/share/portage/config/repos.conf /etc/portage/repos.conf/gentoo.conf
sed -i 's|rsync://rsync.gentoo.org/gentoo-portage|rsync://mirrors.bfsu.edu.cn/gentoo-portage|' /etc/portage/repos.conf/gentoo.conf
emerge --sync
#eselect profile list | grep plasma
#eselect profile set 
emerge --ask --verbose --update --deep --changed-use @world
emerge --autounmask-write mirrorselect bash-completion net-misc/networkmanager \
app-portage/cpuid2cpuflags sudo glances app-misc/screen \
sys-kernel/installkernel sys-kernel/linux-firmware sys-kernel/gentoo-kernel \
plasma-meta kde-apps-meta \
firefox chromium \
app-editors/kile app-text/texlive

cd /etc/portage/package.use
etc-update --automode -5

emerge mirrorselect bash-completion net-misc/networkmanager \
app-portage/cpuid2cpuflags sudo glances app-misc/screen \
sys-kernel/installkernel sys-kernel/linux-firmware sys-kernel/gentoo-kernel 
grub-install --efi-directoy=/boot/efi --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

systemctl enable systemd-networkd
systemctl enable systemd-resolved
systemctl enable bluetooth
systemctl enable NetwrokManager
passwd
emerge plasma-meta kde-apps-meta \
firefox chromium \
app-editors/kile app-text/texlive
systemctl enable ssdm