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?

Google CloudのLinuxサーバにGNOMEを入れてGUI化しようとした話

Posted at

はじめに

Google Cloud のCompute EngineでLinuxサーバを立ち上げると、基本は GUIなし構成 です。
「GNOMEを入れてGUI化してみよう」と思う方も多いと思います。

この記事では、RHEL 9 と Debian 12 で実際にGUI化を試した結果をまとめます。
結論から言うと、RHEL 9では失敗、Debianでは成功 でした。


仮想ディスプレイの有効化(共通手順)

GCPのVMはデフォルトで「仮想ディスプレイ」が無効になっています。
そのためGUIを使うには、事前に有効化が必要です。

# インスタンスを停止
gcloud compute instances stop <インスタンス名> --zone=<ゾーン名>

# 仮想ディスプレイを有効化
gcloud compute instances update <インスタンス名> \
  --zone=<ゾーン名> \
  --enable-display-device

# インスタンスを再起動
gcloud compute instances start <インスタンス名> --zone=<ゾーン名>

これを行っていないと、gdmやxrdpが「画面デバイスがない」と判断してエラーで止まることがあります。


RHEL 9 の場合(失敗)

# パッケージ更新
sudo dnf update -y

# GNOMEデスクトップ環境インストール
sudo dnf groupinstall "Server with GUI" -y

# 起動ターゲットをGUIに変更
sudo systemctl set-default graphical

# 再起動
sudo reboot

この時点で 再起動後にSSHできなくなりました


別のインスタンスを立ち上げて、RDP接続用にxrdpを入れようとしましたが…

sudo dnf install epel-release -y
sudo dnf install xrdp -y
sudo systemctl enable --now xrdp

結果

  • epel-release が見つからない
  • xrdp パッケージも見つからない

私の環境では、RHEL 9でGUIを正常に起動できませんでした。


Debian 12 (成功)

続いてDebianで試しました。

# パッケージ更新
sudo apt update && sudo apt upgrade -y

# GNOMEデスクトップ環境インストール
sudo apt install task-gnome-desktop -y

# RDPサーバ(xrdp)インストール
sudo apt install xrdp -y
sudo systemctl enable --now xrdp

WindowsのRDP接続でDebianではGNOMEのデスクトップが表示されました。


なぜRHEL 9で失敗するのか

調べた結果、考えられる要因は以下です。

1. 仮想ディスプレイが標準で無い

GCPの公式にも

By default, VMs do not have virtual display devices.

と書かれています。
Enable virtual displays on a VM (Google Cloud公式)

2. RHELの標準リポジトリにxrdpが無い

私の環境(RHEL 9 / RHUIイメージ)では、epel-releasexrdp パッケージは見つかりませんでした。
EPELリポジトリや追加の設定が必要になる可能性があります。

代替手段(RHELでどうしてもGUIを使いたい場合)


まとめ

RHEL 9

  • GNOMEを入れてもGUI起動に失敗
  • xrdp は標準構成では導入不可(追加設定が必要になる可能性あり)

Debian 12

  • WindowsからRDP接続してGNOMEデスクトップを利用可能

結論

  • Google CloudでLinuxサーバをGUI化するならDebianのほうが圧倒的に楽
  • RHELのGUI化は追加設定が必要となり複雑になる
  • ベストプラクティスはCLI運用。どうしてもGUIが必要なら Debian + xrdpChrome Remote Desktop を選ぶのが現実的

おわりに

クラウド上のLinuxサーバをGUIで使いたいというニーズはありますが、Google CloudのCompute Engineは CLI運用が前提 で設計されています。

RHELに無理にGUIを入れるより、Debianを使うかChrome Remote Desktopを使うのが現実的 だと感じました。

同じように試す方の時間短縮になれば幸いです。

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?