在 15 秒内在 Raspberry Pi 上设置 VirtualHere USB 服务器和 systemd 自动启动

以下脚本将下载适用于 Raspberry Pi 的 VirtualHere USB 服务器(ARM 通用版本)并创建一个名为 vhusbd.service 的 systemd 服务。

如果你不是使用 Raspberry Pi,请查看 VirtualHere 服务器下载页面获取。

install_vhusbd.sh
#!/bin/bash
# 此脚本安装、启用并启动 VirtualHere USB 服务器
wget -O /usr/bin/vhusbd https://www.virtualhere.com/sites/default/files/usbserver/vhusbdarm
chmod a+x /usr/bin/vhusbd

cat >/etc/systemd/system/vhusbd.service <<EOF
[Unit]
Description=vhusbd
After=network-online.target

[Service]
Restart=always
User=root
Group=root
ExecStart=/usr/bin/vhusbd

[Install]
WantedBy=multi-user.target
EOF

# 启用并启动服务
systemctl enable --now vhusbd.service

Check out similar posts by category: Embedded, Raspberry Pi