VPS HC
Trang Chủ / Blog / Tối ưu VPS Ubuntu cơ bản

Tối ưu VPS Ubuntu cơ bản

Tác giả
Nguyễn Chiến
Ngày đăng
15/06/2026
Lượt xem
33
Tối ưu VPS Ubuntu cơ bản

1. Cập nhật hệ thống:

apt update && apt upgrade -y
apt autoremove -y && apt clean

2. Đặt timezone Việt Nam:

timedatectl set-timezone Asia/Ho_Chi_Minh

3. Tạo Swap (nếu RAM ít hơn 2GB):

fallocate -l 2G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile swap swap defaults 0 0" >> /etc/fstab

4. Tối ưu swappiness:

echo "vm.swappiness=10" >> /etc/sysctl.conf
sysctl -p

5. Tối ưu network:

cat >> /etc/sysctl.conf << EOF
net.core.somaxconn = 65535
net.ipv4.tcp_max_syn_backlog = 65535
net.ipv4.tcp_fin_timeout = 30
net.ipv4.ip_local_port_range = 10000 65000
EOF
sysctl -p

6. Tắt service không cần:

systemctl disable --now snapd
systemctl disable --now apport

7. Tăng file descriptor limit:

echo "* soft nofile 65535" >> /etc/security/limits.conf
echo "* hard nofile 65535" >> /etc/security/limits.conf

Kiểm tra sau tối ưu:

free -m
df -h
sysctl vm.swappiness
Có thể bạn cần xem thêm
Quay lại Blog
Bài viết đã được kiểm duyệt bởi VPS HC Team Cập nhật lần cuối: 15/06/2026

Bài Viết Liên Quan

Cần VPS tốc độ cao, giá hợp lý?

Khởi tạo trong vài phút · Hỗ trợ 24/7 · Uptime 99.99%

Dùng Thử Miễn Phí