1、 什么是VNC?linux
是一种远程控制的软件, 远程的机器开启VNC的server以后, 本地就能够经过VNCviewer登陆到那台机器上并接管该机器的操做.vim
2、安装vnc服务端bash
1. 安装vnc服务端;ssh
[root@Centos1 ~]# yum -y install vnc *vnc-server*
2. 修改vnc主配置文件;
tcp
[root@Centos1 ~]# vim /etc/sysconfig/vncservers ============================================== # VNCSERVERS="2:myusername" # VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost" -----------------将如上两行改成以下配置--------------------- VNCSERVERS="2:user2 3:user3" VNCSERVERARGS[2]="-geometry 800x600 -alwaysshared" VNCSERVERARGS[3]="-geometry 800x600 -alwaysshared" = =============================================
3. 设置VNCserver远程链接密码;ide
[root@Centos1 ~]# vncserver #默认为root
4. 修改vnc桌面配置文件. vnc链接密码设置完后会在root目录下生产一个.vnc目录;spa
[root@Centos1 ~]# vim /root/.vnc/xstartup ========================= # twm & ----将如上改成以下------ gnome & =========================
5. 关闭iptables/selinux防火墙;rest
[root@Centos1 ~]# iptables -F [root@Centos1 ~]# iptables -X [root@Centos1 ~]# service iptables stop [root@Centos1 ~]# vim /etc/sysconfig/selinux ================== SELINUX=enforcing ---将如上改成以下- SELINUX=disabled ==================
6. 为用户设置vnc链接密码;orm
[root@Centos1 ~]# su - user2 [user2@Centos1 ~]$ vncpasswd
7. 重启vnc服务端,让配置文件生效;server
[root@Centos1 ~]#service vncserver restart
8. 中止vnc窗口;
[root@Centos1 ~]# vncserver -kill:2
2、客户端链接
[root@Centos1 ~]# vncserver :2