Re-installing packages on Fedora Linux can take a very long time. Primarily as a result of, to do it, you want to have a look at DNF on your installed functions, work out the names, and manually write out each app you’d like to arrange.

Somewhat than sitting down and manually putting in all the things, you’ll be able to automate it by exporting all packages by the  Fedora app installer to a straightforward to use set up script.

Export all installed packages to a listing

Step one in making a re-installation script for Fedora Linux is to get a listing of all the installed packages on the system. The easiest way to generate a easy package deal record on Fedora is with the rpm system.

To generate a easy package deal record in Fedora, open up a terminal window by urgent Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. From there, use the rpm command under to print out a listing of all the installed apps on your Fedora Linux PC.

2Q==

rpm -qa | kind

The package deal output is intensive, and it has each single factor that has ever been installed on your Fedora Linux system. Nonetheless, simply the record as is doesn’t assist. It wants to be piped right into a textual content file for enhancing functions. Take the rpm command above and add a > image to pipe it by to a textual content file within the house listing.

rpm -qa | kind > ~/pkgs.txt

From right here, open up the Linux file supervisor on your Fedora PC, and right-click on ‘pkgs.txt’ to edit it along with your textual content editor of selection. Undergo the record of packages and take away any you don’t need. When completed, transfer on to the following part of the information.

Generate a re-installation script for Fedora

Now that all installed Fedora Linux packages are saved to an editable textual content file, we are able to use it to begin creating the re-installation script. Observe the step-by-step directions under to generate a Fedora re-install script.

WARNING: this script will fail should you try to set up packages on Fedora from third-party software program repositories in the event that they’re not enabled. To forestall it from failing to set up all the things, make sure to allow all third-party software program sources first.

Step 1: Use the contact command to create a clean SH file with the title of “fedora-app-re-installer.sh.”

contact ~/fedora-app-re-installer.sh

Step 2: Utilizing the echo command, add the script shebang to the highest of the file, in order that the interpreter can perceive how to run this script.

echo '#!/bin/bash' > fedora-app-re-installer.sh

Step 3: Add a clean line to the script in order that the instructions aren’t jumbled on the high close to the primary line with the echo command.

echo ' ' >> fedora-app-re-installer.sh

Step 4: Add the $pkgs variable to the script utilizing the echo command.

echo 'pkgs="' >> fedora-app-re-installer.sh

Step 5: Outline the $pkgs variable with the contents of the “pkgs.txt” file in your house listing that was generated earlier utilizing the rpm command.

cat pkgs.txt >> fedora-app-re-installer.sh

Step 6: Shut the $pkgs variable line off with the echo command.

echo '"' >> fedora-app-re-installer.sh

Step 7: Following the $pkgs variable, add a brand new line to the file.

echo ' ' >> fedora-app-re-installer.sh

Step 8: Add within the set up code, in order that when the script is run on a Fedora Linux PC, it’ll mechanically begin putting in all of the packages specified from varied software program repositories.

In case you plan to run the reinstallation script on a contemporary Fedora Linux PC, and not one of the packages on the record are installed, enter the command under.

echo 'sudo dnf set up $pkgs' >> fedora-app-re-installer.sh

Alternatively, if these packages are already on the system, however you need to reload all of them, strive utilizing the “reinstall” possibility as a substitute.

echo 'sudo dnf reinstall $pkgs' >> fedora-app-re-installer.sh

Step 9: Utilizing the chmod command, replace the permissions of the script file. Updating permissions is important, as it would permit the script to execute itself as a program from any Fedora Linux terminal window.

sudo chmod +x fedora-app-re-installer.sh

With the permissions up to date, the script is prepared to run. Be happy to re-do the steps on this course of should you’d like to add (or take away) packages from the record.

Operating the script

So, the re-installation script on your Fedora Linux PC is written and prepared to go. Now, all there may be to do is to run it as a program, in order that it could actually re-install all of your packages. To run the re-installation script on Fedora, open up a terminal window. As soon as the terminal window is open, achieve root entry within the house listing the place the script file is with the sudo -s command.

sudo -s

From there, run the re-installation script with the command under.

./fedora-app-re-installer.sh

Don’t need to log into the basis account to run the script? Strive executing it with the next command as a substitute.

sudo ./fedora-app-re-installer.sh



Source link

Share.
Leave A Reply

Exit mobile version