LoginSignup
0
0

More than 1 year has passed since last update.

LXD で Gentoo を使う

Last updated at Posted at 2020-10-09

Ubuntu 22.04 にインストールされた lxd 5.6 に Gentoo をインストールし設定する方法です。
インストールが完了してログインすると次のようになります。

$ ssh gentoo.local
uchida@gentoo ~ $ uname -a
Linux gentoo 5.15.0-50-generic #56-Ubuntu SMP Tue Sep 20 13:23:26 UTC 2022 x86_64 AMD Ryzen 5 5560U with Radeon Graphics AuthenticAMD GNU/Linux
uchida@gentoo ~ $ cat /etc/os-release 
NAME=Gentoo
ID=gentoo
PRETTY_NAME="Gentoo Linux"
ANSI_COLOR="1;32"
HOME_URL="https://www.gentoo.org/"
SUPPORT_URL="https://www.gentoo.org/support/"
BUG_REPORT_URL="https://bugs.gentoo.org/"
VERSION_ID="2.8"

次のページを参考にしました。
Gentoo LXD Container

FINGERPRINT を調べる

$ lxc image list images: | grep gentoo | grep amd64
| gentoo/cloud (3 more)                    | 2d854bdf45a8 | yes    | Gentoo current amd64 (20221011_16:08)        | x86_64       | VIRTUAL-MACHINE | 1414.14MB | Oct 11, 2022 at 12:00am (UTC) |
| gentoo/cloud (3 more)                    | f9ec923ff0dd | yes    | Gentoo current amd64 (20221011_16:08)        | x86_64       | CONTAINER       | 713.84MB  | Oct 11, 2022 at 12:00am (UTC) |
| gentoo/openrc (3 more)                   | 4efafa2ff5a5 | yes    | Gentoo current amd64 (20221011_16:08)        | x86_64       | CONTAINER       | 274.59MB  | Oct 11, 2022 at 12:00am (UTC) |
| gentoo/openrc (3 more)                   | d19961c172ff | yes    | Gentoo current amd64 (20221011_16:08)        | x86_64       | VIRTUAL-MACHINE | 887.64MB  | Oct 11, 2022 at 12:00am (UTC) |
| gentoo/systemd (3 more)                  | 3e8c1f5fb841 | yes    | Gentoo current amd64 (20221011_16:07)        | x86_64       | CONTAINER       | 292.82MB  | Oct 11, 2022 at 12:00am (UTC) |
| gentoo/systemd (3 more)                  | 4c8800a0f950 | yes    | Gentoo current amd64 (20221011_16:07)        | x86_64       | VIRTUAL-MACHINE | 922.13MB  | Oct 11, 2022 at 12:00am (UTC) |

OS のインストール

lxc init images:4efafa2ff5a5 gentoo

走っているかの確認

lxc list gentoo

止まっている時は次のようになります。

$ lxc list gentoo
+--------+---------+------+------+-----------+-----------+
|  NAME  |  STATE  | IPV4 | IPV6 |   TYPE    | SNAPSHOTS |
+--------+---------+------+------+-----------+-----------+
| gentoo | STOPPED |      |      | CONTAINER | 0         |
+--------+---------+------+------+-----------+-----------+

開始するコマンド

lxc start gentoo

root パスワードの設定

$ lxc exec gentoo bash
gentoo ~ # passwd
New password: 
BAD PASSWORD: it does not contain enough DIFFERENT characters
Retype new password: 
passwd: password updated successfully

root で login

$ lxc console gentoo
To detach from the console, press: <ctrl>+a q

gentoo login: root
Password: 
Last login: Sun Oct 11 23:40:16 -00 2020 on console
-bash: cannot set terminal process group (714): Inappropriate ioctl for device
-bash: no job control in this shell
gentoo ~ #

login 後の設定

ユーザー、パスワードの設定

useradd -u 1200 -m -G users,wheel,audio -s /bin/bash uchida
passwd uchida

sudo のインストール

emerge -avt app-admin/sudo --quiet
visudo

次のエラーが出た場合の対応方法

gentoo ~ # emerge -avt app-admin/sudo --quiet


!!! /etc/portage/make.profile is not a symlink and will probably prevent most merges.
!!! It should point into a profile within /var/db/repos/gentoo/profiles/
!!! (You can safely ignore this message when syncing. It's harmless.)


!!! Your current profile is invalid. If you have just changed your profile
!!! configuration, you should revert back to the previous configuration.
!!! Allowed actions are limited to --help, --info, --search, --sync, and
!!! --version.
gentoo ~ # emerge-webrsync

sshd のインストール

sudo emerge -avt openssh --quiet
sudo rc-update add sshd default
sudo rc-service sshd start

avahi のインストール

sudo emerge --ask net-dns/avahi --quiet
sudo rc-update add avahi-daemon default
sudo rc-service avahi-daemon  start

vim のインストール

emerge --ask app-editors/vim
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0