Centos 7.9 安装 tigervnc-server

环境:当前使用的 Centos 7.9 的光盘作为的本地源,或使用离线rpm包。更高级的用法可参照 文章末尾处 --第 13 章 tigervnc-- 官方的文档。

1 检查是否已安装 tigervnc 
[root@localhost /]# rpm -q tigervnc tigervnc-server
未安装软件包 tigervnc 
tigervnc-server-1.8.0-21.el7.x86_64

如果安装过卸掉
卸载: rpm -e
[root@localhost /]# rpm -e tigervnc-server-1.8.0-21.el7.x86_64

3 安装 tigervnc-server
[root@localhost /]# yum install tigervnc-server -y
-server.x86_64.0.1.8.0-21.el7 将被 安装
...
...

已安装:
  tigervnc-server.x86_64 0:1.8.0-21.el7                                                                                  

完毕!

4 修改配置文件,替换<USER>为你的用户名
[root@localhost /]# cd /usr/lib/systemd/system/
[root@localhost system]# ls
[root@localhost system]# cp /usr/lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@.service
[root@localhost system]# vim /etc/systemd/system/vncserver@.service

修改
ExecStart=/usr/bin/vncserver_wrapper <USER> %i

ExecStart=/usr/bin/vncserver_wrapper root %i

保存退出
:wq

5 设置连接密码
[root@localhost system]# vncpasswd
Password:
Verify:
Would you like to enter a view-only password (y/n)? y
Password:
Verify:

说明:第二句话,询问你是否要再输入一个只有观看权限而被禁止操作远程桌面的密码,按照需要。

6 配置生效
[root@localhost system]# systemctl daemon-reload

7 设置开机启动,启动服务
[root@localhost system]# systemctl enable vncserver@:1.service
Created symlink from /etc/systemd/system/multi-user.target.wants/vncserver@:1.service to /usr/lib/systemd/system/vncserver@:1.service.

[root@localhost system]# systemctl start vncserver@:1.service

8 查看端口开启情况
[root@localhost system]# vncserver -list

TigerVNC server sessions:

X DISPLAY #    PROCESS ID
:1        18538

9 查看服务端口,这里开了两个。
 [root@localhost system]# netstat -antpl | grep Xvnc

9 防火墙允许通过
[root@localhost system]# firewall-cmd --permanent --zone=public --add-port=5901/tcp
[root@localhost system]# firewall-cmd --reload

10 使用客户端软件连接
vncviewer64-1.10.1.exe客户端使用 ip:1 或 ip:5901 连接,此处 ip:1 可根据 vncserver -list 显示的数字来变换。

总结:

安装 VNC 服务器
yum install tigervnc-server

或者 
rpm -ivh tigervnc-server-1.8.0-21.el7.x86_64.rpm 

配置 VNC 服务器
cp /usr/lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@.service

编辑
vim /etc/systemd/system/vncserver@.service

要使更改立即生效
systemctl daemon-reload

设置 配置文件中定义的用户或用户的密码
su - USER
vncpasswd
Password:
Verify:

启动 VNC 服务器
systemctl start vncserver@:1.service

服务在系统启动时自动启动
systemctl enable vncserver@:1.service

重启机器查看是否正常
reboot

附录:
TigerVNC 官网:
https://tigervnc.org/
客户端下载地址
http://tigervnc.bphinz.com/nightly/
rpm离线文件下载地址:
https://centos.pkgs.org/7/centos-x86_64/tigervnc-server-1.8.0-21.el7.x86_64.rpm.html

常用命令:
# 关闭vnc服务
systemctl stop vncserver@:1.service
# 禁止 VNC 服务开机启动
systemctl disable vncserver@:1.service
# 关闭防火墙
systemctl stop firewalld.service
# 查看状态
systemctl status vncserver@:1.service

参考:
第 13 章 tigervnc
https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-tigervnc

vncpasswd 更新登录密码 如何设置短密码 空密码
https://blog.csdn.net/yasin_lee/article/details/120520037

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值