Run playit on Linux (background | on startup | updated guide)

Out of Date!

When you install playit with apt-get we add a systemd unit for you automatically. See docs here: How to run playit 24/7 on Linux | playit.gg - support pages

After you have playit installed run these commands

sudo systemctl start playit
sudo systemctl enable playit

# claim the playit agent to your account
playit setup

INSTALL PLAYIT ON LINUX
0. Pre-Setup: Run the command(s) below.
sudo mkdir /etc/playit/

1. Navigate to the page for downloads and find the files with no extension (no .exe or .dmg at the end): https://github.com/playit-cloud/playit-agent/releases/latest
Find the one (most likely playit-<some version> with no file extension.) and right click it and press “Copy link address”
IF YOU HAVE A DIFFERENT DISTRIBUTION OF LINUX FIND THE COMPATIBLE ONE

2. Run the following command: wget <the-link-you-copied> -O playit while replacing <the-link-you-copied> with the link you copied from step 1.

3. Make the file runable. Run the following command:
sudo chmod +x ./playit

4. Move the file to /etc/playit. Run the following command:
sudo mv ./playit /etc/playit/playit

5. Make a service file (run on boot and in background). Run the following command:
sudo nano /etc/systemd/system/playit.service
In the following window that opens, paste in this text:

[Unit]
Description=Playit.gg client
After=network.target

[Service]
WorkingDirectory=/etc/playit
ExecStart=/etc/playit/playit
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

then do ctrl + x to exit the file, press y to save, and then enter to confirm.

6. Start the service in the background. Run the following commands:
sudo systemctl start playit
sudo systemctl enable playit

7. Get the claim code from playit. Run the following commands:
sudo systemctl status playit
From here you should be able to get the claim link. Paste it into your browser and log in to start creating tunnels.
To exit this menu do CTRL + C

6 Likes

Thanks! Works perfectly fine

1 Like

I got an error while starting the service. (code=exited, status=203/EXEC).
I restarted my device and I checked if the .service file was configured correctly, which was.

Any idea how I could fix this?

EDIT: Error was fixed, I used ‘/opt’ instead of ‘/etc’.

1 Like

I’m stuck on the final step, because when I try getting a claim code, it gives me some data but not the claim code. Does anyone know how to fix this?

1 Like

Excuse me, I just want to point out that the /etc directory is not the correct directory for binary files in unix/linux, it will be more correct to save the file in (for example) the /usr/bin directory:
``shell
$ curl -L “https://github.com/playit-cloud/playit-agent/releases/latest/download/playit-cli” -o /usr/bin/playit
$ chmod +x /usr/bin/playit

. . .

1 Like

This is great, thank you :slight_smile:

If you use the current Debian installation steps from here:
https://playit.gg/download/linux
you can skip to step 5 of your guide, but will need to change the path in the ExecStart line to /opt/ instead of /etc/ :slight_smile: