# Contents

Transform any Linux machine into a powerful development environment with this step-by-step guide. Whether you're using a spare computer, a cloud instance, or a dedicated server, open-source Daytona helps individual developers create a robust, secure development workspace in minutes.

If you're seeking a simpler, instant solution for your team, consider checking out Daytona Enterprise.

Why Use Remote Targets with Daytona?

Remote targets allow you to run development environments on any Linux machine while managing them from your local Daytona installation. This approach offers several key benefits:

  • Resource Optimization: Leverage powerful remote hardware for development without upgrading your local machine

  • Flexibility: Access your dev environment from anywhere, using any device

  • Security: Keep code and sensitive data on secure remote servers

  • Cost-Effective: Use existing Linux machines or affordable cloud instances as development servers

  • Simple Management: Control multiple remote environments from your local Daytona installation

Unlike remote profiles that require running a Daytona server instance, remote targets provide a lightweight way to utilize remote machines for development. Set up Docker on your target machine, and you're ready to start coding.

Let's walk through the process of setting up your first remote target.

Prerequisites

  • A server running Ubuntu (recommended) or another Linux distribution

  • SSH access to the server

  • Root or sudo privileges

  • Daytona installed on your local machine

Step 1: Initial Server Setup

  1. Connect to your server:

1ssh root@your.ip.address
  1. Create a dedicated user for Daytona:

1useradd -m daytona
2echo "daytona ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/91-daytona
3sudo chmod -R 777 /home/daytona
4sudo chown daytona:daytona /home/daytona

Step 2: Configure SSH Access

  1. Set up the SSH directory for the Daytona user:

1su daytona
2mkdir -p ~/.ssh
3chmod 700 ~/.ssh
4touch ~/.ssh/authorized_keys
5chmod 600 ~/.ssh/authorized_keys
  1. Configure SSH server settings:

1sudo nano /etc/ssh/sshd_config
  1. Ensure these lines are present and uncommented:

1PubkeyAuthentication yes
2AuthorizedKeysFile .ssh/authorized_keys
3StrictModes yes
  1. Restart SSH service:

1sudo systemctl restart ssh

Add your SSH key to the server (choose one method):

Method 1: Using ssh-copy-id (recommended)

From your local machine:

1ssh-copy-id -i ~/.ssh/id_rsa.pub daytona@your.ip.address

Method 2: Manual copy

On your local machine, copy your public key:

1cat ~/.ssh/id_rsa.pub

On the remote server, paste it into authorized_keys:

1echo "your-public-key" >> ~/.ssh/authorized_keys

Step 3: Install Docker

Log in as daytona user into your remote machine:

1 ssh daytona@your.ip.addr
  1. Install Docker following the official Docker documentation:

1 sudo apt-get install ca-certificates curl
2 sudo install -m 0755 -d /etc/apt/keyrings
3 sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
4 sudo chmod a+r /etc/apt/keyrings/docker.asc
5 echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
6 sudo apt-get update
7 sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  1. Verify Docker installation:

1 sudo docker run hello-world
  1. Change Docker socket permissions:

1 sudo chmod 666 /var/run/docker.sock

Step 4: Configure Remote Target in Daytona

  1. On your local machine, run:

1daytona target set
  1. Follow the prompts:

    • Select docker-provider

    • Choose "New Target"

    • Enter a name for your target

  2. Provide the remote server details:

1Remote Hostname: your.ip.address
2
3Remote User: daytona
4
5Remote Port: 22 (default)
6
7Sock Path: /var/run/docker.sock
8
9Workspace Data Dir: /home/daytona/daytona-data

Step 5: Verify Setup

  1. Test the connection:

1daytona target list
  1. Create a test workspace:

1daytona create --target your-target-name

Troubleshooting

If you encounter issues:

  • Verify SSH connection: ssh daytona@your.ip.address

  • Check Docker status: sudo systemctl status docker

  • Verify Docker permissions: docker ps

  • Check Daytona logs: daytona logs

Next Steps

  • Set your new target as default: daytona target set-default

  • Create workspaces using your remote target

  • Configure additional remote targets as needed

This guide provides a streamlined approach to setting up a remote target for Daytona. Remember to replace your.ip.address with your actual server IP address throughout the guide.

Tags::
  • profiles
  • remote
  • sde
  • equinix