社区微信群开通啦,扫一扫抢先加入社区官方微信群
社区微信群
1.首先更改图形界面模式
[root@localhost ~]# systemctl get-default
如果返回值为:multi-user.target 命令行输入下面指令切入到图形界面:
systemctl set-default graphical.target
如果需要改回命令行模式,输入如下指令systemctl set-default multi-user.target
2,关闭防火墙
[root@localhost ~]# systemctl stop firewalld
3,安装软件
[root@localhost ~]# yum update
[root@localhost ~]# yum groupinstall "GNOME Desktop" "X Window System" "Desktop"
[root@localhost ~]# yum install tigervnc-server tigervnc vnc vnc-server
4,配置vnc
先拷贝配置文件
[root@localhost ~]# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
打开配置文件:[root@localhost ~]# vim /etc/systemd/system/vncserver@:1.service
在打开的文件中找到这一行
ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
PIDFile=/home/<USER>/.vnc/%H%i.pid
将两行文件中的<USER>修改为当前系统用户名
我当前用户的用户名为admin,修改后的配置如下
ExecStart=/sbin/runuser -l admin -c "/usr/bin/vncserver %i" PIDFile=/home/admin/.vnc/%H%i.pid
连接如果有问题检查这里的配置用户和启动用户是否是同一个,否则会出现authentication error
为vnc设置密码[root@localhost ~]# vncpasswd
打开配置文件
[root@localhost ~]# vim /etc/libvirt/qemu.conf
找到如下两行,把前面的#去掉,保存退出
vnc_password = "123456"
vnc_listen = "0.0.0.0"
5,重加载 systemd
[root@localhost ~]# systemctl daemon-reload
6,启动vncvncserver
7,关闭vncvncserver -kill :1
8,windows本地连接vnc,远程访问
注意:务必要关闭防火墙,否则连不上,系统重启后检查防火墙
systemctl stop firewalld
下载地址:https://pan.baidu.com/s/1hrSIr4K
提取密码:dqdt
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!