debian中搭建vnc

1、安装软件
apt install tigervnc-standalone-server
apt install scim xfce4-session

2、配置每个用户自己的vnc server
启动命令:
vncserver -depth 24 -name aru_desktop -httpport 9001 :1

参数解释:

  1. -depth 24 使用24位颜色,这里一般用16或者24

  2. -name aru_desktop 桌面名字,这个参数并非必要,可以随便起个喜欢的名字

  3. -httpport 9001 使用浏览器连接的端口,请用1024以上的端口,如果是多个用户都开vnc server,那每个用户要使用不同的端口

  4. -geometry 1024×768 桌面分辨率,根据要求调整

  5. :1 会话数字,同3

第一次运行会要求你输入一个密码,这个密码和你的ssh登录密码是分开的,当然你也可以用同样的密码

关闭命令:
vncserver -kill :1

:1 是会话数字,和启动的会话数字一致

  1. 输入法和桌面环境

每个用户的vnc server启动脚本是 ~/.vnc/xstartup
root@loongson-pc:/home/loongson# cat ~/.vnc/xstartup
#!/bin/sh

xrdb H O M E / . X r e s o u r c e s x s e t r o o t − s o l i d g r e y x − t e r m i n a l − e m u l a t o r − g e o m e t r y 80 × 24 + 10 + 10 − l s − t i t l e “ HOME/.Xresources xsetroot -solid grey x-terminal-emulator -geometry 80×24+10+10 -ls -title “ HOME/.Xresourcesxsetrootsolidgreyxterminalemulatorgeometry80×24+10+10lstitleVNCDESKTOP Desktop” &
#x-window-manager &
#gnome-session &
xfce4-session &
scim -d

sudo systemctl stop firewalld.service && sudo systemctl disable firewalld.service

  1. 连接vnc server

打开vnc server后,可以通过http方式或者用专用客户端连接

猜你喜欢

转载自blog.csdn.net/qq_25650463/article/details/117425559
VNC