0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

debian trixieにcockpitを入れてみる

Posted at

■新しめのHWだとbookwormのkernelやドライババグを踏みやすいので、いわゆるtestingをクリーンインストール選択。

$ sudo tasksel --list-tasks | grep ^i
i desktop	Debian デスクトップ環境
i mate-desktop	MATE
i ssh-server	SSH サーバ

$ head -n 2 /etc/*release
PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
NAME="Debian GNU/Linux"

■cockpitを入れる

$ sudo apt -y install cockpit

■cockpitへのrootログインを許可するならコメントアウトする
 個人的にはログイン後に昇格する方針のため不要

$ cat /etc/cockpit/disallowed-users
# List of users which are not allowed to login to Cockpit
root

■cockpitサービスは自動で上がるので、基本的に「enable」指定は不要
 「status」くらいは確認しましょう

$ sudo systemctl status cockpit.socket
● cockpit.socket - Cockpit Web Service Socket
     Loaded: loaded (/usr/lib/systemd/system/cockpit.socket; enabled; preset: enabled)
     Active: active (listening) since Sat 2025-06-14 22:25:17 JST; 1min 49s ago
 Invocation: 68ad01118eb244c0928c8f403d7eed16
   Triggers: ● cockpit.service
       Docs: man:cockpit-ws(8)
     Listen: [::]:9090 (Stream)
    Process: 5847 ExecStartPost=/usr/share/cockpit/issue/update-issue  localhost (code=exited, status=0/SUCCESS)
    Process: 5854 ExecStartPost=/bin/ln -snf active.issue /run/cockpit/issue (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 18730)
     Memory: 84K (peak: 2.2M)
        CPU: 28ms
     CGroup: /system.slice/cockpit.socket

 6月 14 22:25:17 acemagic-debian systemd[1]: Starting cockpit.socket - Cockpit Web Service Socket...
 6月 14 22:25:17 acemagic-debian systemd[1]: Listening on cockpit.socket - Cockpit Web Service Socket.

■待ち受けポートを確認してWeb管理画面にアクセス

$ ss -ltn | grep 9090
LISTEN 0      4096               *:9090            *:*   

■LDAP用の389-dsは使わないので、KVM用にmachinesとdocker用にpodmanを追加

$ apt-cache search ^cockpit | awk '{print "dpkg -l "$1}' | sh >/dev/null
dpkg-query: cockpit-389-ds に一致するパッケージが見つかりません
dpkg-query: cockpit-machines に一致するパッケージが見つかりません
dpkg-query: cockpit-podman に一致するパッケージが見つかりません

$ sudo apt install -y cockpit-machines cockpit-podman

■podman-dockerを入れる

$ dpkg -l podman-docker || sudo apt install -y podman-docker
dpkg-query: podman-docker に一致するパッケージが見つかりません
Installing:                                                 
  podman-docker

Installing dependencies:
  docker-compose

推奨パッケージ:
  docker-cli

Summary:
  Upgrading: 0, Installing: 2, Removing: 0, Not Upgrading: 0
  Download size: 13.0 MB
  Space needed: 64.7 MB / 25.5 GB available

...省略...

$ docker version
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
Client:        Podman Engine
Version:       5.4.2
API Version:   5.4.2
Go Version:    go1.24.2
Built:         Sun May 25 03:25:04 2025
Build Origin:  Debian
OS/Arch:       linux/amd64

■KVMは以下と同じで、一旦はcockpitを使わずに入れる
 後でcockpit流の使い方を調べる方針とする

■仮想マシンマネージャを追加する

$ sudo apt install -y virt-manager

■ufwやgufwでルータ機能を有効にする

$ sudo apt install -y ufw
$ sudo cp /etc/default/ufw{,.back}
$ sudo sed -i -e 's/DEFAULT_FORWARD_POLICY="DROP"/DEFAULT_FORWARD_POLICY="ACCEPT"/' /etc/default/ufw

$ sudo diff /etc/default/ufw{,.back}
19c19
< DEFAULT_FORWARD_POLICY="ACCEPT"
---
> DEFAULT_FORWARD_POLICY="DROP"

$ sudo cp /etc/ufw/sysctl.conf{,.back}
$ sudo sed -i -e 's%#\(net/ipv4/ip_forward=1\)%\1%' /etc/ufw/sysctl.conf 

$ diff /etc/ufw/sysctl.conf{,.back}
10c10
< net/ipv4/ip_forward=1
---
> #net/ipv4/ip_forward=1

■上位にFWあるので、受信はssh(22)とcockpit(9090)の許可くらい

$ sudo ufw status verbose
Status: active
Logging: on (low)
Default: reject (incoming), allow (outgoing), allow (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW IN    Anywhere  
9090                       ALLOW IN    Anywhere
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?