This writeup is intended to provide a setup on a Raspberry Pi4/Pi5 for VS Code Server. This is specifically written up with a focus on using the setup from an iPad or iPhone (my particular use case is to directly connect the Pi4/5 to an iPad Pro over a USB-C to USB-C cable using the guide located [here] (https://github.com/verxion/RaspberryPi/blob/main/Pi5-ethernet-and-power-over-usbc.md)).
These steps are current as of 2024-03-13 and were validated on a fresh pi5 installation.
These steps start with the official [Code-Server Site] (https://github.com/coder/code-server?tab=readme-ov-file) and then continue with some steps from a video about [VSCode on iPad Pro - Full Setup Guide with Raspberry Pi] (https://www.youtube.com/watch?v=11YfaGi0Fpk).
-
Run
sudo apt updateto find out if there are any packages that need to be upgraded -
Run
sudo apt-get upgradeto upgrade those packages so you are "current" -
Run
sudo apt install nodejsto install nodejs, which is a requirement for the VS Code install -
Run
sudo apt install npmto install npm, which is also required -
Run
sudo curl -fsSL https://code-server.dev/install.sh | shto install Code Server -
Run
sudo systemctl enable --now code-server@<user>(where<user>is the user that will be using code server) to have systemd start code-server now and automatically restart it on bootup. -
Edit (using vi or nano) the file
~/.config/code-server/config.yaml(note that this should be in/home/<user>, NOT/root... -
Change the
bind-addrfrom127.0.0.1to0.0.0.0(to allow access from any host on your network) -
Change your
passwordfrom the random string of characters to something you choose (this won't be used until after step 18 below) -
Change
certfromfalsetotrue. -
Finally, on the line below
cert, add a new line containing the following text:cert-host: <hostname>.localwhere<hostname>is the hostname of your pi4. -
Stop
code-serverby issuing the following command:systemctl stop code-server@<user>(where<user>is the user that will be using code server) -
Start
code-serverto read in these changes by issuing the following command:systemctl start code-server@<user>(where<user>is the user that will be using code server) -
Launch Safari on your iPad and access the following URL:
https://<hostname>.local:8080where<hostname>is your actual pi hostname... -
You should see a startup screen that says "Get Started with VS Code for the Web".
-
Install Python support or whatever other extensions you wish. The video linked above was from when apparently you had to do this manually from the commandline. This issue seems to have been resolved since then, and you will be able to install directly from VS Code's UI.
-
From this page in Safari, tap on the
Shareicon (box with an up arrow coming out of it) -
Scroll down until you see the option to
Add to Home Screen(tap this) -
Change the icon Name to something you like and tap
Add. (When you run this home screen "app", it will run full screen) -
OPTIONAL step: You can copy the
~/.local/share/code-server/<hostname>_local.crtfile to your iOS device and install it for a more secure connection with no warnings. -
Profit? :)
The following are all videos or links to web pages that I referred to before coming up with this guide.
[Quick and Easy Raspberry Pi iPad Setup Guide] (https://www.youtube.com/watch?v=4PAdeZ4aokk)
[Coder Self-Hosted Cloud Development Environments] (https://github.com/coder/coder)
[64 bit CLI version of Visual Studio Code] (https://code.visualstudio.com/docs/?dv=linuxarm64cli)
[VS Code "Code Server" Install] (https://github.com/coder/code-server)
[VSCode on iPad Pro - Full Setup Guide with Raspberry Pi] (https://www.youtube.com/watch?si=im4gdFCbbW-Su8iq&v=11YfaGi0Fpk&feature=youtu.be)
[Intro to Docker using a Raspberry Pi 4] (https://www.youtube.com/watch?v=nBwJm0onzeo)
[How to Create a Great Local Python Development Environment with Docker] (https://www.youtube.com/watch?v=nBwJm0onzeo)
[Use Raspberry Pi 4 USB-C data connection to connect with iPad Pro] (https://magpi.raspberrypi.com/articles/connect-raspberry-pi-4-to-ipad-pro-with-a-usb-c-cable)