Remotely editing code on a Raspberry Pi is possible, but it relies on taking a few steps to setup the working environment. Typically we would enable SSH and then connect using a terminal, access the files on the Pi via a sftp connection or run a VNC connection after doing a headless Raspberry Pi setup. However all of these methods have their drawbacks, whether it’s limiting yourself to text-based editors in the terminal or slowing yourself down by having to constantly reupload files or wait for a sluggish remote desktop.
To install code-server, power up your Raspberry Pi 4 and follow these instructions.
1. Download and install code-server by entering this command in the terminal.
curl -fsSL https://code-server.dev/install.sh | sh
2. Autostart code-server on boot by running the server as a service in the background.
systemctl --user enable --now code-server
3. Open the config file for editing in Geany.
4. Change the bind address to enable any device on the network to connect.
5. Change the password to raspberry. Press CTRL + X, Y and then Enter to save and exit.
6. Get your IP address by hovering the mouse cursor over the Networking icon in the top right corner.
7. Reboot the Raspberry Pi and
8. On a PC on the same network, open a browser and go to the IP address of the Raspberry Pi, followed by :8080. For example
9. Log in using the password “raspberry.”
10. Click on Python, found under Tools and languages to install support for Python 3.
What makes code-server and VS Code different to other more beginner focussed editors is in how they can be extended to match the way we work.
Project files can be grouped into folders, tidying away the many files that are generated in a large project.
There are tools to work with source control, where code is stored in a version control system such as Git. We can publicly publish our project while still inside the editor.
We can step through the code, looking for bugs and issues in the code as they happen. Pause, rewind, restart or stop as the code performs each task.