Centos 7.9 安装 tigervnc-server

发布于:2024-05-15 ⋅ 阅读:(31) ⋅ 点赞:(0)

环境:当前使用的 Centos 7.9 的光盘作为的本地源,或使用离线rpm包。

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 显示的数字来变换。

附录:
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


网站公告

今日签到

点亮在社区的每一天
去签到