Linux update command line

Classic SysAdmin: Linux 101: Updating Your System

This is a classic article written by Jack Wallen from the Linux.com archives. For more great SysAdmin tips and techniques check out our free intro to Linux course.

Many years ago, when I first began with Linux, installing applications and keeping a system up to date was not an easy feat. In fact, if you wanted to tackle either task you were bound for the command line. For some new users this left their machines outdated or without applications they needed. Of course, at the time, most everyone trying their hand at Linux knew they were getting into something that would require some work. That was simply the way it was. Fortunately times and Linux have changed. Now Linux is exponentially more user friendly – to the point where so much is automatic and point and click – that today’s Linux hardly resembles yesterday’s Linux.

But even though Linux has evolved into the user-friendly operating system it is, there are still some systems that are fundamentally different than their Windows counterparts. So it is always best to understand those systems in order to be able to properly use those system. Within the confines of this article you will learn how to keep your Linux system up to date. In the process you might also learn how to install an application or two.

There is one thing to understand about updating Linux: Not every distribution handles this process in the same fashion. In fact, some distributions are distinctly different down to the type of file types they use for package management.

  • Ubuntu and Debian use .deb
  • Fedora, SuSE, and Mandriva use .rpm
  • Slackware uses .tgz archives which contain pre-built binaries
  • And of course there is also installing from source or pre-compiled .bin or .package files.

As you can see there are number of possible systems (and the above list is not even close to being all-inclusive). So to make the task of covering this topic less epic, I will cover the Ubuntu and Fedora systems. I will touch on both the GUI as well as the command line tools for handling system updates.

Ubuntu Linux

Ubuntu Linux has become one of the most popular of all the Linux distributions. And through the process of updating a system, you should be able to tell exactly why this is the case. Ubuntu is very user friendly. Ubuntu uses two different tools for system update:

Читайте также:  Файл сервер linux debian

Ubuntu Update Manager

The Update Manger is a nearly 100% automatic tool. With this tool you will not have to routinely check to see if there are updates available. Instead you will know updates are available because the Update Manager will open on your desktop (see Figure 1) as soon as the updates depending upon their type:

If you want to manually check for updates, you can do this by clicking the Administration sub-menu of the System menu and then selecting the Update Manager entry. When the Update Manager opens click the Check button to see if there are updates available.

Figure 1 shows a listing of updates for a Ubuntu 9.10 installation. As you can see there are both Important Security Updates as well as Recommended Update. If you want to get information about a particular update you can select the update and then click on the Description of update dropdown.

  1. Check the updates you want to install. By default all updates are selected.
  2. Click the Install Updates button.
  3. Enter your user (sudo) password.
  4. Click OK.

The updates will proceed and you can continue on with  your work. Now some updates may require either you to log out of your desktop and log back in, or to reboot the machine. There are is a new tool in development (Ksplice) that allow even the update of a kernel to not require a reboot.
Once all of the updates are complete the Update Manage main window will return reporting that Your system is up to date.

Updating via command line

Now let’s take a look at the command line tools for updating your system. The Ubuntu package management system is called apt. Apt is a very powerful tool that can completely manage your systems packages via command line. Using the command line tool has one drawback – in order to check to see if you have updates, you have to run it manually. Let’s take a look at how to update your system with the help of Apt. Follow these steps:

  1. Open up a terminal window.
  2. Issue the command sudo apt-get upgrade.
  3. Enter your user’s password.
  4. Look over the list of available updates (see Figure 2) and decide if you want to go through with the entire upgrade.
  5. To accept all updates click the ‘y’ key (no quotes) and hit Enter.
  6. Watch as the update happens.

That’s it. Your system is now up to date. Let’s take a look at how the same process happens on Fedora (Fedora 12 to be exact).

Читайте также:  Linux невозможно удалить папку

Fedora Linux

Fedora is a direct descendant of Red Hat Linux, so it is the beneficiary of the Red Hat Package Management system (rpm). Like Ubuntu, Fedora can be upgraded by:

GNOME PackageKit

Depending upon your desktop, you will either use the GNOME or the KDE front-end for PackageKit. In order to open up this tool you simply go to the Administration sub-menu of the System menu and select the Software Update entry.  When the tool opens (see Figure 3) you will see the list of updates. To get information about a particular update all you need to do is to select a specific package and the information will be displayed in the bottom pane.

To go ahead with the update click the Install Updates button. As the process happens a progress bar will indicate where GNOME (or KDE) PackageKit is in the steps. The steps are:

  1. Resolving dependencies.
  2. Downloading packages.
  3. Testing changes.
  4. Installing updates.

When the process is complete, GNOME (or KDE) PackageKit will report that your system is update. Click the OK button when prompted.

Now let’s take a look at upgrading Fedora via the command line. As stated earlier, this is done with the help of the yum command. In order to take care of this, follow these steps:

Updating with the help of yum

  1. Open up a terminal window (Do this by going to the System Tools sub-menu of the Applications menu and select Terminal).
  2. Enter the su command to change to the super user.
  3. Type your super user password and hit Enter.
  4. Issue the command yum update and yum will check to see what packages are available for update.
  5. Look through the listing of updates (see Figure 4).
  6. If you want to go through with the update enter ‘y’ (no quotes) and hit Enter.
  7. Sit back and watch the updates happen.
  8. Exit out of the root user command prompt by typing “exit” (no quotes) and hitting Enter.
  9. Close the terminal when complete.

Your Fedora system is now up to date.

Final Thoughts

Granted only two distributions were touched on here, but this should illustrate how easily a Linux installation is updated. Although the tools might not be universal, the concepts are. Whether you are using Ubuntu, OpenSuSE, Slackware, Fedora, Mandriva, or anything in-between, the above illustrations should help you through updating just about any Linux distribution. And hopefully this tutorial helps to show you just how user-friendly the Linux operating system has become.

Читайте также:  Calculate linux desktop cinnamon

Ready to continue your Linux journey? Check out our free intro to Linux course!

Источник

How to update Ubuntu, Linux Mint by command-line

command-line update ubuntu

I f you have been using Ubuntu and Linux Mint for a while, you might be aware of how to keep your system up to date by graphical user interface method (GUI) using the corresponding Package Manager. Ubuntu users need to use the Ubuntu Software Center, and Linux Mint users can use the Update Manager to keep the system updated with official security fixes and updated apps.

Update Manager in Linux Mint

Update Manager in Linux Mint

In this beginner’s tutorial, we shall see how to install the same updates by using the command-line method via the Terminal instead of the GUI way. This is typically the first step to go command-line on the approach to learning Linux.

Install Updates on Ubuntu, Linux Mint, and elementary OS from the Terminal

Launch the Terminal App. On Ubuntu, you can do this by going to the “Activities” menu and looking for “terminal” in the search box. You can also use the Ctrl+Alt+T keyboard combination.

Step 1: Update your system’s repository using the apt-get update command. You must enter the admin password when prompted.

Update command Linux Mint

Update command Linux Mint

Step 2: Once the repo is updated, it’s time to now fetch the updates from the official server and also apply the updates. The apt-get upgrade command will never remove the currently installed packages. New versions of currently installed packages that cannot be upgraded will be left at their current version. Use the apt upgrade command:

Upgrade command Linux Mint

Upgrade command Linux Mint

That’s it; your system should be updated by now!

[Tip] Using Distribution Upgrade

There is yet another command that you can use instead of apt-get upgrade command. It’s the apt-get dist-upgrade. This command intelligently handles changing dependencies with new versions of packages.

It will attempt to upgrade the most important packages at the expense of less important ones if necessary, to prevent broken installations. The dist-upgrade command may, therefore, remove some outdated and broken packages. You can use it when “Step 2” ends up with an error.

Installing only the security updates

Some times to save time while administrating the remote machines, you may want to launch Terminal and only install the security updates.

You can use the unattended upgrade command, which will silently install updates without user interaction.

sudo apt-get install unattended-upgrades

Instead, if you want to have an interactive installation, use the display parameter:

sudo apt-get install unattended-upgrades -d

Источник

Оцените статью
Adblock
detector