LoginSignup
112
120

More than 5 years have passed since last update.

Bash on Ubuntu on Windows で GUI 環境を構築する

Last updated at Posted at 2016-08-05

Bash on Ubuntu on Windows で LXDE が動きます。
VNC を使用してアクセスします。
Mac や Linux から X11 Forwarding もできます。

必要なパッケージのインストール

Bash on Ubuntu on Windows を起動して、必要なパッケージをインストールします。

apt-get install xorg lxde-core tightvncserver firefox openssh-server

VNC 設定ファイルの生成

一旦、 VNC サーバーを起動して、設定ファイルを生成します。

tightvncserver :1

パスワードの設定を促されるので、ログイン用のパスワードを設定します。

You will require a password to access your desktops.

Password:
Verify:
Would you like to enter a view-only password (y/n)? y
Password:
Verify:
xauth:  file /home/USERNAME/.Xauthority does not exist

New 'X' desktop is DESKTOP-MACHINENAME:1

Creating default startup script /home/USERNAME/.vnc/xstartup
Starting applications specified in /home/USERNAME/.vnc/xstartup
Log file is /home/USERNAME/.vnc/DESKTOP-MACHINENAME:1.log

設定後、一旦 VNC サーバーを kill します。

tightvncserver -kill :1

LXDE の起動設定

xstartup ファイルに LXDE の起動設定を追記します。

nano ~/.vnc/xstartup

xstartup ファイルの末尾に、以下を追記します。

lxterminal &
/usr/bin/lxsession -s LXDE &

VNC サーバーを起動

VNCサーバーを再度起動します。

tightvncserver :1

TightVNC viewer のインストール

こちらを参考に TightVNC viewer をインストールします。

VNC Server へアクセス

TightVNC viewer を起動し、 localhost:5901 へアクセスすると、 Bash on Ubuntu on Windows の LXDE へ接続できます

スクリーンショット 2016-08-06 2.04.55.png

スクリーンショット 2016-08-12 5.21.03.png

その他

X11 クライアントの使用

  • Mac の XQuartz などから X11 Forwarding する場合/etc/ssh/sshd_config の先頭付近に以下のパラメータを追加し、sshd を再起動します。
AddressFamily inet 
ListenAddress 0.0.0.0 
X11UseLocalhost yes

AddressFamilyListenAddress よりも先に書く必要があります。

sshd を開始し、 X クライアントから xeyes などが起動できれば OK

bashOnWindowsHost$ sudo service ssh start
...
xclientHost$ ssh -X user@bashOnWindowsHost
xclientHost$ xeyes &

参考

112
120
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
112
120