How to Update Ubuntu: A Complete Guide with Scheduling and Auto Update

Keeping your Ubuntu system updated is key to running it securely and efficiently. But constantly checking for updates can get tedious. Wouldn’t it be nice to automate the process or at least schedule updates at convenient times? In this guide, I’ll show you how to update Ubuntu manually, schedule updates, and enable auto updates. By the end, you’ll know exactly how to keep your system running smoothly without breaking a sweat.

Let’s get started-

Why Updating Ubuntu Matters

Before we dive into how to update and schedule updates, let’s talk about why it matters.

  • Security: Regular updates protect your system from vulnerabilities and malware.
  • Performance: Updates often improve system performance and introduce new features.
  • Stability: Bug fixes and system improvements keep your Ubuntu environment stable and efficient.

How to Update Ubuntu Manually

We’ll start with the basics: updating Ubuntu manually. This is the most straightforward approach. There are two ways to do this—through the Graphical User Interface (GUI) or the terminal.

Method 1: Updating Ubuntu via GUI

This is the easiest option, especially if you’re new to Ubuntu or just prefer clicking around instead of using the terminal.

Step-by-Step Instructions:

  1. Open Software Updater:
    Click the “Show Applications” button (the nine dots in the bottom-left corner of your desktop). In the search bar, type “Software Updater” and open it.
  2. Check for updates:
    Ubuntu will automatically search for any available updates. It may take a minute.
  3. Install updates:
    If updates are available, click the “Install Now” button. You’ll be asked for your password to authenticate the installation.
  4. Restart if needed:
    After the updates are done, you might need to restart your system. If so, click “Restart Now.”

And that’s it! Pretty simple, right?

Method 2: Updating Ubuntu via Terminal

For more advanced users or those comfortable with the command line, the terminal offers a faster and more efficient way to update Ubuntu.

Step-by-Step Instructions:

  1. Open the Terminal:
    Press Ctrl + Alt + T to open the terminal.
  2. Update package lists:
    Before installing any updates, you need to refresh your package lists by running:
sudo apt update
  1. Install available updates:
    After the package list is updated, install the updates with:
sudo apt upgrade
  1. Optional: Full system upgrade:
    For a more thorough update that manages package dependencies, use:
sudo apt full-upgrade
  1. Clean up:
    Once the updates are installed, you can clean up unnecessary packages by running:
sudo apt autoremove
  1. Restart if necessary:
    Finally, restart your system if needed by typing:
sudo reboot

Pro Tip:

Running sudo apt autoremove regularly helps free up space on your system by removing packages you no longer need.

Table 1: GUI vs Terminal Update Comparison

MethodUser FriendlinessSpeedBest For
GUIHighSlowerBeginners
TerminalIntermediateFasterAdvanced Users

How to Schedule Updates in Ubuntu

Maybe you want to make sure your system updates regularly but don’t want to run updates manually. Ubuntu allows you to schedule updates so you can set it and forget it. This is especially useful if you run a server or prefer updates to happen at off-peak hours.

Using cron to Schedule Updates

We’ll use cron, a tool that lets you schedule tasks in Ubuntu. Here’s how to schedule updates to run automatically at your chosen time.

Step-by-Step Instructions:

  1. Open the terminal:
    Again, press Ctrl + Alt + T.
  2. Edit the cron jobs:
    Type the following command to edit your cron jobs:
sudo crontab -e

You might be asked to choose an editor (I recommend using nano for simplicity).

  1. Add your update schedule:
    At the bottom of the file, add the following line to schedule an update every day at 3 a.m.:
0 3 * * * sudo apt update && sudo apt upgrade -y

This command tells Ubuntu to check for and install updates every day at 3 a.m. You can adjust the timing if you prefer updates to run at a different time.

  1. Save and exit:
    Press Ctrl + O to save, and then Ctrl + X to exit the editor.
  2. Check your cron jobs:
    To make sure everything is set up correctly, you can list your current cron jobs with:
sudo crontab -l

Real-Life Example:

If you manage a web server, you can schedule updates to run late at night, reducing the risk of downtime during peak hours.

Enabling Auto Updates in Ubuntu

If you don’t want to worry about scheduling updates or running them manually, you can enable automatic updates. Ubuntu has a built-in feature that automatically installs security updates and other important packages.

Step-by-Step Guide to Enable Auto Updates:

  1. Install Unattended Upgrades:
    First, ensure that the unattended-upgrades package is installed by running:
sudo apt install unattended-upgrades
  1. Configure automatic updates:
    Open the configuration file for unattended upgrades with:
sudo nano /etc/apt/apt.conf.d/50unattended-upgrades
  1. Enable auto-updates for all packages:
    Look for the line:
"${distro_id}:${distro_codename}-updates";

Uncomment it (remove the //), so it applies to all updates.

  1. Enable automatic upgrades:
    Now, open the auto-upgrades configuration file by running:
sudo nano /etc/apt/apt.conf.d/20auto-upgrades

Make sure the following lines are present:

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
  1. Save and exit:
    Save your changes (Ctrl + O) and exit (Ctrl + X).

Your system will now automatically check for and install updates without needing any intervention from you.

Table 2: Manual Update vs Auto Update

MethodManual UpdatesAuto Updates
ControlFull control over when and what updatesLimited control; runs automatically
User EffortRequires manual interventionFully automated
Best ForUsers who want to manage updatesUsers who prefer hassle-free updating

Common Pitfalls to Avoid

  1. Not backing up: Always back up important data before updates, especially on critical systems.
  2. Skipping restarts: Some updates only take effect after a restart. Ignoring this can cause issues.
  3. Ignoring disk space: Make sure you have enough space before running updates, or they could fail.

Frequently Asked Questions (FQ&A)

How do I know when an update requires a restart?

Ubuntu will notify you if a restart is needed after an update.

Can I disable automatic updates?

Yes, you can disable automatic updates by editing the auto-upgrades configuration file and setting Unattended-Upgrade to "0".

How often does Ubuntu check for updates?

By default, Ubuntu checks for updates daily, but this can be adjusted in the settings.

Is it safe to enable auto updates?

Yes, it’s generally safe, especially for security updates. However, for critical systems, you may prefer to review updates before installing.

What’s the difference between an update and an upgrade?

An update fetches new versions of installed software, while an upgrade installs newer versions of the operating system itself

Conclusion

Updating Ubuntu is essential for maintaining security and performance. Whether you prefer manual updates, scheduled updates via cron, or automatic updates with unattended upgrades, the choice is yours. Each method offers different levels of control and convenience.

Final Takeaway:

For most users, enabling auto-updates is the easiest way to ensure your system stays secure. If you run critical systems or simply prefer control, scheduling updates through cron might be the better option. Whichever method you choose, regular updates will keep your Ubuntu system running smoothly and safely.

About the Author: Vikas Maurya

Vikas Maurya has been fascinated by Linux and Ubuntu ever since he started using them years ago. With a knack for explaining technical topics in plain, everyday language, he’s spent countless hours helping others navigate the Ubuntu system. His approach focuses on practical, easy-to-follow tutorials that even beginners can appreciate. When he’s not working on guides, Vikas enjoys experimenting with new software tools and staying involved in the Linux community.

Full Bio »

Leave a Comment