x2go is a free and open-source remote desktop. X2Go provides remote desktop solution for Linux
1. Prerequisites
2. Supported Operating Systems
This guide supports installation on:
3. Installation
RHEL/CentOS/Rocky Linux/AlmaLinux
# Install EPEL repository if needed
sudo dnf install -y epel-release
# Install x2go
sudo dnf install -y x2go
# Enable and start service
sudo systemctl enable --now x2go
# Configure firewall
sudo firewall-cmd --permanent --add-port=22/tcp
sudo firewall-cmd --reload
# Verify installation
x2go --version
Debian/Ubuntu
# Update package index
sudo apt update
# Install x2go
sudo apt install -y x2go
# Enable and start service
sudo systemctl enable --now x2go
# Configure firewall
sudo ufw allow 22
# Verify installation
x2go --version
Arch Linux
# Install x2go
sudo pacman -S x2go
# Enable and start service
sudo systemctl enable --now x2go
# Verify installation
x2go --version
Alpine Linux
# Install x2go
apk add --no-cache x2go
# Enable and start service
rc-update add x2go default
rc-service x2go start
# Verify installation
x2go --version
openSUSE/SLES
# Install x2go
sudo zypper install -y x2go
# Enable and start service
sudo systemctl enable --now x2go
# Configure firewall
sudo firewall-cmd --permanent --add-port=22/tcp
sudo firewall-cmd --reload
# Verify installation
x2go --version
macOS
# Using Homebrew
brew install x2go
# Start service
brew services start x2go
# Verify installation
x2go --version
FreeBSD
# Using pkg
pkg install x2go
# Enable in rc.conf
echo 'x2go_enable="YES"' >> /etc/rc.conf
# Start service
service x2go start
# Verify installation
x2go --version
Windows
# Using Chocolatey
choco install x2go
# Or using Scoop
scoop install x2go
# Verify installation
x2go --version
Initial Configuration
Basic Configuration
# Create configuration directory
sudo mkdir -p /etc/x2go
# Set up basic configuration
# See official documentation for detailed configuration options
# Test configuration
x2go --version
5. Service Management
systemd (RHEL, Debian, Ubuntu, Arch, openSUSE)
# Enable service
sudo systemctl enable x2go
# Start service
sudo systemctl start x2go
# Stop service
sudo systemctl stop x2go
# Restart service
sudo systemctl restart x2go
# Check status
sudo systemctl status x2go
# View logs
sudo journalctl -u x2go -f
OpenRC (Alpine Linux)
# Enable service
rc-update add x2go default
# Start service
rc-service x2go start
# Stop service
rc-service x2go stop
# Restart service
rc-service x2go restart
# Check status
rc-service x2go status
rc.d (FreeBSD)
# Enable in /etc/rc.conf
echo 'x2go_enable="YES"' >> /etc/rc.conf
# Start service
service x2go start
# Stop service
service x2go stop
# Restart service
service x2go restart
# Check status
service x2go status
launchd (macOS)
# Using Homebrew services
brew services start x2go
brew services stop x2go
brew services restart x2go
# Check status
brew services list | grep x2go
Windows Service Manager
# Start service
net start x2go
# Stop service
net stop x2go
# Using PowerShell
Start-Service x2go
Stop-Service x2go
Restart-Service x2go
# Check status
Get-Service x2go
Advanced Configuration
See the official documentation for advanced configuration options.
Reverse Proxy Setup
nginx Configuration
upstream x2go_backend {
server 127.0.0.1:22;
}
server {
listen 80;
server_name x2go.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name x2go.example.com;
ssl_certificate /etc/ssl/certs/x2go.example.com.crt;
ssl_certificate_key /etc/ssl/private/x2go.example.com.key;
location / {
proxy_pass http://x2go_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Apache Configuration
<VirtualHost *:80>
ServerName x2go.example.com
Redirect permanent / https://x2go.example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName x2go.example.com
SSLEngine on
SSLCertificateFile /etc/ssl/certs/x2go.example.com.crt
SSLCertificateKeyFile /etc/ssl/private/x2go.example.com.key
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:22/
ProxyPassReverse / http://127.0.0.1:22/
</VirtualHost>
HAProxy Configuration
frontend x2go_frontend
bind *:80
bind *:443 ssl crt /etc/ssl/certs/x2go.pem
redirect scheme https if !{ ssl_fc }
default_backend x2go_backend
backend x2go_backend
balance roundrobin
server x2go1 127.0.0.1:22 check
Security Configuration
Basic Security Setup
# Set appropriate permissions
sudo chown -R x2go:x2go /etc/x2go
sudo chmod 750 /etc/x2go
# Configure firewall
sudo firewall-cmd --permanent --add-port=22/tcp
sudo firewall-cmd --reload
# Enable SELinux policies (if applicable)
sudo setsebool -P httpd_can_network_connect on
Database Setup
See official documentation for database configuration requirements.
Performance Optimization
System Tuning
# Basic system tuning
echo 'net.core.somaxconn = 65535' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv4.tcp_max_syn_backlog = 65535' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
Monitoring
Basic Monitoring
# Check service status
sudo systemctl status x2go
# View logs
sudo journalctl -u x2go -f
# Monitor resource usage
top -p $(pgrep x2go)
9. Backup and Restore
Backup Script
#!/bin/bash
# Basic backup script
BACKUP_DIR="/backup/x2go"
DATE=$(date +%Y%m%d_%H%M%S)
mkdir -p "$BACKUP_DIR"
tar -czf "$BACKUP_DIR/x2go-backup-$DATE.tar.gz" /etc/x2go /var/lib/x2go
echo "Backup completed: $BACKUP_DIR/x2go-backup-$DATE.tar.gz"
Restore Procedure
# Stop service
sudo systemctl stop x2go
# Restore from backup
tar -xzf /backup/x2go/x2go-backup-*.tar.gz -C /
# Start service
sudo systemctl start x2go
6. Troubleshooting
Common Issues
1. Service won't start:
# Check logs
sudo journalctl -u x2go -n 100
sudo tail -f /var/log/x2go/x2go.log
# Check configuration
x2go --version
# Check permissions
ls -la /etc/x2go
2. Connection issues:
# Check if service is listening
sudo ss -tlnp | grep 22
# Test connectivity
telnet localhost 22
# Check firewall
sudo firewall-cmd --list-all
3. Performance issues:
# Check resource usage
top -p $(pgrep x2go)
# Check disk I/O
iotop -p $(pgrep x2go)
# Check connections
ss -an | grep 22
Integration Examples
Docker Compose Example
version: '3.8'
services:
x2go:
image: x2go:latest
ports:
- "22:22"
volumes:
- ./config:/etc/x2go
- ./data:/var/lib/x2go
restart: unless-stopped
Maintenance
Update Procedures
# RHEL/CentOS/Rocky/AlmaLinux
sudo dnf update x2go
# Debian/Ubuntu
sudo apt update && sudo apt upgrade x2go
# Arch Linux
sudo pacman -Syu x2go
# Alpine Linux
apk update && apk upgrade x2go
# openSUSE
sudo zypper update x2go
# FreeBSD
pkg update && pkg upgrade x2go
# Always backup before updates
tar -czf /backup/x2go-pre-update-$(date +%Y%m%d).tar.gz /etc/x2go
# Restart after updates
sudo systemctl restart x2go
Regular Maintenance
# Log rotation
sudo logrotate -f /etc/logrotate.d/x2go
# Clean old logs
find /var/log/x2go -name "*.log" -mtime +30 -delete
# Check disk usage
du -sh /var/lib/x2go
Additional Resources
---
Note: This guide is part of the HowToMgr collection. Always refer to official documentation for the most up-to-date information.