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
Connect to your server:
1ssh root@your.ip.address
Create a dedicated user for Daytona:
1useradd -m daytona2echo "daytona ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/91-daytona3sudo chmod -R 777 /home/daytona4sudo chown daytona:daytona /home/daytona
Step 2: Configure SSH Access
Set up the SSH directory for the Daytona user:
1su daytona2mkdir -p ~/.ssh3chmod 700 ~/.ssh4touch ~/.ssh/authorized_keys5chmod 600 ~/.ssh/authorized_keys
Configure SSH server settings:
1sudo nano /etc/ssh/sshd_config
Ensure these lines are present and uncommented:
1PubkeyAuthentication yes2AuthorizedKeysFile .ssh/authorized_keys3StrictModes yes
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
Install Docker following the official Docker documentation:
1 sudo apt-get install ca-certificates curl2 sudo install -m 0755 -d /etc/apt/keyrings3 sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc4 sudo chmod a+r /etc/apt/keyrings/docker.asc5 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/null6 sudo apt-get update7 sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Verify Docker installation:
1 sudo docker run hello-world
Change Docker socket permissions:
1 sudo chmod 666 /var/run/docker.sock
Step 4: Configure Remote Target in Daytona
On your local machine, run:
1daytona target set
Follow the prompts:
Select
docker-provider
Choose "New Target"
Enter a name for your target
Provide the remote server details:
1Remote Hostname: your.ip.address23Remote User: daytona45Remote Port: 22 (default)67Sock Path: /var/run/docker.sock89Workspace Data Dir: /home/daytona/daytona-data
Step 5: Verify Setup
Test the connection:
1daytona target list
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.