How to Build Your Own Raspberry Pi KVM
Introduction
A Raspberry Pi KVM (Keyboard, Video & Mouse) switch is a convenient device for those who have multiple computers but want to use a single keyboard, monitor, and mouse to control them remotely. This article will guide you through the process of building your own Raspberry Pi KVM.
Prerequisites
Before you start, make sure you have the following components:
– Raspberry Pi 4 (a higher performance model is recommended)
– MicroSD card (16 GB minimum) with Raspbian OS
– HDMI monitor or TV with an HDMI cable
– USB keyboard and mouse
– Remote computer with VNC client software installed
Step 1: Assemble your Raspberry Pi
Connect your monitor or TV to the Raspberry Pi using an HDMI cable. Next, attach the USB keyboard and mouse to the available USB ports on the Raspberry Pi. Finally, insert the MicroSD card containing the Raspbian OS into the card slot.
Step 2: Set up your network connection
Connect your Raspberry Pi to your home network using an Ethernet cable or Wi-Fi. To set up Wi-Fi, launch the ‘Raspberry Pi Configuration’ utility and follow the on-screen instructions.
Step 3: Install required software packages
Open a terminal window on your Raspberry Pi and update the package lists:
sudo apt-get update
Next, install required packages:
sudo apt-get install x11vnc xtightvncviewer xrdp git matchbox-window-manager -y
Step 4: Configure X11VNC server for auto-start
To enable X11VNC to start on boot:
- Create a new file named “x11vnc.service” in /etc/systemd/system directory using nano text editor:
sudo nano /etc/systemd/system/x11vnc.service
- Add the following content to the file:
[Unit]
Description=Start X11VNC server
After=graphical.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -noxdamage -localhost -nopw -listen localhost -xkb -noxrecord -noxfixes -noxdamage -repeat -solid black/bg>
Restart=on-failure
RestartSec=2
User=root
Group=root
[Install]
WantedBy=multi-user.target
Alias=x11vnc.service
- Save and close the file.
- Enable the newly created service:
sudo systemctl enable x11vnc.service
Step 5: Connect your remote machine with Raspberry Pi KVM
Using a VNC client on your remote computer, connect to your Raspberry Pi by entering its IP address followed by a port number (default is 5900).
For example: `192.168.1.xxx:5900`
Conclusion
You have successfully built your own Raspberry Pi KVM! Now you can use a single keyboard, monitor, and mouse to control your other computers remotely with ease.