ubuntu20.04安装配置VNC远程桌面

  1. 本例使用tigier vnc,如果已经安装其他的vnc软件,请先remove, 例如sudo apt remove vnc4server
  2. 安装tigervnc
sudo apt install xserver-xorg-core
sudo apt install tigervnc-standalone-server tigervnc-xorg-extension tigervnc-viewer -y
  1. setup a password for vnc login:
    $ vncpasswd
  2. How to configuring Gnome 3 Desktop environment to use with VNC
    You need to create a file name ~/.vnc/xstartup using a text editor such as vim command or nano command:
    $ vi ~/.vnc/xstartup
Append the following:
#!/bin/sh
# Start Gnome 3 Desktop
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
vncconfig -iconic &
dbus-launch --exit-with-session gnome-session &

sudo chmod 777 ~/.vnc/xstartup

  1. How to start TigerVNC server
$ vncserver
One can setup desktop bit depth such as 8, 16, 24, 32 and Desktop geometry in {width}x{height} as follows:
$ vncserver -depth {8|16|24|32} -geometry {width}x{height}
$ vncserver -depth 32 -geometry 1680x1050
Verify it with the ss command and pgrep command/egrep command:
$ pgrep Xtigervnc
$ ss -tulpn | egrep -i 'vnc|590'
  1. sometimes vnc is only allowed to access from localhost, you have to disable via -localhost no
vncserver :1 -localhost no -geometry 1680x1050 -alwaysshared
vncserver :1 -localhost no -geometry 1680x1050 -alwaysshared
vncserver -kill :1

开启端口

iptables -I INPUT -p tcp --dport 5901 -j ACCEPT

VNC客户端连接
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值