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:
- 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. - Check for updates:
Ubuntu will automatically search for any available updates. It may take a minute. - Install updates:
If updates are available, click the “Install Now” button. You’ll be asked for your password to authenticate the installation. - 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:
- Open the Terminal:
PressCtrl + Alt + T
to open the terminal. - Update package lists:
Before installing any updates, you need to refresh your package lists by running:
sudo apt update
- Install available updates:
After the package list is updated, install the updates with:
sudo apt upgrade
- Optional: Full system upgrade:
For a more thorough update that manages package dependencies, use:
sudo apt full-upgrade
- Clean up:
Once the updates are installed, you can clean up unnecessary packages by running:
sudo apt autoremove
- 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
Method | User Friendliness | Speed | Best For |
---|---|---|---|
GUI | High | Slower | Beginners |
Terminal | Intermediate | Faster | Advanced 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:
- Open the terminal:
Again, pressCtrl + Alt + T
. - 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).
- 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.
- Save and exit:
PressCtrl + O
to save, and thenCtrl + X
to exit the editor. - 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:
- Install Unattended Upgrades:
First, ensure that theunattended-upgrades
package is installed by running:
sudo apt install unattended-upgrades
- Configure automatic updates:
Open the configuration file for unattended upgrades with:
sudo nano /etc/apt/apt.conf.d/50unattended-upgrades
- 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.
- 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";
- 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
Method | Manual Updates | Auto Updates |
---|---|---|
Control | Full control over when and what updates | Limited control; runs automatically |
User Effort | Requires manual intervention | Fully automated |
Best For | Users who want to manage updates | Users who prefer hassle-free updating |
Common Pitfalls to Avoid
- Not backing up: Always back up important data before updates, especially on critical systems.
- Skipping restarts: Some updates only take effect after a restart. Ignoring this can cause issues.
- 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.