centos 7.6 配置VNC

一、安装

1.  以root用户运行以下命令来安装vncserver;

yum install tigervnc-server 

2.  同样运行以下命令来安装vncviewer;

yum install vnc

3.  停止并禁用防火墙;

systemctl stop firewalld.service

systemctl disable firewalld.service

二、拷贝配置文件

cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:1.service

vim /etc/systemd/system/vncserver@:1.service

扫描二维码关注公众号,回复: 7392578 查看本文章

设置用户root相关参数(将文中的“<USER>”替换为你系统的用户名,有2个地方

改好后如下:

ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i"

PIDFile=/root/.vnc/%H%i.pid

三、

1.  更新systemctl以使其生效;

systemctl daemon-reload 

2.  设置vncserver的密码;

vncpasswd root

按提示输入密码以及确认密码

3.  启动该服务用来启用vnc的1号窗口;

systemctl start vncserver@:1.service  或者 vncserver :1

关闭1号窗口:

systemctl stop vncserver@:1.service   或者 vncserver -kill :1

4.  设置为开机自动启动;

systemctl enable vncserver@:1.service

客户端连接的时候 用ip:1的形式连接。



猜你喜欢

转载自www.cnblogs.com/alantop/p/11609990.html