1.安装vncserver
yum install tigervnc tigervnc-server
2.配置
在 /etc/tigervnc/vncserver.users 文件中添加用户映射,:1=root,指的是5901端口,root用户
vim /etc/tigervnc/vncserver.users
# TigerVNC User assignment # # This file assigns users to specific VNC display numbers. # The syntax is <display>=<username>. E.g.: # # :2=andrew # :3=lisa :1=root
vncserver-config-defaults:默认配置
vncserver-config-mandatory:全局配置,优先级比 vncserver-config-defaults 高,会覆盖 vncserver-config-defaults 中的配置
vim /etc/tigervnc/vncserver-config-defaults
## Default settings for VNC servers started by the vncserver service # # Any settings given here will override the builtin defaults, but can # also be overriden by ~/.vnc/config and vncserver-config-mandatory. # # See HOWTO.md and the following manpages for more details: # vncsession(8) Xvnc(1) # # Several common settings are shown below. Uncomment and modify to your # liking. # session=gnome # securitytypes=vncauth,tlsvnc # geometry=2000x1200 # localhost # alwaysshared # Default to GNOME session # Note: change this only when you know what are you doing session=gnome geometry=1680x768 alwaysshared
注:其中添加localhost,则不能外部访问
重新加载配置文件
systemctl daemon-reload
3.开启vnc服务
systemctl start vncserver@:1 #启动服务 systemctl status vncserver@:1.service #查看状态 systemctl restart vncserver@:1.service #重启服务
查看端口运行状态
[root@localhost ~]# netstat -tnpl|grep "Xvnc" tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 271437/Xvnc tcp6 0 0 :::5901 :::* LISTEN 271437/Xvnc
参考:https://blog.csdn.net/confused_kitten/article/details/128640190
本文链接:https://jeff.xin/post/144.html
--EOF--
Comments
发表评论:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。