とあるエンジニアの技術記録

主にWindowsやLinuxの設定方法、トラブル解決方法について投稿してます~♪

RHEL5.6,CentOS6のVNSサーバの設定

2011年08月31日 22時53分33秒 | Linux
今日はRHEL5.6とCentOS6のVNSサーバの設定について纏めておきます。

(1)VNCのパッケージ確認 (RHEL5.6の場合)
# rpm -aq |grep vnc
 vnc-server-4.1.2-14.el5_5.4
 vnc-4.1.2-14.el5_5.4

(2)/etc/sysconfig/vncserverの編集
以下の記述を追加
 VNCSERVERS="1:root 2:root"
 VNCSERVERARGS[1]="-geometry 1024x768 -depth 16"
 VNCSERVERARGS[2]="-geometry 800x600 -depth 16"

(3)VNCパスワードを設定する
/etc/sysconfig/vncserverで登録したユーザのパスワードを設定する。
 #root$ vncpasswd
  Password:
  Verify:

(4)VNCサーバの起動
 # /etc/rc.d/init.d/vncserver start

*初回起動時は以下のように表示される
VNC サーバー を起動中: 1:root xauth: creating new authority file /root/.Xauthority
New 'server01.xxx.xx.jp:1 (root)' desktop is server01.xxx.xx.jp:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/server01.xxx.xx.jp:1.log

2:root
New 'server01.xxx.xx.jp:2 (root)' desktop is server01.xxx.xx.jp:2
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/server01.xxx.xx.jp:2.log [ OK ]

*2回目以降の起動時は以下のように表示される
VNC サーバー を起動中: 1:root
New 'server01.xxx.xx.jp:1 (root)' desktop is server01.xxx.xx.jp:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/:1.log

2:root
New 'server01.xxx.xx.jp:2 (root)' desktop is server01.xxx.xx.jp:2
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/server01.xxx.xx.jp:2.log [ OK ]

(5)起動の自動化
 # chkconfig vncserver on

(6)/root/.vnc/Xstartupの編集
最終行(twm &)をコメントアウトします。
またVNCサーバでGNOMEを起動させるために以下の記述を追記をします。
 #twm &
 exec gnome-session

(7)リモートPC(Windows)にVNCクライアントのインストール
リモートPC(Windows)にvncjp-4_1_2-x86_win32.exeをインストールします。
ログオン画面が表示され、「xxx.xxx.xxx.xxx:1」と入力し、
(3)で設定したパスワードを入力するとVNCサーバにログオンできます。

これでリモートPCからLinuxにGUIでログオンできます。

▼参考URL
 http://ne-manage.seesaa.net/article/102755865.html
 http://d.hatena.ne.jp/rdera/20090303/1236071478
 http://centlinuxer.blog37.fc2.com/blog-entry-15.html


コメントを投稿