Centos 6.5安装VNC Server

CentOS_6.5安装VNC_Server

1.安装桌面环境所需软件包:

yum grouplist | more
yum groupinstall   "Desktop"   "Desktop Platform"   "Desktop Platform Development""Fonts"  "General Purpose Desktop"  "Graphical Administration Tools"  "Graphics Creation Tools"  "Input Methods"  "X Window System"  "Chinese Support [zh]" "Internet Browser"

2.修改系统运行级别为图形化方式:

vim /etc/inittab
id:5:initdefault:   
runlevel

3.重启服务器:

reboot

4.安装vnc软件包:

rpm -qa | grep vnc-server
yum install tigervnc tigervnc-server

5.配置VNC的登录账号、桌面分辨率和连接方式:

vim /etc/sysconfig/vncservers

添加:

VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1024x768"

6.配置VNC的远程登录密码:

vncpasswd

7.配置VNC防黑屏,并重启服务:

vim /root/.vnc/xstartup

注释:

# xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
# twm &

添加:

gnome-session &
service vncserver restart
ps -axu | grep vnc
netstat -anptu | grep 5901

8.设置VNC服务开机启动:

chkconfig --level 2345 vncserver on
chkconfig --list | grep vncserver

9.客户端连接:
打开vnc viewer

VNC Server:   IP:5901

(密码不是登陆账号的密码,而是VNC设置的密码)

10.关闭VNC:

vncserver -kill :1
service vncserver stop

11.防火墙开放5901端口:

iptables -A INPUT -p tcp --dport 5901 -j ACCEPT