Installing software
لم يُترجم بعد؛ يُعرض باللغة الإنجليزية
On Linux you rarely download programs from web sites. A package manager fetches ready-made packages from a repository, works out what each one needs, unpacks the files into place and keeps a list of what is installed. Follow one real install, sudo apt install tree on Debian 12, from fresh package lists to the new command in /usr/bin, then see how to remove it safely.
5 أسئلة سريعة
اختر إجابة لتعرف السبب. تُحفَظ نتيجتك مع تقدّمك.
01What does sudo apt update do?
update refreshes the package index files in /var/lib/apt/lists so apt knows what each repository offers. Installing or upgrading is a separate command.
02tree's entry says Depends: libc6 (>= 2.34). The computer has libc6 2.36. What must apt fetch?
2.36 is 2.34 or newer, so the need is already met. apt only downloads tree itself. If libc6 were missing or older than 2.34, apt would fetch it first.
03Which program actually unpacks a .deb file onto the disk and records it as installed?
apt finds and downloads packages, then hands the .deb to dpkg. dpkg copies the files into place and writes the package into its database, /var/lib/dpkg/status.
04Why do these commands start with sudo?
Programs go into folders such as /usr/bin that ordinary users may not change. sudo runs the command as root after checking that you are allowed to.
05You type sudo apt remove tree. What should you do before you answer Y?
Removing a package also removes packages that depend on it. apt lists everything it will remove and waits for your answer, so read it. remove keeps settings files; purge deletes those too.
المسرد
- Package
- One file holding a program ready to install: its files plus a label with its name, version and what it needs. Debian and Ubuntu use .deb files.
- Repository
- A server holding thousands of packages and a signed index that lists them. Files under /etc/apt say which repositories your computer uses.
- Package manager
- The tool that finds, downloads, installs, upgrades and removes packages for you. apt on Debian and Ubuntu, dnf on Fedora.
- Dependency
- Another package a package needs in order to work, written in its Depends field, for example libc6 (>= 2.34).
- apt
- Debian's high-level package tool: it reads the package lists, works out dependencies, downloads .deb files and calls dpkg.
- dpkg
- Debian's lower-level package tool: it unpacks a .deb onto the disk and keeps the list of installed packages in /var/lib/dpkg/status.
- sudo
- Runs one command as root, the superuser, if your account is allowed to. Needed for anything that changes system files.
- root
- The superuser account, which may change any file on the system.
الملاحظات والمصادر
- The example is Debian 12 ("bookworm"), where tree is version 2.1.0-1 and needs libc6 (>= 2.34). Ubuntu works the same way with its own versions. The terminal shows only the key lines apt and dpkg print.
- Real Debian version numbers have more rules than plain numbers (an epoch, a revision after the dash, and "~"); the comparison here is the simple case. See deb-version(7).
- sudo asks for your own password and only works if your account is allowed to use it. On a fresh Debian install that may need setting up first.
- apt keeps downloaded .deb files in /var/cache/apt/archives; sudo apt clean empties that folder.
- Debian manpages: apt-get(8), update, install, remove and FILES
- Debian manpages: apt(8), the command-line interface
- Debian manpages: dpkg(1), the package manager for Debian
- Debian manpages: deb(5), the binary package format
- Debian manpages: sources.list(5), APT's list of data sources
- Debian Policy Manual, ch. 7: Declaring relationships between packages (Depends)
- Debian packages: tree in bookworm (version 2.1.0-1, Depends: libc6 (>= 2.34))
- Debian packages: file list of tree in bookworm (amd64)
- Debian packages: libc6 in bookworm
- Linux man-pages: sudo(8)
- Linux man-pages: hier(7), the filesystem hierarchy (/usr/bin)
- Debian Reference, ch. 2: Debian package management
- Fedora Docs: Using the DNF software package manager
اختبار يتاح بعد الخطوة الأخيرة.