PR

Xvnc – CentOS 5.2

X Window System を理解すると、Windows版のVNCを使っているのとだいぶ違うことがわかる。Linux系で動作するVNCをX Window Systemと組み合わせて『Xvnc』という。

(改定4版)

※画像は「Ubuntu Server 10.04 LTS に Xvnc を設定する」のもの

スポンサードリンク

準備

接続できないときにどこの問題があるか切り分けるため、あらかじめファイアウォールなどを切っておく。

/etc/rc.d/init.d/iptables stop
chkconfig iptables off
/etc/rc.d/init.d/ip6tables stop
chkconfig ip6tables off
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
ln -s /usr/bin/perl /usr/local/bin/perl
reboot

最小限のXwindowsSystemとGNOMEデスクトップを入れる

# Error: Missing Dependency: libgaim.so.0 is needed by package nautilus-sendto
# 上記エラーが出るので以下のように対処する

wget http://mirror.centos.org/centos/5/os/i386/CentOS/nautilus-sendto-0.7-5.fc6.i386.rpm
rpm -Uvh --nodeps nautilus-sendto-0.7-5.fc6.i386.rpm
yum install yum-fastestmirror -y
yum groupinstall "X Window System" "GNOME Desktop Environment" -y
yum install dbus-sharp-devel gnome-sharp -y
X -configure

xinetdを入れる

yum install xinetd -y
/etc/init.d/xinetd restart
chkconfig xinetd on

(この手順だと)VNCは入っているので設定のみする

vncpasswd /etc/vnc_password

# パスワードを設定

chmod 644 /etc/vnc_password
vi /etc/services
vnc 5950/tcp
vi /etc/xinetd.d/vnc #NewFile
service vnc
 {
 socket_type     = stream
 wait            = no
 user            = nobody
 server          = /usr/bin/Xvnc
 server_args     = -inetd -query localhost -once -geometry 1024x768 -depth 16 --PasswordFile=/etc/vnc_password
 log_on_failure  += USERID
 disable         = no
 }
/etc/init.d/xinetd restart

gdmファイルの設定(多くが/etc/gdm/gdm.confで解説している)

vi /etc/gdm/custom.conf
[xdmcp]
Enable=true

[security]
AllowRoot=true
AllowRemoteRoot=true

[greeter]
TitleBar=true
ConfigAvailable=true
gdm-restart

運用

  1. SSHでログイン
  2. runlevel を5に設定(3のままだと砂嵐)
    telinit 5
  3. VNCビューアから接続して操作
  4. 操作が終わったらVNC上でログアウト処理
  5. 切断される
  6. runlevel を3に設定
    telinit 3
  7. SSHからログアウト

常にランレベルを固定したい場合

# vi /etc/inittab
 id:5:initdefault:

ランレベルを切り替えるコマンド

telinit 3
telinit 5

参考資料

うまくいかないときにあれこれ試してみるなら・・・

  • setup
  • VNC
    • yum install vnc-server -y
    • vncserver
    • vncpasswd
    • vncserver -kill :1
    • /etc/rc.d/init.d/vncserver restart
    • vi /etc/sysconfig/vncservers
    • vi /root/.vnc/xstartup
      • # twm & –> gnome-session &
  • X
    • vi /etc/X11/xorg.conf
    • startx
    • yum install Xorg
    • yum groupupdate “X Window System”
    • yum install xorg-x11-Xvfb
    • yum install xorg-x11-server-Xvfb
  • gnome
    • yum install gnome-session gnome-applets gnome-themes
    • yum install dbus-x11
  • gdm
    • yum install gdm
    • gdm
    • gdm-restart
    • gdm-stop
  • yum install switchdesk
    • switchdesk GNOME
  • yum install kde-i10n-Japanese

oldId.20080807004548540