Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ogawa/e10732e0d99015625242df86f60bf421 to your computer and use it in GitHub Desktop.
Save ogawa/e10732e0d99015625242df86f60bf421 to your computer and use it in GitHub Desktop.

ABCIでのリモートデスクトップ利用

概要

このメモでは、ABCIでのリモートデスクトップの利用方法について説明します。

以下の説明はmacOSを対象とします。macOSでは、デフォルトでOpenSSH 7.3以降がインストールされ、FinderにVNCクライアントが統合されています。

前準備

  • ABCIにログインします。

ProxyJumpオプションが使えるバージョンのOpenSSHを使っている場合(macOSなど)は下記のコマンドでログインできます。

[user@localmachine] $ ssh -J %r@as.abci.ai abciuser@es

ProxyCommandオプションを使って下のようにも書けます。

[user@localmachine] $ ssh -o ProxyCommand='ssh %r@as.abci.ai -W %h:%p' abciuser@es
  • vncserverを起動し、VNCサーバのパスワードなどの初期設定をします。
[abciuser@esX ~] $ vncserver

You will require a password to access your desktops.

Password:***********
Verify:**********
Would you like to enter a view-only password (y/n)? n

New 'esX.abci.local:1 (abciuser)' desktop is esX.abci.local:1

Creating default startup script /home/abciuser/.vnc/xstartup
Creating default config /home/abciuser/.vnc/config
Starting applications specified in /home/abciuser/.vnc/xstartup
Log file is /home/abciuser/.vnc/esX.abci.local:1.log
  • 一旦終了しましょう。
[user@gXXXX ~] vncserver -kill :1
  • 設定ファイルをいくつか修正します。

$HOME/.vnc/xstartup を以下のとおり編集します。

#!/bin/sh

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
#exec /etc/X11/xinit/xinitrc
xrdb $HOME/.Xresources
startxfce4 &

必要に応じて $HOME/.vnc/config でスクリーンサイズを変更しておきます。

geometry=2000x1200

開始手順

  • (ログインしていない場合は)ABCIにログインします。
[user@localmachine] $ ssh -J %r@as.abci.ai abciuser@es
  • On-demandで、ノード専有で1ノード確保してログインします。
[abciuser@esX ~] $ qrsh -g abcigroup -l rt_F=1
  • vncserverを起動します。
[user@gXXXX ~] vncserver

New 'gXXXX.abci.local:1 (abciuser)' desktop is gXXXX.abci.local:1

Starting applications specified in /home/abciuser/.vnc/xstartup
Log file is /home/abciuser/.vnc/gXXXX.abci.local:1.log

gXXXX.abci.local:1 が起動したVNCサーバのディスプレイ名です。このVNCサーバには5901というポート番号が割り当てられます。:2の場合は5902、:3の場合は5903、というようにディスプレイ番号に5900を加えたポートが割り当てられるようになっています。

  • ローカルマシンからポートフォワードの設定を行います。
[user@localmachine] $ ssh -N -L 5901:XXX.abci.local:5901 -J %r@as.abci.ai abciuser@es

これでローカルマシンの5901にアクセスすると、VNCサーバに接続できるようになります。

  • VNCクライアントを起動します。
[user@localmachine] $ open vnc://localhost:5901/

終了手順

  • VNCサーバを終了し、exitします。
[user@gXXXX ~] vncserver -kill :1
[user@gXXXX ~] exit
[user@esX ~] exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment