Debian linux update all

Linux Update All Packages Command Using the CLI

Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements None
Est. reading time 1m

Linux Commands To Update All Packages

  1. Debian / Ubuntu / Mint Linux and friends try the apt-get command/apt command.
  2. CentOS / RHEL / Red Hat / Fedora Linux and friends try yum command.
  3. Suse / OpenSUSE Linux use the zypper command. We can also use graphical tool called YaST online update.
  4. Slackware Linux user try the slackpkg command.
  5. Arch Linux user try the pacman command.
  6. Gentoo Linux user try emerge command.
  7. Alpine Linux user must use apk command.

update vs upgrade in Linux

We use the update option to download package information from all configured sources such as the Internet. The upgrade option will install available upgrades of all packages currently installed on the system from the sources such as the Internet. New packages will be installed if required to satisfy dependencies, but existing packages will never be removed. If an upgrade for a package requires removing an installed package, the upgrade for this package isn’t performed. Hence, this is a safer option in all cases.

apt-get command example to update all packages on the Debian or Ubuntu Linux

Run:
$ sudo apt-get update
$ sudo apt-get upgrade

See apt-get command or apt command tutorial for more information.

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

yum command example to update all packages on the RHEL/CentOS/Red Hat/Fedora Linux

Execute the following command:
# yum update
See my yum command tutorial for more information.

zypper command example to update all packages on the OpenSUSE/Suse Linux

# zypper refresh
# zypper update
See our zypper command tutorial for more information.
See zypper Opensuse command tutorial or Novell SUSE Linux tutorial to update all package for more info.

pacman command example to update all packages on the Arch Linux

Arch Linux follows rolling distro model. Packages are updated frequently:
# pacman -Syu
OR
# pacman —sync —refresh —sysupgrade
See pacman package manager documentation for more information.

emerge command example to update all packages on the Gentoo Linux

We can use the emerge command as follows:
# emerge —sync
# emerge —update —deep —with-bdeps=y @world
See emerge package manager documentation for more information.

apk command for Alpine Linux

Update the terminal and then run the following apk command:
# apk update
# apk upgrade

Conclusion

You learned how to update all packages installed on various Linux distros using the CLI (command-line) options. This is useful for various reasons:

  • Fixing security bugs
  • Applying Linux kernel patches
  • Getting an updated version of app
  • Increasing performance and stability of Linux desktop or server

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Источник

ChapterВ 9.В Keeping your Debian system up-to-date

Table of Contents

One of Debian’s goals is to provide a consistent upgrade path and a secure upgrade process. We always do our best to make upgrading to new releases a smooth procedure. In case there’s some important note to add to the upgrade process, the packages will alert the user, and often provide a solution to a possible problem.

You should also read the Release Notes document that describes the details of specific upgrades. It is available on the Debian website at https://www.debian.org/releases/stable/releasenotes and is also shipped on the Debian CDs, DVDs and Blu-ray discs.

9.1.В How can I keep my Debian system current?

One could simply execute an anonymous ftp call to a Debian archive, then peruse the directories until one finds the desired file, and then fetch it, and finally install it using dpkg . Note that dpkg will install upgrade files in place, even on a running system. Sometimes, a revised package will require the installation of a newly revised version of another package, in which case the installation will fail until/unless the other package is installed.

Many people find this approach much too time-consuming, since Debian evolves so quickly — typically, a dozen or more new packages are uploaded every week. This number is larger just before a new major release. To deal with this avalanche, many people prefer to use a more automated method. Several different packages are available for this purpose:

9.1.1.В aptitude

aptitude is the recommended package manager for Debian GNU/Linux systems, and is described in Section 8.1.3, “aptitude”.

Before you can use aptitude to make an upgrade, you’ll have to edit the /etc/apt/sources.list file to set it up. If you wish to upgrade to the latest stable version of Debian, you’ll probably want to use a source like this one:

You can replace ftp.us.debian.org (the mirror in the United States) with the name of a faster Debian mirror near you. See the mirror list at https://www.debian.org/mirror/list for more information.

Or you can use the redirector service httpredir.debian.org which aims to solve the problem of choosing a Debian mirror. It uses the geographic location of the user and other information to choose the best mirror that can serve the files. To take advantage of it use a source like this one:

More details on this can be found in the sources.list (5) manual page.

To update your system from the command line, run

Answer any questions that might come up, and your system will be upgraded.

Note that aptitude is not the recommended tool for doing upgrades from one Debian GNU/Linux release to another. Use apt-get instead. For upgrades between releases you should read the Release Notes. This document describes in detail the recommended steps for upgrades from previous releases as well as known issues you should consider before upgrading.

For details, see the manual page aptitude (8) , and the file /usr/share/aptitude/README .

9.1.2.В apt-get and apt-cdrom

An alternative to aptitude is apt-get which is an APT-based command-line tool (described previously in Section 8.1.2, “APT”).

apt-get , the APT-based command-line tool for handling packages, provides a simple, safe way to install and upgrade packages.

To use apt-get , edit the /etc/apt/sources.list file to set it up, just as for Section 9.1.1, “aptitude”.

Answer any questions that might come up, and your system will be upgraded. See also the apt-get (8) manual page, as well as Section 8.1.2, “APT”.

If you want to use CDs/DVDs/BDs to install packages, you can use apt-cdrom . For details, please see the Release Notes, section «Adding APT sources from optical media».

Please note that when you get and install the packages, you’ll still have them kept in your /var directory hierarchy. To keep your partition from overflowing, remember to delete extra files using apt-get clean and apt-get autoclean , or to move them someplace else (hint: use apt-move ).

9.1.3.В mirror

This Perl script, and its (optional) manager program called mirror-master , can be used to fetch user-specified parts of a directory tree from a specified host via anonymous FTP.

mirror is particularly useful for downloading large volumes of software. After the first time files have been downloaded from a site, a file called .mirrorinfo is stored on the local host. Changes to the remote file system are tracked automatically by mirror , which compares this file to a similar file on the remote system and downloads only changed files.

The mirror program is generally useful for updating local copies of remote directory trees. The files fetched need not be Debian files. (Since mirror is a Perl script, it can also run on non-Unix systems.) Though the mirror program provides mechanisms for excluding files with names matching user-specified strings, this program is most useful when the objective is to download whole directory trees, rather than selected packages.

9.2.В Must I go into single user mode in order to upgrade a package?

No. Packages can be upgraded in place, even in running systems. Debian has a start-stop-daemon program that is invoked to stop, then restart running process if necessary during a package upgrade.

9.3.В Do I have to keep all those .deb archive files on my disk?

No. If you have downloaded the files to your disk then after you have installed the packages, you can remove them from your system, e.g. by running aptitude clean .

9.4.В How can I keep a log of the packages I added to the system? I’d like to know when upgrades and removals have occurred and on which packages!

Passing the —log -option to dpkg makes dpkg log status change updates and actions. It logs both the dpkg -invokation (e.g.

) and the results (e.g.

) If you’d like to log all your dpkg invocations (even those done using frontends like aptitude ), you could add

to your /etc/dpkg/dpkg.cfg . Be sure the created logfile gets rotated periodically. If you’re using logrotate , this can be achieved by creating a file /etc/logrotate.d/dpkg with the following lines

More details on dpkg logging can be found in the dpkg (1) manual page.

aptitude logs the package installations, removals, and upgrades that it intends to perform to /var/log/aptitude . Note that the results of those actions are not recorded in this file!

Another way to record your actions is to run your package management session within the script (1) program.

9.5.В Can I automatically update the system?

Yes. You can use cron-apt ; this tool updates the system at regular intervals using a cron job. By default it just updates the package list and downloads new packages, but without installing them.

Note: Automatic upgrade of packages is NOT recommended in testing or unstable systems as this might bring unexpected behaviour and remove packages without notice.

9.6.В I have several machines; how can I download the updates only one time?

If you have more than one Debian machine on your network, it is useful to use apt-cacher to keep all of your Debian systems up-to-date.

apt-cacher reduces the bandwidth requirements of Debian mirrors by restricting the frequency of Packages, Releases and Sources file updates from the back end and only doing a single fetch for any file, independently of the actual request from the proxy. apt-cacher automatically builds a Debian HTTP mirror based on requests which pass through the proxy.

Of course, you can get the same benefit if you are already using a standard caching proxy and all your systems are configured to use it.

Источник

Debian upgrade or update a single package using apt-get

How to Debian upgrade or update a single package

The procedure to update a a specific package on Debian:

  1. Open the Terminal application by visiting menus in the GUI
  2. Update package index by running sudo apt update command
  3. Now only update nginx package by running sudo apt install nginx command.
  4. If nginx package already installed it will try to update to the latest version. If you do not want to install new packages; when used in conjunction with install, only-upgrade will install upgrades for already installed packages only and ignore requests to install new packages. Try sudo apt —only-upgrade install nginx

Let us see all commands in details for Debian Linux 6.x/7.x/8.x/9.x server.

How to upgrade a single package using apt-get?

As usual you need to fetch an updated index from the Internet:
$ sudo apt-get update
Sample outputs:

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

You need to use following format with the apt-get command:
$ sudo apt-get —only-upgrade install Package
$ sudo apt-get install Package
Let us try to upgrade apache2 web server:
$ sudo apt-get install apache2
If apache2 package is already installed it will try to update to latest version:

However, the following will not install a new nginx package if not installed:
$ sudo apt-get —only-upgrade install apache2
In this following example, apache2 is installed and I am requesting update. However, nginx package not installed on a Debian and I am still requesting an update for it:
$ sudo apt-get install apache2
$ sudo apt-get —only-upgrade install nginx

Conclusion

You learned how to update a specific package on Debian Linux based system or server. Please note that you need to pass the —only-upgrade to the apt command when you only want that single package upgrade provided that it is installed. See apt man page here for more info.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Источник

Читайте также:  Windows система не видит всю оперативку
Оцените статью