1.1什么是VNC?
VNC (Virtual Network Console)是虚拟网络控制台的缩写。它 是一款优秀的远程控制工具软件,可以实现远程控制计算机的功能。
1.2 VNC组成
VNC基本上是由两部分组成,在任何安装了客户端的应用程序(vncviewer)的计算机
都能十分方便地与安装了服务器端的应用程序(vncserver)的计算机相互连接。
VNCserver 放在服务器端,VNCViewer 放在客户端
2.工具
本篇文章使用的是RealVNC ,具体的说法自行百度。
3.安装
3.1 查看本地yum仓库
yum repolist all
或者
yum repolist all|grep 启用
这里的启用可以换成 enabled,看自己的Linux 是什么情况了
3.2 配置阿里云镜像源
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
3.3 下载 tigervnc-server 的rpm包 安装
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/tigervnc-server-1.8.0-21.el7.x86_64.rpm
rpm -ivh tigervnc-server-1.8.0-21.el7.x86_64.rpm
直接使用yum安装vncserver
yum -y install tigervnc-server
启动VNCServer服务
确定一下你自己的Linux是否是带图形化
vncserver
在安装过程中 需要确认两次密码,然后输入n
查看启动的vnc 服务
vncserver -list
如果想要开多个端口,就启动几个服务
查看VNCserver监听端口
ss -tunlp |grep vnc
放行防火墙
firewall-cmd --add-port=5901/tcp --permanent #放行5901端口
firewall-cmd --reload #重新加载生效
如果在测试环境,可直接关闭防火墙,我是测试使用,我就直接关了防火墙了
systemctl stop firewalld && systemctl disable firewalld
关闭selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
setenforce 0
使用RealVNC 连接
使用 vncserver -list
来找到端口
杀掉端口
vncserver -kill :1