Ubuntu+WSL2環境でWindows 11とxfce4のコーヒーレントモード環境

この記事は 2 分で読めます。
概要

本記事では、Windows 11のWSL2 (Windows Subsystem for Linux) 環境でUbuntuデスクトップの完全な環境の構築方法をご紹介致します。Ubuntuサーバー立ち上げを行い、自身からUbuntuのリモートデスクトップ環境へ接続する方法です。

管理人

本記事の読者層は以下の方を想定しています。

本記事の読者層
  • Windows 11のWSL2環境でUbuntuデスクトップ環境を構築したい方
目次

Windows 11のWSL2環境でUbuntuデスクトップ環境を構築する方法

まだWindowsにWSL2をインストールしていない、という方は、こちらを参考にWSL2とUbuntu 20.04をインストールしてください。

不安な場合は、Windows11のPowerShell上でWSL2がインストールされているかは以下でコマンドで確認出来ます。

PS C:\Users\users> wsl --list --verbose
  NAME            STATE           VERSION
* Ubuntu-18.04    Running         2
  Ubuntu-20.04    Running         2

上記は、Ubuntu 18.04と20.04がインストールされている環境ですが「VERSION」がとなっていればWSL2がインストールされている環境ですので安心して下さい。

GUI環境を表示する先として、Windows側にXサーバーをインストールします。今回は、XサーバーソフトとしてVcXsrvを使用します。

インストール前に

最初にUbuntuのアップデート(ディストリビューションの更新)を行います。

$ sudo apt-get update
$ sudo apt-get upgrade

Ubuntuデスクトップ環境のインストール

以下の二つのコマンドを入力してX11環境とubuntuデスクトップ環境を整えます。

$ sudo apt-get install libgl1-mesa-dev xorg-dev xbitmaps x11-apps
$ sudo apt-get install ubuntu-desktop

ここまではエラーもなく進めます。ただ、「sudo apt-get install ubuntu-desktop」を入れるのにはそれなり時間がかかります。

LinuxサーバーとWindows11を繋ぐ
このままでは、X11は利用できますが、Windows11でのUbuntuのデスクトップ環境は利用できません。

Xfce4のインストール

以下の操作はX11を利用するだけであればインストールしなくても問題ないです。

まずはxfce4をインストールします。

$ sudo apt install xfce4-session

をインストールします。これはubuntuにデスクトップ環境をインストールすることで次ぎに説明するリモートデスクトップ環境(RDP)を通してUbuntuデスクトップ環境にアクセスする方法です。セッションタイプはXorgで接続します。

以下のようなエラーはでますが、立ち上がります。

>xfce4-session
gpg-agent[838]: WARNING: "--write-env-file" is an obsolete option - it has no effect
gpg-agent: a gpg-agent is already running - not starting a new one

(xfce4-session:828): xfce4-session-WARNING **: 16:35:49.838: gpg-agent returned no PID in the variables
xfsettingsd: Another clipboard manager is already running.
Failure: Module initialization failed

(xfce4-session:828): Wnck-CRITICAL **: 16:35:50.095: wnck_workspace_activate: assertion 'WNCK_IS_WORKSPACE (space)' failed
(uint32 1,)
xscreensaver: 16:35:50: locking is disabled (running as nobody).
xscreensaver: 16:35:50: locking only works when xscreensaver is launched
         by a normal, non-privileged user (e.g., not "root".)
         See the manual for details.

(xfsettingsd:844): xfsettingsd-WARNING **: 16:35:50.175: Failed to get the _NET_NUMBER_OF_DESKTOPS property.

(xfce4-panel:843): Wnck-CRITICAL **: 16:35:50.312: wnck_workspace_is_virtual: assertion 'WNCK_IS_WORKSPACE (space)' failed

** (update-notifier:900): WARNING **: 16:35:50.477: not starting for system user

(nm-applet:864): Gtk-WARNING **: 16:35:50.618: Can't set a parent on widget which has a parent
/usr/share/system-config-printer/applet.py:45: PyGIWarning: Notify was imported without specifying a version first. Use gi.require_version('Notify', '0.7') before import to ensure that the right version gets loaded.
  from gi.repository import Notify

(nm-applet:864): Gdk-CRITICAL **: 16:35:50.792: gdk_window_thaw_toplevel_updates: assertion 'window->update_and_descendants_freeze_count > 0' failed

まとめ

本記事のまとめ
  • WindowsとmacOSともに、SSH接続には、SSH v2のRSA規格を利用する方が安全です。

次回の記事をご期待下さい。どうぞよろしくお願いいたします。

関連リンク

よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

コメント

コメントする

目次