Introduction
Regularly running a Raspberry Pi update ensures optimum performance and security of the device. Bugs in code allow hackers to exploit your Raspberry Pi. These known vulnerabilities pose a significant threat, especially if a device is connected to the internet, or if you access it remotely.
Raspbian Buster is the latest version of this OS. Since its release in September, there have been several smaller updates. A Raspberry Pi update can include improvements to the bundled software, security patches, and other performance-related enhancements.
Follow this tutorial to learn how to update your Raspberry Pi.
Prerequisites
- A Raspberry Pi with Raspbian OS
- An up to date backup of your files before starting the update
- A user account with sudo
- Active internet connection
Update Raspberry Pi Operating System
Since Raspbian is based on Debian, you can update Raspberry Pi with the apt tool in a terminal window.
Start by updating the repository package list:
sudo apt update
Note: If you are using the default user account pi, the password is raspberry. We advise you to change the password to avoid potential breaches.
Before starting the upgrade, you can check the available space on your device. Run the following command:
df -h
The upgrade tool tells you how much space it needs to complete the process. To upgrade all packages on your Raspberry Pi, enter this command:
sudo apt full-upgrade
Note: The apt full-upgrade
and apt-get distro-update
command perform the same function. apt full-upgrade
does not update to a new major release of Raspbian. This command keeps your current release up-to-date.
Let the upgrade finish. Once done, you will get a pop-up confirmation message:
If you want to free up some space on your Raspberry Pi, run the clean
command to remove the downloaded .deb packages:
sudo apt clean
To reboot your device, enter:
sudo reboot
Update Raspberry Pi to Buster from an Older Version of Raspbian
To update Raspbian from an older version (for example, Stretch) to the latest (Buster, at the time of writing), you need to edit a few files.
Locate the sources.list file in the /etc/apt/ directory and replace every instance of the word stretch with the word buster. Use the editor of your choice. We will use vi:
sudo vi /etc/apt/sources.list
Save the changes and exit the editor.
Do the same for the raspi.list file:
sudo vi /etc/apt/sources.list.d/raspi.list
When you finish, update your package list:
sudo apt update
Then, run this command to complete the upgrade:
sudo apt dist-upgrade
The upgrade takes some time. Confirm with yes when prompted. Use the space bar to scroll if the installation shows a page of information and press q to resume the upgrade.
Reboot the device when the upgrade completes:
sudo reboot
Check Raspbian Version to Confirm Raspberry Pi Update
You can quickly check from the terminal if your Raspbian successfully updated to Buster.
Run the terminal from the application bar and enter:
cat /etc/os-release
Conclusion
By following this tutorial, you learned how to keep your Raspberry Pi updated. This guide also showed you how to upgrade from Raspbian Stretch to Raspbian Buster.
Make sure to update Raspberry Pi frequently to avoid security and performance issues.
If you are looking for other useful Raspberry tutorials, be sure to visit the Java Installation On Raspberry Pi and Ubuntu Mate Installation on Raspberry Pi 2 or 3 guides.
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/tech/cloud/223509.html