Steps as following:
1. Install vnc-server module:
-> yum -y install vnc-server*
As root:
# useradd vncuser
# passwd vncuser
-> Login to each user(IMPORTANT), and run vncpasswd. This will create a .vnc directory.
-> Edit /etc/sysconfig/vncservers, and add the following to the end of the file.
2. 将用户名称加入到配置文件:
(注:这里的“用户名”是指linux系统用户的名称)
[gavin@centos ~]# vi /etc/sysconfig/vncservers
# VNCSERVERS="1:vncuser 2:john" # use the method for more user
VNCSERVERS="1:vncuser 2:root 3:root"
# VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[1]="-geometry 1024x768"
3. 设置用户vncuser的密码
[vncuser@centos ~]$ vncpasswd
Password:
Verify:
4. start the VNC service by following command line:
service vncserver start
5. Change xstartup for the vncserver user script, this step is very important.
[vncuser@centos ~]$ cd ~/.vnc/
[vncuser@centos .vnc]$ vi xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
#unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
==>变为:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
6. 重启vncserver
[vncuser@centos ~]# /sbin/service vncserver restart
7. VERY IMPORTANT:
Don't forget to change inittab under /etc directory, change the boot mode from 5 to 3.
8. 启动VNC client端登陆,网页上登陆的URL类似:http://xxxx.xxx.xxx:5801
客户端登陆类似:xxx.xxxx.xxx:1
http://219.233.206.150:5801