linux 服务器版本安装vnc,实现远程桌面的功能

背景

本测试用的系统是debian
image

  1. 安装桌面软件推荐使用如下
    如果报错先更新一下apt update或者源的问题,别的操作系统自行百度安装方法
sudo apt install xfce4 xfce4-goodies
  1. 安装vnc(推荐使用我的)
    不要安装tigervncserver

一定要安装这个 standalone的

apt install tigervnc-standalone-server
  1. 配置vncserver
  • 设置密码,注意这里所有设置都是跟你当前的用户有关,会保存在~/.vnc目录下,不同用户密码和实例都是独立的
    vncpasswd
    Password:
    Verify:
    Would you like to enter a view-only password (y/n)? n
    A view-only password is not used
    
  • 配置文件 (最重要的一步,不让后面无法运行)
    写一个启动配置文件,cd 到~/.vnc路径下
    image
    vim xstartup 填加以下内容
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &

启动的时候注意加-localhost no,不然只监听了本地回环的端口

vncserver -localhost no

image

  1. 基本常命令
  • 查看当前实例和端口列表
    vncserver list
    image

  • kill 实例
    vncserver -kill :1

  1. 客户端
    https://vnc-viewer.en.softonic.com/

注意

如果有防火墙,注意开放防火墙端口

参考资料

https://juejin.cn/post/7162831879303856164
https://blog.csdn.net/v6543210/article/details/124120120

posted @ 2024-01-18 10:16  学不会xuebuhui  阅读(95)  评论(0编辑  收藏  举报
Language: javascript