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?

Proxmox上のAlpineLinuxコンテナへGUIを導入してRDPでアクセスする方法

Posted at

タイトルの通りです。

目標

  • 「とりあえず動く」状態
  • LXC上のコンテナにGUI環境を構築
  • RDPでコンテナにアクセスできること
  • GUIで操作でき、Yahooが日本語で表示されること
  • 音声は出なくてもいい

使ったツール等

  • Proxmox 9.1
  • Alpine Linux 3.22のコンテナイメージ
    (入っていない場合は、pveam updateでリストを更新)
  • RDPクライアントとしてWindowsマシン

手順

事前準備:CT作成

手順割愛しますが、ブラウザ用にメモリやCPUを増やしてください。

  • メモリは2048MB以上
  • CPUは2コア以上
  • ディスクは2GB以上
  • できれば固定IP

準備:作成後の作業

まずapkのアップデートをしてmainとcommunityどちらもfetchされることを確認してください。

alpine:~# apk update
fetch https://dl-cdn.alpinelinux.org/alpine/v3.22/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.22/community/x86_64/APKINDEX.tar.gz
v3.22.2-230-g2e97d754a30 [https://dl-cdn.alpinelinux.org/alpine/v3.22/main]
v3.22.2-239-g67de390e951 [https://dl-cdn.alpinelinux.org/alpine/v3.22/community]
OK: 26341 distinct packages available

setup-desktopを実行してxfce4を入れます。
デスクトップ環境はいくつか選択肢があります。

  • gnome
  • xfce
  • mate
  • sway
  • lxqt
  • none ←これを選んだらどうなるのか試してません

このときにユーザー追加もできます。
今回はuserという名前で設定しました。

alpine:~# setup-desktop
Setup a user? (enter a lower-case loginname, or 'no') [no] user
Full name for user user [user] 
Changing password for user
New password: 
Bad password: similar to username
Retype password: 
passwd: password for user changed by root
Enter ssh key or URL for user (or 'none') [none] 
Which desktop environment? ('gnome', 'xfce', 'mate', 'sway', 'lxqt' or 'none') [none] xfce
Updating repository indexes... done.
(1/365) Installing dbus-libs (1.16.2-r1)
<長いので省略>
Executing desktop-file-utils-0.28-r0.trigger
OK: 1001 MiB in 397 packages
 * Caching service dependencies ... [ ok ]
 * Udev requires /dev to be a mounted devtmpfs.
 * Please reconfigure your system.
 * ERROR: udev failed to start
 * service lightdm added to runlevel default
 * rc-update: service `acpid' is not in the runlevel `default'

フォントを入れます。
とりあえず日本語が出ればいいのでfont-noto-cjkです。

alpine:~# apk add font-noto-cjk
(1/1) Installing font-noto-cjk (0_git20220127-r1)
Executing fontconfig-2.15.0-r3.trigger
Executing mkfontscale-1.2.3-r1.trigger
OK: 1089 MiB in 398 packages

xrdpとxorgxrdpを入れます。

alpine2:~# apk add xrdp xorgxrdp
(1/7) Installing xorgxrdp (0.10.4-r0)
(2/7) Installing readline (8.2.13-r1)
(3/7) Installing bash (5.2.37-r0)
Executing bash-5.2.37-r0.post-install
(4/7) Installing fuse3-libs (3.16.2-r1)
(5/7) Installing libturbojpeg (3.1.0-r0)
(6/7) Installing xrdp (0.10.3-r0)
Executing xrdp-0.10.3-r0.post-install

Generating 2048 bit rsa key...

ssl_gen_key_xrdp1 ok

saving to /etc/xrdp/rsakeys.ini

lib/apk/exec/xrdp-0.10.3-r0.post-install: line 7: openssl: not found
(7/7) Installing xrdp-openrc (0.10.3-r0)
Executing busybox-1.37.0-r18.trigger
OK: 1095 MiB in 405 packages

xrdpが自動的に起動するように設定します

alpine:~# rc-update add xrdp
 * service xrdp added to runlevel default
alpine:~# rc-update add xrdp-sesman
 * service xrdp-sesman added to runlevel default
alpine:~# rc-
rc-service  rc-sstat    rc-status   rc-update
alpine:~# rc-service xrdp start
 * Caching service dependencies ... [ ok ]
 * Starting xrdp ... [ ok ]
alpine:~# rc-service xrdp-sesman start
 * Starting xrdp-sesman ... [ ok ]

動作確認

手順だけ

  • Win+R → mstsc リモートデスクトップを起動
  • 接続先IPとして、先に作成したコンテナを指定
  • 認証などはとりあえずはいで進める
    (本当はよくないのですが、目的が「とりあえず動かす」なので、あえてセキュリティ関係を無視しています)
  • 画面が表示されてxrdpのウィンドウがでたら、ユーザー名とパスワードを入力してOKボタンをクリック
  • xfce4の画面が出てきたらログインは成功
  • 画面下側中央、地球にマウスカーソルのアイコンをクリックしてFirefoxが起動すれば、目的は達成。Yahoo Japanが見られればおおよそ問題ないはず

やり残し

動きはしますが、以下のことが未設定です。

  • 日本語入力の設定
  • ロケールの設定
  • タイムゾーンの設定
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?