DEV Community

Cover image for Now you can run a code-server as a service.
Ionut aka BlitzCloud
Ionut aka BlitzCloud

Posted on • Updated on

Now you can run a code-server as a service.

As I mentioned in my last article, I said that code-server lacks a service to run it in the background or at startup. I build a systemd service to solve this issue.

If you want to have the code-server running n the background just follow this steps:

  • Create the systemd service with this command
sudo nano /etc/systemd/system/code-server.service
Enter fullscreen mode Exit fullscreen mode
  • Paste the code below.
[Unit]
Description=Code-Server Service
After=network.target

[Service]
Type=simple
Restart=always
User= yourUser
ExecStart=/usr/local/bin/code-server

[Install]
WantedBy=multi-user.target
Enter fullscreen mode Exit fullscreen mode
  • Start the service
sudo service code-server start
Enter fullscreen mode Exit fullscreen mode
  • Check the status
sudo service code-server status
Enter fullscreen mode Exit fullscreen mode
  • Optional enable the process at startup
sudo systemctl enable code-server
Enter fullscreen mode Exit fullscreen mode

Now you should be able to take you safe development environment on your iPad or on your grandma slow computer,without being afraid that the server will stop.

Top comments (0)