CentOS 8.1下VNC安装与配置

1.VNC安装命令

[ /]# yum install -y tigervnc-server

2.编辑VNC配置

[ /]# cp /lib/systemd/system/ /etc/systemd/system/:1.service
注:拷贝一个新的配置文件,以开启1号窗口为例(想要同时开启多个窗口,修改其中数字即可)

[ /]# vi /etc/systemd/system/:1.service

[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=simple

# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :‘
ExecStart=/usr/bin/vncserver_wrapper <USER> %i   #将文中的“<USER>”替换为你系统的用户名root

ExecStop=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :‘

[Install]
WantedBy=multi-user.target

3.更新配置文件

[ /]# systemctl daemon-reload

4.设置root的vncserver密码

[ /]# vncpasswd 
Password:    #新密码:123456
Verify:      #再次输入:123456
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
[ /]#

5.启动服务并设为开机启动

[ /]# systemctl start :1.service
[ /]# systemtcl enable :1.service6.查看linuk的ip地址
 

6.使用VNC Viewer软件连接

下载地址:https://www.realvnc.com/download/file/viewer.files/VNC-Viewer-6.20.113-Windows.exe
打开VNC Viewer之后,输入服务器ip及端口即可连接,如下图:

CentOS 8.1下VNC安装与配置

 
 
 

相关推荐