首页 > 技术文章 > VNC在Ubuntu搭建远程开发环境

SergeyuiL 2022-01-10 19:19 原文

1、远程桌面配置

(1)、安装vino

sudo apt update
sudo apt install vino

(2)、设置Enable VNC服务

sudo ln -s ../vino-service.service /usr/lib/systemd/user/graphical-session.target.wants

(3)、配置VNC server

gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino require-encryption false

编辑org.gnome

sudo gedit /usr/share/glib-2.0/schemas/org.gnome.Vino.gschema.xml

在文件最后添加

<key name='enabled' type='b'>
	<summary>Enable remote access to the desktop</summary>
	<description>
		If true, allows remote access to the desktop via the RFB
		protocol. Users on remote machines may then connect to the
		desktop using a VNC viewer.
	</description>
	<default>false</default>
</key>

设置为Gnome编译模式

sudo glib-compile-schemas /usr/share/glib-2.0/schemas

手动启动vino-server

/usr/lib/vino/vino-server

设置VNC登录密码

gsettings set org.gnome.Vino authentication-methods "['vnc']"
gsettings set org.gnome.Vino vnc-password $(echo -n 'thepassword'|base64)

'thepassword'为密码,此处设置为123456

设置开机自启动VNC Server

gsettings set org.gnome.Vino enabled true
mkdir -p ~/.config/autostart
vi ~/.config/autostart/vino-server.desktop

在文件中添加

[Desktop Entry]
Type=Application
Name=Vino VNC server
Exec=/usr/lib/vino/vino-server
NoDisplay=true

重启看是否生效

sudo reboot

2、连接远程桌面

(1)、查询ip地址

ifconfig

(2)、使用VNC viewer软件进行连接

按照软件操作,连接密码为之前设置密码

连接成功
image

推荐阅读