tomy_125: Note

tomy_125 の個人的なメモ

VNCでGnome Desktopを起動するメモ

目次

リモートサーバーの準備

Gnomeインストール

$ sudo su -
#  yum group list hidden
・・・
GNOME
・・・

# yum -y groupinstall GNOME

VNCサーバーインストール

# yum -y install vnc-server

VNCサーバーの起動・停止

# exit
$ whoami
opc

$ vncserver 

You will require a password to access your desktops.

Password:    <---- パスワードの入力
Verify:    <---- パスワードの入力
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
xauth:  file /home/opc/.Xauthority does not exist

New 'bast0:1 (opc)' desktop is bast0:1

Creating default startup script /home/opc/.vnc/xstartup
Creating default config /home/opc/.vnc/config
Starting applications specified in /home/opc/.vnc/xstartup
Log file is /home/opc/.vnc/bast0:1.log

$ vncserver -list

TigerVNC server sessions:

X DISPLAY #     PROCESS ID
:1              16359

$ vncserver -kill :1
Killing Xvnc process ID 16359

VNCサーバー設定

$ cp -ip .vnc/xstartup .vnc/xstartup.bk
$ vi .vnc/xstartup
----
#!/bin/sh

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
# /etc/X11/xinit/xinitrc    <---- コメントアウト
exec gnome-session    <---- 追記

# Assume either Gnome or KDE will be started by default when installed
# We want to kill the session automatically in this case when user logs out. In case you modify
# /etc/X11/xinit/Xclients or ~/.Xclients yourself to achieve a different result, then you should
# be responsible to modify below code to avoid that your session will be automatically killed
if [ -e /usr/bin/gnome-session -o -e /usr/bin/startkde ]; then
    vncserver -kill $DISPLAY
fi
----

$ diff .vnc/xstartup .vnc/xstartup.bk
5,7c5
< # /etc/X11/xinit/xinitrc
< exec gnome-session
<
---
> /etc/X11/xinit/xinitrc

VNCサーバー起動

$ vncserver

New 'bast0:1 (opc)' desktop is bast0:1

Starting applications specified in /home/opc/.vnc/xstartup
Log file is /home/opc/.vnc/bast0:1.log

$ cat /home/opc/.vnc/bast0:1.log

Xvnc TigerVNC 1.8.0 - built Nov 10 2020 08:31:57
Copyright (C) 1999-2017 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 12004000, The X.Org Foundation


Wed Oct 26 14:16:27 2022
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5901   <---- Port番号を確認
 vncext:      created VNC server for screen 0

Wed Oct 26 14:16:31 2022
 ComparingUpdateTracker: 0 pixels in / 0 pixels out
 ComparingUpdateTracker: (1:nan ratio)

ssh ポートフォワーディング設定

  • ローカルの5901 Port を、リモートの5901 Port に転送する

ローカルでVNCクライアント起動し接続

  • 設定したパスワードを入力

Gnome デスクトップの表示

GUIアプリケーションの起動

以上