一、安装

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/vncserver@.service /etc/systemd/system/vncserver@:1.service

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

设置用户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的形式连接。



 

相关文章:

  • 2021-05-06
  • 2021-12-22
  • 2021-09-27
  • 2021-07-17
  • 2022-12-23
  • 2021-03-30
  • 2021-07-01
  • 2021-06-09
猜你喜欢
  • 2022-01-11
  • 2022-12-23
  • 2021-07-23
  • 2022-01-21
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案