debian 12 配置VNC

一、服务器

1. 安装和启动

服务器安装vnc-server:

shell 复制代码
apt install tigervnc-standalone-server

启动(这里使用的是gnome桌面):

shell 复制代码
tigervncserver -xstartup /usr/bin/gnome-session -geometry 1280x960 -localhost no :1

这里的:1是display,客户端连接时要指定这个。

然后记得开放防火墙端口!!!

2. 配置开机自启

vim /etc/rc.local

在里面加上:

shell 复制代码
#!/bin/bash

# 这里的username要根据实际填写,会调起user的桌面环境。
# root用户一般没有桌面环境。

source /home/<username>/.profile
sudo -u <username> tigervncserver -kill :1 2>/dev/null
sudo -u <username> tigervncserver -xstartup /usr/bin/gnome-session -geometry 1920x1080 -localhost no :1
shell 复制代码
## 如果不设置可执行权限,开机不会运行rc.local
chmod 755 rc.local

这里手动source.profile,因为VNC没有自动加载它。

发现VNC中桌面的语言设置不会生效,怀疑是漏加载了gnome的某些配置。

.profile补上export LANG="zh_CN.UTF-8"可设置桌面环境为中文。

二、客户端

客户端安装vnc-viewer:

shell 复制代码
apt install tigervnc-viewer

连接:

shell 复制代码
xtigervncviewer 192.168.1.104:1

参考博客:
Debian11.6配置noVNC做远程桌面服务

相关推荐
runfarther33 分钟前
搭建LLaMA-Factory环境
linux·运维·服务器·python·自然语言处理·ai编程·llama-factory
百思可瑞教育1 小时前
Spring Cloud Gateway 负载均衡全面指南
运维·负载均衡·北京百思可瑞教育·百思可瑞教育·北京百思教育
天朝八阿哥2 小时前
Debian从12升到13的翻车记
debian
MUY09905 小时前
应用控制技术、内容审计技术、AAA服务器技术
运维·服务器
楠奕5 小时前
elasticsearch8.12.0安装分词
运维·jenkins
Sadsvit5 小时前
源码编译安装LAMP架构并部署WordPress(CentOS 7)
linux·运维·服务器·架构·centos
java资料站6 小时前
Jenkins
运维·jenkins
苦学编程的谢6 小时前
Linux
linux·运维·服务器
G_H_S_3_6 小时前
【网络运维】Linux 文本处理利器:sed 命令
linux·运维·网络·操作文本
拾心217 小时前
【运维进阶】Linux 正则表达式
linux·运维·正则表达式