KylinServerV10上配置VNC服务并使用

一、KylinServerV10上配置VNC服务

#KylinServerV10 版本信息
[root@KylinServerV10 network-scripts]# cat /etc/kylin-release 
Kylin Linux Advanced Server release V10 (Tercel)
[root@KylinServerV10 ~]# yum makecache
#安装vncserver相关组件
[root@KylinServerV10 ~]# yum install tigervnc-server tigervnc-server-module
#创建cloud用户组和cloud用户
[root@controller ~]# groupadd -g 10001 cloud
[root@controller ~]# useradd -u 10001 -g 10001 -s /bin/bash -d /home/cloud -m cloud
#修改cloud用户密码
[root@controller ~]# passwd cloud
#在需要设置vnc访问的账户下设置vnc密码(记住此密码,在下一步连接时要用。建议就跟操作用户cloud的密码一样,而操作用户cloud就是使用vnc登录后默认使用的操作系统用户)
#切换到cloud用户
[root@KylinServerV10 ~]# su - cloud
#设置vnc登录密码
[cloud@KylinServerV10 ~]$ vncpasswd
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
[cloud@KylinServerV10 ~]$ exit
注销
[root@KylinServerV10 ~]# 
#创建vnc配置文件
[root@KylinServerV10 ~]# vim /etc/systemd/system/vncserver@.service
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
WorkingDirectory=/home/cloud
User=cloud
Group=cloud

ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver %i -geometry 1920x1080
ExecStop=/usr/bin/vncserver -kill %i

[Install]
WantedBy=multi-user.target
#重新加载systemd 管理配置信息。以下是关于此命令的官方解释,其中说此命令执行后,会重新加载所有unit文件并重建整个依赖树,就是说会让以上/etc/systemd/system/vncserver@.service 配置文件被认可、识别
#Reload the systemd manager configuration. This will rerun all generators (see systemd.generator(7)), #reload all unit files, and recreate the entire dependency tree. While the daemon is being reloaded, all sockets systemd listens on behalf of user configuration will stay accessible.
[root@KylinServerV10 ~]# systemctl daemon-reload
#启动vnc服务
[root@KylinServerV10 ~]# systemctl start vncserver@:1.service
#设置成开机自启动
[root@KylinServerV10 ~]# systemctl enable vncserver@:1.service
#查看vnc服务
[root@KylinServerV10 ~]# systemctl status vncserver@:1.service

在这里插入图片描述

#确认开启防火墙服务并设置成开机自启动
[root@KylinServerV10 ~]# systemctl start firewalld
[root@KylinServerV10 ~]# systemctl enable firewalld
[root@KylinServerV10 ~]# systemctl status firewalld
#设置防火墙规则,允许5901端口对外服务
[root@KylinServerV10 ~]# firewall-cmd --permanent --add-port=5901/tcp
[root@KylinServerV10 ~]# firewall-cmd --reload

二、使用VNC-Viewer连接KylinServerV10桌面

#下载vnc-viewer安装文件
https://www.realvnc.com/en/connect/download/viewer/

创建一个vnc连接会话
在这里插入图片描述
输入待连接的服务器的ip与vnc使用的端口号(就是前面使用防火墙服务放开的5901端口)
在这里插入图片描述
双击上传会话连接KylinServerV10桌面
在这里插入图片描述

  • 5
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值