Created
November 26, 2019 11:06
-
-
Save Lzs4Kzx3/11819a854c783139e92464f7da7a1c34 to your computer and use it in GitHub Desktop.
Gentoo をインストールしたときのメモ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gentoo(AMD64)のインストールドキュメント | |
前提 | |
Gentooハンドブック(https://wiki.gentoo.org/wiki/Handbook:AMD64/ja)を見ながら作業を進めること. | |
このマニュアルはUEFIシステムを対象としている. | |
インストール環境 | |
CPU: Intel Core i5 7600 3.5GHz 4C/4T | |
Mem: 24GB | |
HDD: 3TB | |
Dev: USB | |
LAN: Ethernet | |
必要物 | |
GentooのインストールUdisk | |
インストール用PC | |
手順 | |
ブートオプションにインストール用のUdiskを指定する. | |
起動時にキーボード設定が聞かれる. | |
日本語 22 を選択する. | |
ネットワークの確認 | |
ifconfigでネットワークの情報を確認する. | |
ping -c 3 www.gentoo.orgでネットワークの接続を確認する. | |
ディスクの設定 | |
パーティションの構成 | |
1 dev/sda1 EF02 boot 2.0MB | |
2 dev/sda2 EF00 EFI 512.0MB | |
3 dev/sda3 8200 swap 8.0GB | |
4 dev/sda4 8300 root 1TB | |
gdiskを使用して設定を行う | |
gdisk /dev/sda | |
gdiskの使用方法 | |
p 現在のパーティションを表示する | |
n 新しいパーティションを作成する | |
t パーティションのコードを変更する | |
d パーティションを削除する | |
o 新しいパーティションテーブルを作成する | |
gdiskの基本的な流れ | |
gdisk /dev/sda | |
nでパーティションの追加 | |
最初のセクターを設定(基本的にデフォルトの設定を選ぶ) | |
終了のセクターを設定(+100Gのように容量を直接指定できる) | |
コードを設定(Lでそれぞれのコードを確認できる) | |
新しいパーティションができればpで確認する | |
この状態ではパーティションの設定が反映されていないため, | |
wで設定を反映する. | |
ファイルシステムを作成する | |
EFIシステム(dev/sda2)はfat32にする | |
mkfs.fat -F32 /dev/sda2 | |
swapの設定 | |
mkswap /dev/sda3 | |
swapon /dev/sda3 | |
ルートパーティションはext4にする | |
mkfs.ext4 /dev/sda4 | |
パーティションのマウントを行う | |
rootパーティション | |
mount /dev/sda4 /mnt/gentoo | |
bootディレクトリの作成 | |
mkdir /mnt/gentoo/boot | |
efiパーティション | |
mount /dev/sda2 /mnt/gentoo/boot | |
日付の確認 | |
date | |
時刻を合わせる | |
ntpd -q -g | |
tarballのダウンロード | |
ディレクトリの移動 | |
cd /mnt/gentoo | |
別のパソコンなどで stage3 のURLを調べる(https://www.gentoo.org/downloads/#other-arches) | |
wgetで調べたURLからダウンロードを行う | |
wget http://distfiles.gentoo.org/releases/amd64/autobuilds/20190925T214502Z/stage3-amd64-20190925T214502Z.tar.xz | |
opensslでチェックサムの計算を行う | |
opensl dgst -r -sha512 ダウンロードしたstage3ファイル | |
DIGESTSファイルと比較して同じことを確認する | |
stage3を展開する | |
tar xpvf stage3ファイル --xattrs-include='*.*' --numeric-owner | |
makeの設定 | |
make.confでコンパイルの設定を行う | |
nano -w /mnt/gentoo/etc/portage/make.conf | |
make.conf | |
COMMON_FLAGS="-march=native -O2 -pipe" | |
CFLAGS="${COMMON_FLAGS}" | |
CXXFLAGS="${COMMON_FLAGS}" | |
MAKEOPTS="-j4" | |
chroot | |
ミラーを選択する | |
mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf | |
近くのミラーを選択する(spaceでセットできる) | |
リポジトリの設定 | |
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 | |
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 | |
chroot /mnt/gentoo /bin/bash | |
source /etc/profile | |
export PS1="(chroot) ${PS1}" | |
ブートパーティションのマウント | |
mount /dev/sda2 /boot | |
ebuildのスナップショットのインストール | |
emerge-websync | |
プロファイルリストの確認 | |
eselect profile list | |
プロファイルのセット | |
eselect profile set 16 | |
@worldを更新する | |
emerge --ask --verbose --update --deep --newuse @world | |
USEフラグの確認 | |
less /var/db/repos/gentoo/profiles/use.desc | |
USEリストの設定 | |
nano -w /etc/portage/make.conf | |
make.conf | |
USE="-gtk -gnome -qt4 -qt5 -kde -alsa" | |
タイムゾーンの確認 | |
ls /usr/share/zoneinfo | |
タイムゾーンの設定 | |
echo "Asia/Tokyo" > /etc/timezone | |
パッケージの再設定 | |
emerge --config sys-libs/timezone-data | |
ロケールの設定 | |
nano -w /etc/locale.gen | |
en_US ISO-8859-1 | |
en_US.UTF-8 UTF-8 | |
ja_JP.UTF-8 UTF-8 | |
ロケールの生成 | |
locale-gen | |
ロケールの確認 | |
eselect locale list | |
ロケールのセット | |
eselect locale set 1 | |
環境のリロード | |
env-update && source /etc/profile && export PS1="(chroot) ${PS1}" | |
カーネルソースのインストール | |
emerge --ask sys-kernel/gentoo-sources | |
ディレクトリの移動 | |
cd /usr/src/linux | |
カーネルオプションの設定 | |
gentoo wikiを参考に設定する | |
コンパイルとインストールを行う | |
make && make modules_install | |
カーネルイメージのコピー | |
make install | |
ファームウェアのインストール | |
emerge --ask sys-kernel/linux-firmware | |
fstabの設定 | |
nano -w /etc/fstab | |
/dev/sda2 /boot vfat noauto,noatime 1 2 | |
/dev/sda4 / ext4 noatime 0 1 | |
/dev/sda3 none swap sw 0 0 | |
ネットワークの設定 | |
ホスト名の設定 | |
nano -w /etc/conf.d/hostname | |
emerge --ask --noreplace net-misc/netifrc | |
ネットワークの自動設定 | |
cd /etc/init.d | |
ln -s net.lo net.enp0s31f6 | |
rc-update add net.enp0s31f6 default | |
パスワードの設定 | |
passwd | |
キーマップの設定 | |
nano -w /etc/conf.d/keymaps | |
keymap="jp106" | |
cronの設定 | |
emerge --ask sys-process/cronie | |
rc-update add cronie default | |
sshの設定 | |
rc-update add sshd default | |
DHCPのインストール | |
emerge --ask net-misc/dhcpcd | |
grubの設定 | |
emerge --ask --verbose sys-boot/grub:2 | |
echo 'GRUB_PLATFORMS="efi-64"' >> /etc/portage/make.conf | |
emerge --ask --update --newuse --verbose sys-boot/grub:2 | |
mkdir -p /boot/efi | |
emerge grub efibootmgr | |
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=gentoo_grub /dev/sda | |
mkdir -p /boot/efi/boot | |
cp /boot/efi/gentoo_grub/grubx64.efi /boot/efi/boot/bootx64.efi | |
grub-mkconfig -o /boot/grub/grub.cfg | |
再起動 | |
exit | |
cd | |
umount -l /mnt/gentoo/dev{/shm,/pts,} | |
umount -R /mnt/gentoo | |
reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment