X Window を設定して、VNCで接続
X Window System を使おう! ってことで、CentOS 6.7でデスクトップ環境に設定し、VNC接続できるように設定します。
■GnomeGUIインストール yum groupinstall "X Window System" "GNOME Desktop Environment" "Desktop" ■VNCサーバインストール yum install tigervnc-server cp -p /etc/sysconfig/vncservers /etc/sysconfig/vncservers.org ※最後3行追記 vi /etc/sysconfig/vncservers — VNCSERVERS="1:operation 2:root" VNCSERVERARGS[1]="-geometry 1024x768 -nolisten" VNCSERVERARGS[2]="-geometry 800x600 -nolisten" — ■VNC接続ユーザパスワード設定 vncpasswd Password: Verify: ※root以外のユーザを作ってない場合は、作成後、そのユーザのvncpasswdを設定すること ■VNCサーバ起動 /etc/init.d/vncserver start Starting VNC server: 1:operation xauth: creating new authority file /home/operation/.Xauthority New 'centos63:1 (operation)' desktop is centos63:1 Creating default startup script /home/operation/.vnc/xstartup Starting applications specified in /home/operation/.vnc/xstartup Log file is /home/operation/.vnc/centos63:1.log 2:root xauth: creating new authority file /root/.Xauthority New 'centos63:2 (root)' desktop is centos63:2 Creating default startup script /root/.vnc/xstartup Starting applications specified in /root/.vnc/xstartup Log file is /root/.vnc/centos63:2.log [ OK ] ※operationはユーザー New 'centos63:2 (root)' ↑:2っていうのが、ウィンドウ番号らしく、VNC接続時のポート番号になる。 ■VNC利用時のデスクトップをGNOMEに設定 vi .vnc/xstartup tail -2 .vnc/xstartup # twm & ←コメントアウト exec gnome-session & ←追記 su - operation vi .vnc/xstartup # twm & ←コメントアウト exec gnome-session & ←追記 exit /etc/init.d/vncserver restart Shutting down VNC server: 1:operation 2:root [ OK ] Starting VNC server: 1:operation New 'centos63:1 (operation)' desktop is centos63:1 Starting applications specified in /home/operation/.vnc/xstartup Log file is /home/operation/.vnc/centos63:1.log 2:root New 'centos63:2 (root)' desktop is centos63:2 Starting applications specified in /root/.vnc/xstartup Log file is /root/.vnc/centos63:2.log [ OK ] 起動モード変更 sudo sed -i -e "s/^id:[0-6]/id:5/" /etc/inittab