Nếu muốn viết bài xin bạn đọc hướng dẫn sử dụng Wiki
Quản lý kho phần mềm bằng lệnh
Từ Ubuntu-VN
Mục lục |
[sửa] Cơ bản
Ubuntu dùng apt để quản lý các gói phần mềm. Apt sẽ đọc các nguồn và kênh phần mềm trong tập tin:
/etc/apt/sources.list
Bằng việc chỉnh sửa tập tin đó thì bạn có thể thêm, sửa đổi hoặc bỏ một kho phần mềm nào. Trước khi bạn chỉnh sửa nó hãy sao lưu nó lại bằng lệnh :
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
Bạn chỉ có thể biên tập với quyền root, dùng lệnh:
sudo gedit /etc/apt/sources.listđể mở file bằng gedit, nếu sử dụng editor khác thì thay gedit bằng cái tương ứng (vim, kate...).
Điển hình một tập tin sources.list thường có nội dung như sau:
# sources.list # deb cdrom:[Ubuntu 8.04.1 _Hardy Heron_ - Release amd64 (20080701)]/ hardy main restricted #deb cdrom:[Ubuntu 8.04.1 _Hardy Heron_ - Release amd64 (20080701)]/ hardy main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://us.archive.ubuntu.com/ubuntu/ hardy main restricted deb-src http://us.archive.ubuntu.com/ubuntu/ hardy main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates main restricted deb-src http://us.archive.ubuntu.com/ubuntu/ hardy-updates main restricted
[sửa] Giải thích cấu tạo sources.list
- Những dòng có dấu thăng ở trước (#) là những dòng chú thích và sẽ không được apt đọc khi thực thi.
- Các dòng không có dấu thăng ở trước là các dòng chỉ nguồn của apt. Ví dụ như:
deb http://us.archive.ubuntu.com/ubuntu/ hardy main restricted deb-src http://us.archive.ubuntu.com/ubuntu/ hardy main restricted
- Giải thích:
- deb: nguồn chứa gói nhị phân hoặc đã biên dịch, cần thiết cho đa số người dùng.
- deb-src: đây là những nguồn chứa mã nguồn của các gói, hữu dụng cho các nhà phát triển.
- http://archive.ubuntu.com/ubuntu: URI (Universal Resource Identifier), trong trường hợp này là nơi chứa các gói trên internet.
- hardy: tên phiên bản phát hành của Ubuntu.
- main và restricted: tên phân loại gói xem thêm, được phân cách bằng dấu cách.
[sửa] Thêm kho phần mềm
Bạn có thể thêm các nguồn bằng cách thêm dòng vào sources.list với không có dấu thăng ở trước. Sau khi chỉnh sửa sources.list hãy lưu nó lại và tiến hành cập nhật danh sách gói bằng lệnh:
sudo apt-get update
Chúng tôi luôn luôn khuyên bạn là nên sao lưu tập sources.list lại.
[sửa] Các kho gói ở Việt Nam
Sau đây là Reponsitory của một số máy chủ ở Việt Nam hỗ trợ Ubuntu, nếu thích bạn có thể chọn một hoặc kết hợp cả ba. Các dòng này dành cho Ubuntu 8.04, nếu bạn dùng các phiên bản khác thì hãy thay hardy bằng từ tương ứng (8.10 -> intrepid).
[sửa] FPT
##FPT: deb http://mirror-fpt-telecom.fpt.net/ubuntu/ hardy main restricted universe multiverse deb http://mirror-fpt-telecom.fpt.net/ubuntu/ hardy-security main restricted universe multiverse deb http://mirror-fpt-telecom.fpt.net/ubuntu/ hardy-updates main restricted universe multiverse deb http://mirror-fpt-telecom.fpt.net/ubuntu/ hardy-proposed main restricted universe multiverse
[sửa] Hanoilug
Cho bản ubuntu 8.04
## haNoiLug: deb http://virror.hanoilug.org/ubuntu/archive hardy main restricted universe multiverse deb http://virror.hanoilug.org/ubuntu/archive hardy-updates main restricted universe multiverse deb http://virror.hanoilug.org/ubuntu/security hardy-security main restricted universe multiverse deb http://virror.hanoilug.org/ubuntu/hanoilug hardy contrib import #experimental
Cho bản ubuntu 8.10
## Hanoilug: deb http://virror.hanoilug.org/ubuntu/archive intrepid main restricted universe multiverse deb http://virror.hanoilug.org/ubuntu/archive intrepid-updates main restricted universe multiverse #deb http://virror.hanoilug.org/ubuntu/archive intrepid-backports main restricted universe multiverse deb http://virror.hanoilug.org/ubuntu/security intrepid-security main restricted universe multiverse #deb http://virror.hanoilug.org/ubuntu/medibuntu intrepid free non-free deb http://virror.hanoilug.org/ubuntu/canonical intrepid partner deb http://virror.hanoilug.org/ubuntu/hanoilug intrepid contrib import
Cho bản ubuntu 9.04
## Hanoilug: deb http://virror.hanoilug.org/ubuntu/archive jaunty main restricted universe multiverse deb http://virror.hanoilug.org/ubuntu/archive jaunty-updates main restricted universe multiverse #deb http://virror.hanoilug.org/ubuntu/archive jaunty-backports main restricted universe multiverse deb http://virror.hanoilug.org/ubuntu/security jaunty-security main restricted universe multiverse #deb http://virror.hanoilug.org/ubuntu/medibuntu jaunty free non-free deb http://virror.hanoilug.org/ubuntu/canonical jaunty partner deb http://virror.hanoilug.org/ubuntu/hanoilug jaunty contrib import
Sau khi sửa xong, hãy vào terminal và chạy lệnh:
wget -O- http://apt.hanoilug.org/hanoilug-keyring.gpg | sudo apt-key add - sudo apt-get updage
[sửa] Openlab
##openLab: deb http://www.oss-hcm.gov.vn/ubuntu/ hardy main restricted universe multiverse deb http://www.oss-hcm.gov.vn/ubuntu/ hardy-security main restricted universe multiverse deb http://www.oss-hcm.gov.vn/ubuntu/ hardy-updates main restricted universe multiverse deb http://www.oss-hcm.gov.vn/ubuntu/ hardy-proposed main restricted universe multiverse deb http://www.oss-hcm.gov.vn/ubuntu/ hardy-backports main restricted universe multiverse # là kênh thử nghiệm, không nhất thiết phải cài.
Tham khảo tại https://help.ubuntu.com/community/Repositories/CommandLine
