CentOS 6使用VNC配置远程桌面
首先,配置vncservers(注意,rootW为1,普通用户按2,3以此类推)
[root@hadoop1001 hadoop]# vi /etc/sysconfig/vncservers # VNCSERVERS="2:myusername" # VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost" VNCSERVERS="2:hadoop" VNCSERVERARGS[2]="-geometry 1420x868 -nolisten tcp -localhost"
生成xstartup+设置vncpasswd
[hadoop@hadoop1001 ~]$ vncpasswd
Password:
Verify:
启动vncserver,生成xstartup
[hadoop@hadoop1001 ~]$ vncserver Warning: hadoop1001:1 is taken because of /tmp/.X1-lock Remove this file if there is no X server hadoop1001:1 xauth: creating new authority file /home/hadoop/.Xauthority New 'hadoop1001:2 (hadoop)' desktop is hadoop1001:2 Creating default startup script /home/hadoop/.vnc/xstartup Starting applications specified in /home/hadoop/.vnc/xstartup Log file is /home/hadoop/.vnc/hadoop1001:2.log [hadoop@hadoop1001 ~]$
修改xstartup
[hadoop@hadoop1001 ~]$ vi /home/hadoop/.vnc/xstartup
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & #注释这两行 #twm & # 添加下面一行 gnome -session &
配置防火墙,放行VNC端口:
[root@hadoop1001 ~]# vi /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5901:5910 -j ACCEPT
添加vncserver自启动
[root@hadoop1001 ~]# chkconfig vncserver on
启动vncserver
[root@hadoop1001 ~]# /etc/init.d/vncserver restart Shutting down VNC server: 2:hadoop [ OK ] Starting VNC server: 2:hadoop New 'hadoop1001:2 (hadoop)' desktop is hadoop1001:2 Starting applications specified in /home/hadoop/.vnc/xstartup Log file is /home/hadoop/.vnc/hadoop1001:2.log [ OK ]
转载请注明出处,谢谢