Set up a remote server

· 4 min read · Tutorials

Set up a remote server

TL;DR: Step-by-step guide to setting up a Linux server for bioinformatics. Covers SSH access, essential security (firewall, keys), environment setup (Conda, Docker), and advanced storage configuration (RAID).


Why a Remote Server?

Bioinformatics often requires more RAM and CPU than a laptop provides. Moving to a remote server allows you to:

  • Run long jobs (days/weeks) without keeping your laptop open
  • Access more power (64GB+ RAM, dozens of cores)
  • Collaborate by sharing data and environments
  • Keep data safe with proper backup strategies

Server Setup Diagram


Part 1: Initial Access

Whether you're using AWS, DigitalOcean, Oracle Cloud, or a university HPC, you'll access it via SSH.

1. Connect via Terminal

# Syntax: ssh user@ip-address
ssh [email protected]

If you have a PEM key (common for AWS/Oracle):

chmod 400 key.pem
ssh -i key.pem [email protected]

2. Set Up SSH Keys (Passwordless Login)

Stop using passwords! They are insecure and tedious.

On your local machine:

# Generate key pair (if you haven't already)
ssh-keygen -t ed25519 -C "[email protected]"

# Copy public key to server
ssh-copy-id [email protected]

Now you can log in with just ssh [email protected].


Part 2: Essential Security

Before installing analysis tools, secure your server.

1. Update System

sudo apt update && sudo apt upgrade -y

2. Configure Firewall (UFW)

Allow only essential ports.

# Deny all incoming by default
sudo ufw default deny incoming
sudo ufw default allow outgoing

# Allow SSH (CRITICAL: Do this before enabling!)
sudo ufw allow ssh

# Allow HTTP/HTTPS (if hosting web apps/Shiny)
sudo ufw allow http
sudo ufw allow https

# Enable firewall
sudo ufw enable

3. Create a Non-Root User

Avoid working as root.

# Create user 'bioinfo'
sudo adduser bioinfo

# Grant sudo privileges
sudo usermod -aG sudo bioinfo

# Switch to new user
su - bioinfo

Part 3: Bioinformatics Environment

1. Install Mamba (Faster Conda)

Mamba is the standard for package management in 2026.

# Download Miniforge (includes Mamba)
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-*.sh

# Follow prompts, then restart shell
source ~/.bashrc

2. Install Common Tools

sudo apt install -y build-essential git htop tmux tree unzip wget

3. Connect VS Code

The best way to edit code on a server.

  1. Install VS Code locally.
  2. Install the Remote - SSH extension.
  3. Click the green icon (bottom left) > "Connect to Host..."
  4. Enter [email protected].

You can now edit files and run terminals on the server as if it were local.


Part 4: Advanced Storage (RAID)

If you are setting up a physical server or bare-metal instance with multiple raw disks, you may need to configure RAID for performance or redundancy.

Note: Cloud VMs (EC2, Droplets) usually handle this for you. This section is for physical setups.

1. Check Drives

lsblk
sudo fdisk -l

2. Create Partitions

Assuming /dev/sdc and /dev/sdd are your new data drives:

sudo fdisk /dev/sdc
# Steps: n (new) > p (primary) > 1 > Enter > Enter > t (type) > fd (RAID) > w (write)
# Repeat for /dev/sdd

3. Create RAID Array

Using mdadm tool.

Option A: RAID 1 (Mirroring)
Best for safety. If one drive fails, data is safe.

sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdc1 /dev/sdd1

Option B: RAID 0 (Striping)
Best for speed. Combined capacity, but if one fails, ALL data is lost.

sudo mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sdc1 /dev/sdd1

4. Format and Mount

# Format as ext4
sudo mkfs.ext4 /dev/md0

# Create mount point
sudo mkdir -p /mnt/data

# Mount
sudo mount /dev/md0 /mnt/data

5. Persist on Reboot

Add to /etc/fstab so it mounts automatically.

# Get UUID
sudo blkid /dev/md0

# Edit fstab
sudo nano /etc/fstab

# Add line:
# UUID=xxxx-xxxx-xxxx  /mnt/data  ext4  defaults  0  2

Part 5: Exposing Services (Optional)

If you are hosting a Shiny app or RStudio Server, you might need Cloudflare Tunnels to expose it securely without opening ports.

  1. Install cloudflared on the server.
  2. Authenticate: cloudflared tunnel login
  3. Start tunnel: cloudflared tunnel --url http://localhost:3838

This gives you a secure https://...trycloudflare.com URL for your local service.


Troubleshooting

"Permission denied (publickey)"

Cause: SSH key not added to server.
Fix: Run ssh-copy-id again or check permissions of ~/.ssh/authorized_keys (should be 600).

"Sudouser is not in the sudoers file"

Cause: Forgot to add user to sudo group.
Fix: Log in as root/ubuntu and run sudo usermod -aG sudo username.

Disk full but I just added 10TB?

Cause: New disk isn't mounted.
Fix: Check df -h. If /mnt/data isn't there, follow the "Format and Mount" steps above.


Resources


See also:


Originally posted on WeChat Official Account: bioinfo_studyroom

Server Setup