kopug memo

名古屋で働くとあるWebエンジニアの覚書。

VNCでリモート接続

■サーバ側の設定+α
(1) VNCサーバのインストール

# yum -y install vnc-server

(2) 自分のアカウントで、vncサーバを起動

$ vncserver -geometry 1280x1024

You will require a password to access your desktops.

Password: パスワードを入力
Verify:   再度パスワードを入力
xauth:  creating new authority file /home/kopug/.Xauthority

New 'localhost.localdomain:1 (kopug)' desktop is localhost.localdomain:1

Creating default startup script /home/kopug/.vnc/xstartup
Starting applications specified in /home/kopug/.vnc/xstartup
Log file is /home/kopug/.vnc/localhost.localdomain:1.log

パスワードは、そのユーザで始めて実行した時のみ求められます。
次回からはこのパスワードを使用します。

(3) 終了する場合

$ vncserver -kill :1
Killing Xvnc process ID 3754

localhost.localdomain:1 <- この場合は 1を利用する。VNCで接続する場合も同じ。連続で起動すると:2が割り当てられる。連番

(4) GNOMEに切り替え

$ vi /home/kopug/.vnc/xstartup


#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &                                                         <- コメントアウト
exec gnome-session                                             <- 追加

■クライアント側
(1)クライアントソフトをDLする。
http://www.realvnc.com/products/download.html

(2)適当にインストールをすませ、接続してみるとOK。
接続場所は<サーバIP>:<ポート番号> ※ポート番号は上の番号と一緒。ここでは1