Để thay thế nguồn phần mềm trong tệp /etc/apt/sources.list của hệ thống Ubuntu 18.04 bằng các mirror trong nước, bạn có thể thực hiện theo các bước sau:
Bước 1: Sao lưu tệp sources.list
Trước khi tiến hành chỉnh sửa, bạn cần sao lưu tệp gốc để phòng ngừa trường hợp xảy ra lỗi.
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
Bước 2: Chỉnh sửa tệp sources.list
Sử dụng trình soạn thảo văn bản để mở và chỉnh sửa tệp:
sudo nano /etc/apt/sources.list
Xóa toàn bộ nội dung cũ và thay thế bằng một trong các cấu hình dưới đây tùy thuộc vào mirror bạn chọn.
Mirror từ FPT
deb http://ftp.fpt.edu.vn/ubuntu/ bionic main restricted universe multiverse
deb http://ftp.fpt.edu.vn/ubuntu/ bionic-updates main restricted universe multiverse
deb http://ftp.fpt.edu.vn/ubuntu/ bionic-security main restricted universe multiverse
deb http://ftp.fpt.edu.vn/ubuntu/ bionic-backports main restricted universe multiverse
Mirror từ RikkeiSoft
deb http://mirror.riksoftvn.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirror.riksoftvn.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirror.riksoftvn.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirror.riksoftvn.com/ubuntu/ bionic-backports main restricted universe multiverse
Mirror từ VNU-HCM
deb http://Mirror.vnu-hcm.edu.vn/ubuntu/ bionic main restricted universe multiverse
deb http://Mirror.vnu-hcm.edu.vn/ubuntu/ bionic-updates main restricted universe multiverse
deb http://Mirror.vnu-hcm.edu.vn/ubuntu/ bionic-security main restricted universe multiverse
deb http://Mirror.vnu-hcm.edu.vn/ubuntu/ bionic-backports main restricted universe multiverse
Bước 3: Cập nhật danh sách gói phần mềm
Sau khi đã chỉnh sửa xong tệp sources.list, bạn cần chạy lệnh cập nhật để áp dụng thay đổi:
sudo apt update
Bước 4: Nâng cấp hệ thống (tùy chọn)
Để đảm bảo hệ thống luôn ở phiên bản mới nhất, bạn có thể nâng cấp tất cả các gói đã cài đặt:
sudo apt upgrade -y
Lưu ý quan trọng
Tên mã "bionic" phải được giữ nguyên vì đó là tên mã dành riêng cho Ubuntu 18.04. Nếu gặp vấn đề về kết nối mạng hoặc không thể truy cập mirror, hãy thử chuyển sang một mirror khác. Đối với các mirror sử dụng giao thức HTTPS, đảm bảo rằng gói apt-transport-https đã được cài đặt:
sudo apt install apt-transport-https
Các mirror thay thế khác
Ngoài các mirror đã liệt kê, bạn cũng có thể tham khảo thêm một số mirror phổ biến khác như:
Viettel Cloud: http://mirrors.viettelidc.com.vn/ubuntu/ Hanoi Apt Mirror: http://apt.hn.linux.vn/ubuntu/
Thông qua các bước trên, bạn sẽ dễ dàng thay thế nguồn phần mềm mặc định của Ubuntu 18.04 bằng các mirror trong nước, giúp tăng tốc độ tải xuống gói phần mềm.