centos 7 系统VNC部署可视化界面操作过程

使用VNC图形化要安装比较多的依赖包,所以要预留1G的内存,服务器配置选择不要低于2G内存,否则会卡顿。
服务器选择更多参阅官方文档

获取当前系统启动模式

[[email protected] ~]# systemctl get-default

multi-user.target

查看配置文件

[[email protected] ~]# cat /etc/inittab

multi-user.target: analogous to runlevel 3 //命令行模式

graphical.target: analogous to runlevel 5 //图形界面模式

[[email protected] ~]# systemctl set-default graphical.target //由命令行模式更改为图形界面模式

[[email protected] ~]# systemctl set-default multi-user.target //由图形界面模式更改为命令行模式

获取当前系统启动模式

[[email protected] ~]# systemctl get-default

graphical.target

1)关闭防火墙

centos的防火墙是firewalld,关闭防火墙的命令

[[email protected] ~]# systemctl stop firewalld.service #停止firewall

[[email protected] ~]# systemctl disable firewalld.service #禁止firewall开机启动

[[email protected] ~]# setenforce 0

[[email protected] ~]# getenforce

[[email protected] ~]# cat /etc/sysconfig/selinux

SELINUX=disabled

SELINUXTYPE=targeted

2)安装软件:

yum groupinstall -y “GNOME Desktop”

yum install tigervnc-server tigervnc vnc vnc-server

3)配置vnc连接

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

修改/etc/systemd/system/[email protected]:1.service

找到这一行

ExecStart=/sbin/runuser -l -c “/usr/bin/vncserver %i”

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

这里直接用root 用户登录,所以我替换成

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

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

为VNC设密码

vncpasswd

重加载 systemd

systemctl daemon-reload

启动vnc

systemctl enable [email protected]:1.service

systemctl start [email protected]:1.service

查看vnc端口

#netstat -antulp | grep Xvnc

关闭vnc连接

[[email protected] ~]# /usr/bin/vncserver -kill :1

堡垒机图形化登录 https://cloud.tencent.com/document/product/1025/32442

客户端vnc连接测试

https://www.realvnc.com/en/connect/download/viewer/ 工具下载

设置VNC登录方式和密码

centos 7 系统VNC部署可视化界面操作过程
centos 7 系统VNC部署可视化界面操作过程
第一次需要设置语言 下一步,,下一步即可
centos 7 系统VNC部署可视化界面操作过程
centos 7 系统VNC部署可视化界面操作过程