masayuki5160's diary

名古屋でエンジニアしてます。

VNCサーバを構築してみる2(iPadから接続)

時間かかりましたが、やっとできました。
せっかくなのでVNCサーバ設定からiPadで接続するまでまとめます。
※OSはCentOSです。

1.VNCサーバインストール
#yum install vnc-server



2.VNCサーバ設定

一度VNCサーバを起動し、パスワードを設定します。
(このとき、/root/.vnc/xstartupが作成されます)

# vncserver -geometry 1024x768

You will require a password to access your desktops.

Password:
Verify:

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

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

その後、一旦サーバを停止します。

# vncserver -kill :1


3. /root/.vnc/xstartupを下記のように編集

# vi /root/.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

twm &
をコメントアウト、

exec gnome-session
を追記します。

4.iTap VNCの設定(iPadのアプリ)

ぼくの場合はiTap VNCを使用しました。(評判もよさげだったので。)

設定は、

Label: すきな名前
Host: ホストのIP
Port: Display #1

Credentials: Usernameとパスワード(VNCサーバを起動したときに入力した)を設定

でおけです。

5.iPadから接続


グローバルから接続するときはほかにも設定が必要かと思いますが、
家の中だけならこれで大丈夫でした。
アプリ1400円?したけど買ってよかったです。

参考サイト
はじめての自宅サーバ構築 http://kajuhome.com/vnc.shtml