I recently switched from Windows server to Fedora 32/33 server running in the cloud. How do I apply software updates and patches on Fedora 32/33 server using the terminal application?

Fedora Linux uses dnf command. It is the next upcoming major version of yum command. Yum is a package manager for RPM-based Linux distributions such as CentOS/RHEL 7.x and older version of Fedora Linux. You need to use the dnf command to update Fedora Linux using terminal for latest software patches. This page explains how to update a Fedora Linux using the terminal.
Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements Fedora Linux
Est. reading time 2m and your Internet connection speed

Updating Fedora using the terminal go get latest software

Let us see all commands in details to update Fedora Linux using terminal to get latest software patches.

Step 1. Open the terminal application

Open the terminal application and then at the bash prompt type the following command to login into remote server:
$ ssh vivek@fedora28-nixcraft-cloud

Step 2. Update Fedora Linux using the terminal dnf command

Type the following dnf command and sudo command:
sudo dnf upgrade
How to update Fedora Linux using terminal for latest software

The dnf update command will also work. However, it deprecated the alias for the upgrade command. Therefore, I suggest you use the dnf upgrade only.

Step 3. Note down the Fedora Linux kernel version

Type the following command to find our the Linux kernel version:
uname -mrs
Sample outputs:

Linux 4.16.3-301.fc28.x86_64 x86_64

Step 4. Reboot the Fedora Linux box

Type the following command to reboot the Fedora Linux server/desktop:
sudo reboot
OR
sudo shutdown -r now
Sample outputs:

Connection to 192.168.122.156 closed by remote host.
Connection to 192.168.122.156 closed.

After reboot, make sure all services are running on your server. For instance, is Nginx running?
ps aux | grep nginx
Do check for log files for errors using a combination of egrep command dmesg | egrep -i 'error|critical|warn|failed'
Make sure you look into other log files stored in /var/log/ directory too. For instance, one can use the tail command and journalctl command/systemctl command:
tail -f /var/log/nginx/error.log
systemctl status nginx
journalctl -u nginx

Daily backups are essential to avoid accidental damage or recovery from a lousy software update or disk failure. Hence I suggest that you make a backup. Verify it too.

What to do if Nginx or PHP upgrade causing a problem with my App? Can I rollback updates?

Fedora keeps track of all dnf commands. Here is how to view history:
sudo dnf history
sudo dnf history list
sudo dnf history info

For instance look for nginx install or update as follows:
sudo dnf history list | grep nginx
Note down the ID number. Say it is 304 for nginx update. Then, you need to type the following command to rollback or undo that update:
sudo dnf history undo 304
See “CentOS/RHEL Use yum Command To Downgrade or Rollback Updates” for more info.

Step 5. Verify new Fedora Linux kernel

Type the following command after ssh into your Fedora Linux cloud server/desktop:
ssh vivek@fedora28-nixcraft-cloud
uname -mrs

Sample outputs:

Linux 4.16.9-300.fc28.x86_64 x86_64

Step 6. Learning more about the dnf command to update Fedora Linux software

The dnf command also acts as a package manager for Fedora Linux. You can install new software, remove existing software, update specific software, list installed patches and more. Here are some command examples:

How to install new software called htop on Fedora Linux

sudo dnf install htop

Delete/erase an existing software called htop on Fedora Linux

sudo dnf remove htop

List all installed software

sudo dnf list installed| more
To learn more about the dnf command, type the following man command or read the official documentation:
$ man dnf

Conclusion

And there you have it. You just updated Fedora Linux using terminal to get latest software patches. Keeping your software up to date is an essential task to avoid security problems. Hence, regularly run the ‘sudo dnf upgrade‘ command.


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 1 comment so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
1 comment… add one
  • New to Fedora Terminal Mar 4, 2021 @ 3:48

    I was looking for Fedora update command from terminal. Who knew just typing dnf update will apply all updates?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum