vi

Restic Server VPS: Backup Repository Mã Hóa Iceland

Restic là công cụ backup hiện đại với mã hóa end-to-end, deduplication mạnh và hỗ trợ nhiều backend storage. Khi chạy Restic REST server trên VPS offshore tại Iceland của AnubizHost, bạn có repository backup tin cậy, mã hóa client-side để server không bao giờ thấy plain data và thanh toán hoàn toàn bằng tiền điện tử. Bài viết này hướng dẫn triển khai Restic REST server production, cấu hình client backup cho Linux server, áp dụng retention policy chuẩn 3-2-1 và kiểm tra integrity định kỳ để đảm bảo backup luôn restore được khi cần.

Need this done for your project?

We implement, you ship. Async, documented, done in days.

Start a Brief

Lý Do Chọn Restic Server Trên VPS Offshore

Backup là việc bắt buộc nhưng cũng là vector tấn công nguy hiểm nhất nếu làm sai. Backup không mã hóa lưu ở Google Drive nghĩa là Google có toàn bộ dữ liệu lịch sử của bạn. Backup ở AWS S3 với SSE-S3 nghĩa là AWS giữ key mã hóa - không khác gì plain text với cơ quan có thẩm quyền.

Restic giải quyết vấn đề căn bản bằng client-side encryption với AES-256. Server chỉ thấy blob ngẫu nhiên, không bao giờ thấy nội dung hay tên file gốc. Khi đặt Restic REST server trên VPS offshore Iceland của AnubizHost, bạn có hai lớp bảo vệ: mã hóa cộng với jurisdiction privacy-friendly.

VPS Pro 8GB RAM với 200GB SSD NVMe của AnubizHost đủ làm backup target cho 5-10 server. Deduplication của Restic tiết kiệm đáng kể dung lượng - thường chỉ chiếm 30-40% so với raw data. Băng thông không giới hạn cho phép daily backup mà không lo phí phát sinh. Thanh toán Bitcoin hoặc Monero giữ bí mật về backup infrastructure - quan trọng vì kẻ tấn công thường nhắm vào backup trước khi ransomware.

Cài Đặt Restic REST Server

Restic REST server là binary Go nhẹ. Cài trên VPS từ AnubizHost:

wget https://github.com/restic/rest-server/releases/download/v0.13.0/rest-server_0.13.0_linux_amd64.tar.gz
tar xzf rest-server_0.13.0_linux_amd64.tar.gz
mv rest-server_0.13.0_linux_amd64/rest-server /usr/local/bin/
useradd -r restic -m -d /var/restic
mkdir -p /var/restic/data
chown -R restic:restic /var/restic

Tạo htpasswd file cho authentication:

apt install -y apache2-utils
htpasswd -B -c /var/restic/.htpasswd client-1
htpasswd -B /var/restic/.htpasswd client-2

Tạo systemd service /etc/systemd/system/rest-server.service:

[Unit]
Description=Restic REST Server
After=network.target

[Service]
User=restic
ExecStart=/usr/local/bin/rest-server --path /var/restic/data --htpasswd-file /var/restic/.htpasswd --private-repos --listen 127.0.0.1:8000
Restart=always

[Install]
WantedBy=multi-user.target

Đặt Nginx phía trước với HTTPS Let's Encrypt và cổng 8000 chỉ bind localhost. --private-repos đảm bảo mỗi user chỉ truy cập repository của mình. systemctl enable --now rest-server và server sẵn sàng nhận backup.

Backup Client, Retention Và Integrity Check

Trên server nguồn cần backup, cài Restic client và init repository lần đầu:

apt install -y restic
export RESTIC_REPOSITORY="rest:https://client-1:[email protected]/client-1"
export RESTIC_PASSWORD="LongMasterPassword2026"
restic init

Master password phải mạnh, dài tối thiểu 30 ký tự và lưu trong password manager riêng. Nếu mất master password thì backup vĩnh viễn không restore được - đây là tính năng bảo mật chứ không phải bug.

Backup hằng ngày qua cron:

0 3 * * * restic backup /etc /var/www /home --tag daily && \
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --prune

Retention policy này giữ 7 daily, 4 weekly, 12 monthly snapshot - tổng 23 điểm phục hồi cho 1 năm với chi phí storage thấp nhờ deduplication.

Integrity check là bước thường bị bỏ qua nhưng quan trọng. Chạy restic check --read-data-subset=5% hằng tuần để verify 5% data blocks. Mỗi tháng chạy full check restic check --read-data. Nếu có corruption sẽ phát hiện sớm. Test restore thực sự ít nhất mỗi quý - thử restic restore latest --target /tmp/test-restore rồi compare checksum với nguồn. Backup không được test không phải backup tin cậy.

Why Anubiz Host

100% async — no calls, no meetings
Delivered in days, not weeks
Full documentation included
Production-grade from day one
Security-first approach
Post-delivery support included

Ready to get started?

Skip the research. Tell us what you need, and we'll scope it, implement it, and hand it back — fully documented and production-ready.

Anubiz Chat AI

Online