debian+dwm+rdesktop的安装和使用

dwm(Dynamic Window Manager)属于动态窗口管理器,可以自定义不同窗口的出现规则如平铺或者堆叠。

rdesktop 是一个在 Unix/Linux 下访问 Windows 远程桌面的客户端程序.

1. 背景

需求是有一台性能极差的linux服务器,想在上面安装rdp ,把它当成廋客机来使用。这时候就需要一个窗口,在无法安装桌面的情况下,dwm+rdesktop无疑是比较合适的解决方案。

1. 安装dwm

  1. 先用apt安装

    1
    apt install dwm
  2. 安装完成后尝试启动

    1
    startx
  3. 可能遇到以下问题

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
root@raspbian:/opt# startx
-bash: startx: command not found

#若报这个错,说明x服务没有装,利用search查一次是哪个包提供的
root@raspbian:/opt# apt search startx
Sorting... Done
Full Text Search... Done
xinit/stable 1.4.0-1 arm64
X server initialisation tool

#查到后直接安装
root@raspbian:/opt# apt install xinit

然后再次尝试启动
root@raspbian:/opt# startx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#若报这个错
xauth: file /root/.Xauthority does not exist

X.Org X Server 1.20.4
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.19.0-16-arm64 aarch64 Debian
Current Operating System: Linux raspbian 5.10.42-Release-OPENFANS+20210611-v8 #1 SMP PREEMPT Fri Jun 11 17:19:45 CST 2021 aarch64
Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 bcm2708_fb.fbwidth=1824 bcm2708_fb.fbheight=984 bcm2708_fb.fbdepth=16 bcm2708_fb.fbswap=1 smsc95xx.macaddr=DC:A6:32:E1:6A:E3 vc_mem.mem_base=0x3f000000 vc_mem.mem_size=0x3f600000 dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty1 root=PARTUUID=daf1c5e3-02 rootfstype=ext4 elevator=deadline fsck.repair=yes net.ifnames=0 cgroup_enable=1 cgroup_memory=1 cgroup_enable=cpuset cgroup_enable=memory swapaccount=1 zswap.enabled=1 zswap.zpool=z3fold zswap.compressor=lz4 zswap.max_pool_percent=25 rootwait
Build Date: 19 April 2021 09:34:38AM
xorg-server 2:1.20.4-1+deb10u3 (https://www.debian.org/support)
Current version of pixman: 0.36.0
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Fri Aug 27 22:29:50 2021
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(EE)
Fatal server error:
(EE) no screens found(EE)
(EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
(EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.


xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error

#错说明还有一个X的依赖包没有安装

root@raspbian:/opt# apt install xserver-xorg-video-fbdev

#安装完成后再次输入,应该可以正常启动了
startx

按 shift + alt + q即可退出 dwm 桌面

2.安装rdesktop

  1. apt安装

    1
    apt install rdesktop
  2. 使用

    一般的远程连接

    1
    2
    3
    rdesktop -f -a 16 -x l 172.16.0.100

    # rdesktop退出全屏模式 :使用组合键ctrl+alt+enter进行切换

    挂载U盘设备

    1
    rdesktop -f -r disk  -r disk:usb=/mnt/usb1  -a 16 -x l 172.16.0.100