tigerVNC+WSL2 桌面配置
WSL2 下的tigervnc 配置和正常虚拟机下的略有不同。需要调整一下色深的设定来避免部分Desktop Environment 颜色的问题。
- 下载最新的tigervnc 版本 (1.5.0 开始支持鼠标前后键的返回和前进)并安装Release TigerVNC 1.15.0 · TigerVNC/tigervnc
- 按照ArchWiki的2.1走:For a quick start, see the steps below. Users are encouraged to read vncserver(8) for the complete list of configuration options.
- Create a password using
vncpasswd
which will store the hashed password in$XDG_CONFIG_HOME/tigervnc/passwd
. Ensure the file’s permission is set to0600
. If creating vncserver access for another user, you must be logged in as that user before running vncpasswd. - Edit
/etc/tigervnc/vncserver.users
to define user mappings. Each user defined in this file will have a corresponding port on which its session will run. The number in the file corresponds to a TCP port. By default, :1 is TCP port 5901 (5900+1). If another parallel server is needed, a second instance can then run on the next highest, free port, i.e 5902 (5900+2). - Create
$XDG_CONFIG_HOME/tigervnc/config
and at a minimum, define the type of session desired with a line likesession=foo
where foo corresponds to whichever desktop environment is to run. One can see which desktop environments are available on the system by seeing their corresponding .desktop files within/usr/share/xsessions/
. For example:
我自己的配置1
2
3
4session=lxqt
geometry=1920x1080
localhost
alwaysshared1
2
3
4
5session=gnome
geometry=1920x1080
depth=32
localhost
alwaysshared - Create a password using
- 注册systemd服务
sudo cp /usr/lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@.service
- 配置自动启动
sudo systemctl enable vncserver@:1.service
- 验证下vncserver是否正确启动
sudo lsof -i
。如果没有修改的话,看到590x 即成功。 - 关闭WSLg。在windows下
%USERPROFILE$\.wslconfig
,添加如下的行:1
2[wsl2]
guiApplications=falseReference
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!