1
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?

RHEL9 Cockpitをインストールしてみた

Last updated at Posted at 2025-05-16

はじめに

Cockpitをインストールしてみた

前提条件

ネットワーク構成

パブリックサブネットに NAT ゲートウェイを配置

プライベートサブネットのルートテーブルに、デフォルトルートとして上記 NAT ゲートウェイを設定

サーバ構成
踏み台サーバー(Bastion)

EC2 インスタンスをパブリックサブネットに配置

Cockpit サーバー

EC2 インスタンスをプライベートサブネットに配置

AL2023

Cockpitをインストール実施したら失敗しました。
「リポジトリにパッケージが見当たりません」というメッセージです。

# yum install -y cockpit
Amazon Linux 2023 repository                                                                                 36 MB/s |  37 MB     00:01
Amazon Linux 2023 Kernel Livepatch repository                                                               108 kB/s |  16 kB     00:00
No match for argument: cockpit
Error: Unable to find a match: cockpit

AL2023の標準リポジトリにはCockpitについては提供されていません。

$ yum search cockpit
Amazon Linux 2023 repository                                                                                 27 MB/s |  37 MB     00:01
Amazon Linux 2023 Kernel Livepatch repository                                                               148 kB/s |  16 kB     00:00
No matches found.

以下のcockpitの公式サイトを確認したところ、AL2023の記載がありませんでした。
https://cockpit-project.org/running

調べたところ、AL2023にはCockpitは対応していない可能性があり、
公式サイトにもAL2023のcockpitの記事が見当たりませんでした。

cockpitのパッケージからコンパイルする方法はありますが、
コンパイルは依存関係で引っかかるため高度なスキルが求められます。

上記からAL2023は諦めて、RHELにcockpitをインストールすることにしました。

RHEL9

以下の記事を参考にしました。
https://qiita.com/ynagashi/items/a56bf82c5056bea86003

cockpitをインストールしました。

# yum install -y cockpit

起動時にCockpitが起動するように設定します。

# systemctl enable --now cockpit.socket
Created symlink /etc/systemd/system/sockets.target.wants/cockpit.socket → /usr/lib/systemd/system/cockpit.socket.

cockpit.socketが起動できていることを確認する

# systemctl status  cockpit.socket
● cockpit.socket - Cockpit Web Service Socket
     Loaded: loaded (/usr/lib/systemd/system/cockpit.socket; enabled; preset: disabled)
     Active: active (listening) since Sat 2025-05-03 13:23:29 UTC; 48s ago
      Until: Sat 2025-05-03 13:23:29 UTC; 48s ago
   Triggers: ● cockpit.service
       Docs: man:cockpit-ws(8)
     Listen: [::]:9090 (Stream)
    Process: 16518 ExecStartPost=/usr/share/cockpit/motd/update-motd  localhost (code=exited, status=0/SUCCESS)
    Process: 16525 ExecStartPost=/bin/ln -snf active.motd /run/cockpit/motd (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 4377)
     Memory: 404.0K
        CPU: 12ms
     CGroup: /system.slice/cockpit.socket

May 03 13:23:29 ip-10-0-132-115.ap-northeast-1.compute.internal systemd[1]: Starting Cockpit Web Service Socket...
May 03 13:23:29 ip-10-0-132-115.ap-northeast-1.compute.internal systemd[1]: Listening on Cockpit Web Service Socket.

許可するセキュリティグループ

踏み台サーバのセキュリティグループ
image.png
※443を許可しいていなくてもcockpitのサイトにアクセスできました。80ポートの許可は必須です

cockpitをインストールした内部のサーバのセキュリティグループ
image.png

ローカル端末 コマンドプロンプトにて以下を実行

ポートフォワーディングについては以下の記事を参照
https://qiita.com/gama1234/items/92c7fe456868f959b5b1

ssh -i 踏み台サーバの秘密鍵.pem ec2-user@<踏み台のグローバルIPアドレス> -L 8080:<内部のサーバのプライベートIPアドレス>:9090

内部のサーバにてtestユーザを作成してパスワードを設定しました。

# useradd test

# passwd test
Changing password for user test.
New password:
Retype new password:

ブラウザに以下を入力してログインしました

https://localhost:8080/

image.png

まとめ

Cockpit は Amazon Linux 2023 の標準リポジトリに含まれていないため、今回は RHEL 9 環境に Cockpit をインストールしました。LDAP の管理画面として非常に便利であることに加え、踏み台サーバー経由のポートフォワーディングにより、プライベートサブネット内の Cockpit サーバーへ問題なくアクセスできることを確認しました。

cockpitはフルマシン上で実行させるのが望ましいそうです。
Dockerfile内でcockpitをインストールは可能ですがWEB画面を眺める程度で実際は正常に動作しない可能性もあります。

1
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
1
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?