ホーム 暮らし I tried installing Gentoo Linux

I tried installing Gentoo Linux

真鍋 千夏 真鍋 千夏 • 更新: • 公開: • 読了約 29 分
目次

Hello, this is Furi. Today I will introduce Gentoo Linux.

What is Gentoo Linux?

na7be278879a5

I think Gentoo Linux is a unique Linux distribution within the Linux ecosystem. It also sits at a very high level of difficulty.
The package manager used is primarily "Portage (emerge)" to manage packages.
What makes it significantly different from other Linux distributions is that it adopts a method of compiling and installing, so installation takes an absurd amount of time. For example, Arch Linux certainly consumes a lot of time, but once you get used to it, you can install it in about 20 minutes. However, Gentoo requires the time for compilation, so it takes a long time no matter what.
The reason for doing such a troublesome thing is that by doing the compilation yourself, you use a method of building OSS software and the like yourself, so
you can install various software without joking. You can get compact software using USE flags.
Please see the following site for details.

Gentoo's init system

Gentoo's init system maintains an init system called OpenRC, and it felt quite easy to use, but Gentoo also supports systemd, so you can choose whether to take the "philosophy" or the "practicality".
Basically, non-systemd Linux distributions like Void Linux don't allow you to use systemd, so this is a very good impression. Please see the following article for OpenRC.


Can it be used as a main OS?

I think Gentoo Linux can be used as a main OS. If you have the endurance to withstand full compilation, there is no problem at all. Also, once the installation up to the GUI is complete, you can just watch YouTube while compiling in the terminal. The initial installation is painful, but once that is over, it is not that painful.


Arch vs Gentoo

The difference between Arch Linux and Gentoo Linux, which are famous for being difficult Linux distributions, is whether they are binary files or source code. I think it is correct to say that Arch Linux is like an assembly kit. Arch Linux is about having various choices, arranging them, and assembling them to complete it. For Gentoo, it is correct to say that you throw the assembly kit in the trash, bring a metal plate, and start processing it. Therefore, the trouble is overwhelmingly greater with Gentoo.
Since both packages are rolling, you can use high-speed packages for both.

Gentoo recommendation points


ebuild files

The emerge package manager feels pretty good.
For example, there is something like a blueprint for building called ebuild, and you can see that blueprint. For example, the following is the content of the fcitx5 ebuild.

# Copyright 2023-2026 Gentoo Authors
Distributed under the terms of the GNU General Public License v2

EAPI=8

MY_PN="fcitx5"

inherit cmake flag-o-matic toolchain-funcs unpacker xdg

DESCRIPTION="Fcitx 5 is a generic input method framework"
HOMEPAGE="https://fcitx-im.org/ https://github.com/fcitx/fcitx5"
SRC_URI="https://download.fcitx-im.org/fcitx5/fcitx5/fcitx5-$PV_dict.tar.zst -> $P.tar.zst"

S="$WORKDIR/$MY_PN-$PV"
LICENSE="LGPL-2+ Unicode-DFS-2016"
SLOT="5"
KEYWORDS="amd64 arm64 ~ppc ppc64 ~riscv x86"
IUSE="+autostart doc +emoji +enchant +keyboard presage +server systemd system-yoga test wayland +X"
REQUIRED_USE="
	|| ( wayland X )
	X? ( keyboard )
	wayland? ( keyboard )
"

RESTRICT="!test? ( test )"

RDEPEND="
	dev-libs/libfmt
	sys-devel/gettext
	virtual/libintl
	x11-libs/cairo[X?]
	x11-libs/gdk-pixbuf:2
	x11-libs/pango[X?]
	doc? (
		app-text/doxygen
		dev-texlive/texlive-fontutils
	)
	emoji? ( virtual/zlib:= )
	enchant? ( app-text/enchant:2 )
	keyboard? (
		app-text/iso-codes
		dev-libs/expat
		dev-cpp/nlohmann_json
		x11-misc/xkeyboard-config
		x11-libs/libxkbcommon[X?,wayland?]
	)
	systemd? (
		sys-apps/systemd
	)
	!systemd? (
		dev-libs/libuv
		sys-apps/dbus
	)
	system-yoga? (
		dev-libs/yoga
	)
	wayland? (
		dev-libs/glib:2
		dev-libs/wayland
		dev-libs/wayland-protocols
		dev-util/wayland-scanner
	)
	X? (
		dev-libs/glib:2
		>=x11-libs/xcb-imdkit-1.0.3:5
		x11-libs/libX11
		x11-libs/libxkbfile
		x11-libs/xcb-util
		x11-libs/xcb-util-keysyms
		x11-libs/xcb-util-wm
	)
"
DEPEND="$RDEPEND
	wayland? (
		dev-libs/plasma-wayland-protocols
	)
"
BDEPEND="
	virtual/pkgconfig
	kde-frameworks/extra-cmake-modules:0
"

src_configure() 
	if [[ $(tc-get-cxx-stdlib) == "libc++" ]]; then
std::osyncstream used in fcitx-utils/log.cpp is marked as experimental.
		append-cxxflags $(test-flags-CXX -fexperimental-library)
	fi

	local mycmakeargs=(
		-DENABLE_DBUS=on
		-DENABLE_XDGAUTOSTART=$(usex autostart)
		-DENABLE_SERVER=$(usex server)
		-DENABLE_KEYBOARD=$(usex keyboard)
		-DENABLE_TEST=$(usex test)
		-DENABLE_ENCHANT=$(usex enchant)
		-DENABLE_EMOJI=$(usex emoji)
		-DENABLE_PRESAGE=$(usex presage)
		-DENABLE_WAYLAND=$(usex wayland)
		-DENABLE_X11=$(usex X)
		-DENABLE_DOC=$(usex doc)
		-DUSE_SYSTEMD=$(usex systemd)
		-DUSE_SYSTEM_YOGA=$(usex system-yoga)
	)
	cmake_src_configure


src_compile() 
	cmake_src_compile
	use doc && cmake_src_compile doc


src_test() 
break by sandbox
	local CMAKE_SKIP_TESTS=(
		testdbus
		testservicewatcher
	)
	cmake_src_test


src_install() 
	cmake_src_install
	use doc && dodoc -r "$BUILD_DIR"/doc/*


pkg_postinst() 
	xdg_pkg_postinst

	elog
	elog "Follow the instructions on:"
	elog "https://wiki.gentoo.org/wiki/Fcitx#Using_Fcitx"
	elog "https://fcitx-im.org/wiki/Setup_Fcitx_5"
	elog "https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland"
	elog

If you want to see the same thing or if you want to see the ebuild

ls /var/db/repos/

Everything is inside.

In my case, I have added the gentoo-zh and librewolf repositories, but I think there is only the gentoo directory in the initial state.
This "gentoo" repository is the standard repository.

This is the content of the gentoo directory. There are quite a few things, but in Gentoo, software is divided by family. For example, if you want to find the Firefox ebuild.

sudo emerge --search firefox

Search for Firefox with this once.

Then, since Firefox is listed as "www-client/firefox",
you can see that it belongs to the "www-client" family. Let's grep for www-client in the directory we were just in.

There is a directory. Let's look inside it.

Then, you will find not only Firefox, but also other browser groups like chrome and opera. However, since this is about Firefox, let's go to the Firefox directory.

Then, you can find the ebuild. If you want to see the contents, try looking at it yourself using vim or the cat command.

Installation

You can see various things with the --ask option when installing software with emerge.

When setting up Gentoo, you choose a profile, and based on that, it automatically determines the USE flags for you. In the image, the red text represents the USE flags that will be used, and the blue text represents the USE flags that will be discarded.

You can see the profile by displaying the emerge version.
In my case, I have selected the "default/linux/amd64/23.0/desktop/plasma/systemd" profile, so the USE flags are automatically adjusted accordingly.

Licenses

Gentoo can also be strict about licenses. For example, whether it is non-free software, free software, extremely free, or just free...
In my case, since it is a test/development environment, I don't have time to worry about licenses one by one, but if I were installing it on a real machine, I would manage them.
Please see the following for information regarding licenses.

You can also see settings related to licenses from here.

You can skip license-related checks just by adding the following to make.conf.

ACCEPT_LICENSE="*"
Adding a repository

Actually, as I showed briefly earlier, you can add repositories.
For example, the LibreWolf browser is not in the initial Gentoo repository.
Therefore, you can add it via command.

sudo eselect repository add librewolf git https://codeberg.org/librewolf/gentoo.git
sudo emerge --sync librewolf

source:

Also, you can add repositories using the concept of an overlay.

For example, if you want to install Hazkey

it belongs to the gentoo-zh family, so enable gentoo-zh.

Before that, install git and eselect-repository.
You can skip this if you already have them.

sudo emerge --ask app-eselect/eselect-repository dev-vcs/git

After that, enable it and sync.

sudo eselect repository enable gentoo-zh
sudo emaint sync -r gentoo-zh

Then, you can find it with emerge --search.


Gentoo custom points

Compilation

It is both a merit and a demerit, but the initial Gentoo installation took several hours.
Even with the binary files that Gentoo has recently allowed, you still have to compile some parts, so it takes quite a long time. It's unbearable.

Gentoo Handbook

In all seriousness, it is incredibly confusing. The Arch Linux installation guide is the same way, but because they cram every bit of information in, it becomes hard to understand. For example, Secure Boot is completely optional, but the Gentoo Handbook writes it as if it's standard. (They should just make a Secure Boot page.) So, I was confused when I first saw it.
What's even worse than the Arch Wiki is that when you set the Arch Wiki to Japanese, it includes methods specific to Japanese users, such as Keymaps, but the Gentoo Handbook is just a direct translation into Japanese, so I thought it was fairly unfriendly.

Amount of information

For Arch Linux, like me, there is a fair amount of information like installation guides, but for Gentoo alone, there isn't. That's why I ended up having to struggle through the installation using the Gentoo Handbook, but there are really very few articles that talk about the details of Gentoo. There were relatively many in the English-speaking world, but there are almost no Gentoo articles in Japanese. I checked Qiita and Zenn, but they weren't there. They were all already old articles. It wasn't zero, but I still think it's too few.

AI

While looking at the Gentoo Handbook, I kept asking Qwen-3.8-MAX about things I didn't understand, but it gave me surprisingly nonsensical answers, so I almost ended up doubling my time. There were often times when I thought, 'Are you sane? You're telling me to exit chroot when I haven't even set up the bootloader yet!?' So, while I think it's fine to resolve questions, because Gentoo is so unique, it seems quite difficult for AI to be accurate. That said, it has helped me a few times, so if you really don't understand something while looking at the Gentoo Handbook, using AI might be an option.

Finally

Gentoo is quite niche and I think it's a Linux that is even more selective among Linux users, but it's not like Slackware where there's nothing, and it's not a blank slate like LFS, so I personally like Gentoo because you can customize it yourself while still retaining a moderate amount of convenience. Arch Linux is also free, but I don't think it's as free as Gentoo, so I like Gentoo.
In the end, Linux distributions are a matter of taste, so I think everyone should use the Linux distribution they think is the best.
I think the best Linux I've ever thought of is 'overwhelmingly Gentoo,' so please use it. (Also, please use it and increase the Japanese documentation...! monologue)

Thank you for reading until the end.

同じカテゴリの記事

真鍋 千夏
デジタルマーケター 真鍋 千夏
プロフィールを見る →

美容と暮らしの話題を担当。メーカーの公式発表、商品成分の公表資料、専門家の監修記事をもとに事実を整理します。

おすすめの関連記事