1. Trang chủ
  2. » Công Nghệ Thông Tin

Bài giảng Quản trị Linux: Package management, Ubuntu - Đặng Thanh Bình

42 71 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 42
Dung lượng 538,72 KB

Nội dung

Bài giảng Quản trị Linux cung cấp kiến thức cơ bản về package management và Ubuntu. Nội dung chính trong chương này gồm có: Introduction, dpkg, apt-get, aptitude, automatic updates, repository config. Mời các bạn cùng tham khảo.

Đặng Thanh Bình Package Management - Ubuntu Contents • • • • • • Introduction dpkg apt-get aptitude Automatic Updates Repository config INTRODUCTION Intro • Ubuntu's package management system is derived from the same system used by the Debian GNU/Linux distribution • The package files contain all of the necessary files, meta-data, and instructions to implement a particular functionality or software application on your Ubuntu computer Intro • Debian package files typically have the extension '.deb' • Packages are normally in a pre-compiled binary format; thus installation is quick, and requires no compiling of software Intro • Many complex packages use the concept of dependencies • Dependencies are additional packages required by the principal package in order to function properly DPKG dpkg • dpkg is a package manager for Debian-based systems • It can install, remove, and build packages, but unlike other package management systems, it cannot automatically download and install packages or their dependencies dpkg • To list all packages installed on the system, type: dpkg -l • Pipe the output through grep to see if a specific package is installed: dpkg -l | grep apache2 • To list the files installed by a package, in this case the ufw package, enter: dpkg -L ufw dpkg • If you are not sure which package installed a file, dpkg -S may be able to tell you dpkg -S /etc/host.conf base-files: /etc/host.conf – The output shows that the /etc/host.conf belongs to the base-files package • Many files are automatically generated during the package install process, and even though they are on the filesystem, dpkg -S may not know which package they belong to Automatic Updates • To enable automatic updates, edit /etc/apt/apt.conf.d/10periodic and set the appropriate apt configuration options: APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Download-Upgradeable-Packages "1"; APT::Periodic::AutocleanInterval "7"; APT::Periodic::Unattended-Upgrade "1"; • The above configuration updates the package list, downloads, and installs available upgrades every day The local download archive is cleaned every week Notifications • Configuring Unattended-Upgrade::Mail in /etc/apt/apt.conf.d/50unattendedupgrades will enable unattended-upgrades to email an administrator detailing any packages that need upgrading or have problems apticron • apticron will configure a cron job to email an administrator information about any packages on the system that have updates available, as well as a summary of changes in each package • To install the apticron package sudo apt-get install apticron • Edit /etc/apticron/apticron.conf, to set the email address and other options: EMAIL="root@example.com" REPO MANAGEMENT What is a repository? ● A software repository is a storage location from which software packages are retrieved for installation – ● ● Arch: pacman ● Ubuntu: apt ● CentOS: yum Packages in the official repositories are constantly upgraded – ● Used by package managers: When a package is upgraded, its old version is removed from the repository More here: https://help.ubuntu.com/community/Repositories Components of repositories? ● Four separate areas or "components", according to – ● ● The level of support offered by Ubuntu and whether or not the program in question complies with Ubuntu's Free Software Philosophy Including – Main - Officially supported software – Restricted - Supported software that is not available under a completely free license – Universe - Community maintained software, i.e not officially supported softs – Multiverse - Software that is not free The Ubuntu Install CDs contain software from the "Main" and "Restricted" components Where are they stored? ● Apt stores a list of repositories or software channels in the file /etc/apt/sources.list ● and in any file with the suffix list under the directory /etc/apt/sources.list.d/ ● See man sources.list for more about this storage mechanism /etc/apt/sources.list # sources.list #deb cdrom:[Ubuntu 13.10 _Saucy Salamander_ ­  Release i386 (20131016.1)]/ saucy main restricted # See http://help.ubuntu.com/community/UpgradeNotes  for how to upgrade to # newer versions of the distribution deb http://ch.archive.ubuntu.com/ubuntu/ saucy main  restricted deb­src http://ch.archive.ubuntu.com/ubuntu/ saucy  main restricted # Add Universe & Multiverse Repos ● Two ways 1) Uncomment related lines ● ● ● ● deb http://us.archive.ubuntu.com/ubuntu/  saucy universe deb­src  http://us.archive.ubuntu.com/ubuntu/  saucy universe deb http://us.archive.ubuntu.com/ubuntu/  saucy­updates universe deb­src  http://us.archive.ubuntu.com/ubuntu/  saucy­updates universe Add Universe & Multiverse Repos ● Two ways 2) Use the add-apt-repository command If your release is 'saucy': ● ● sudo add­apt­repository "deb  http://us.archive.ubuntu.com/ubuntu/ saucy  universe multiverse" sudo add­apt­repository "deb  http://us.archive.ubuntu.com/ubuntu/ saucy­ updates universe multiverse" – Replace 'us.' by your country code Check sources.list to see what is used! – Type lsb_release -sc to find out your release Repeat the commands with "deb-src" instead of "deb" in order to install the source files – Don't forget to retrieve the updated package lists: ● sudo apt­get update Adding Partner Repositories ● Uncommenting the following lines in /etc/apt/sources.list file: deb http://archive.canonical.com/ubuntu saucy  partner deb­src http://archive.canonical.com/ubuntu  saucy partner ● Then update as before: sudo apt­get update ● Note: this repository is NOT open source Adding Launchpad PPA Repos ● ● ● Non-Ubuntu repositories Adding the apt repository line of your software source to the end of the sources.list file It should look something like this: – ● deb http://mirror3.ubuntulinux.nl/ hardy­ seveas freenx Don't forget to make apt aware of your changes: – sudo apt­get update Adding Launchpad PPA Repos ● Use add-apt-repository Similar to "addrepo" on Debian ● sudo add-apt-repository ppa: ● Example: sudo add-apt-repository ppa:nhandler/ppa ● ● ● The command updates your sources.list file or adds/edits files under sources.list.d/ If a public key is required and available it is automatically downloaded and registered Should be installed by default On older or minimal Ubuntu releases, you may have to install softwareproperties-common and/or python-software-properties first – sudo apt-get install python-software-properties Adding ISO image to be Repos ● Check apt-cdrom command sudo mkdir /aptoncd­mountpoint sudo mount /media/USB/aptoncd.iso ~/aptoncd­ mountpoint ­oloop sudo apt­cdrom ­d=/aptoncd­mountpoint add ● man apt-cdrom for more updated info Graphical UI ● https://help.ubuntu.com/community/Repositories/ Ubuntu ... APT::Periodic::Update -Package- Lists "1"; APT::Periodic::Download-Upgradeable-Packages "1"; APT::Periodic::AutocleanInterval "7"; APT::Periodic::Unattended-Upgrade "1"; • The above configuration updates the package. .. cron scheduling utility apt-get • Install a Package sudo apt-get install nmap • Remove a Package sudo apt-get remove nmap • Multiple Packages: You may specify multiple packages to be installed... to fit your needs: Unattended-Upgrade::Allowed-Origins { "Ubuntu precise-security"; // "Ubuntu precise-updates"; }; unattended-upgrades • Certain packages can also be blacklisted and therefore

Ngày đăng: 30/01/2020, 01:53

TỪ KHÓA LIÊN QUAN