Wednesday, October 26, 2016

How to Create a Text File for Multiple Software Installations on Linux

Hello everyone,

Today, I'll show you a simple way to automate the installation of multiple software packages on a newly installed Linux system — by using a text file and a shell script.

If you've just installed a Linux distribution, especially Fedora or Ubuntu-based, you might find it time-consuming to install all your essential tools one by one. Let's solve that with a batch installation script.


Step 1: Create a .txt or .sh File

Open any text editor and create a file named example.txt (or better, example.sh if you're writing a shell script).

Paste the following commands into the file:

bash

# Update system sudo dnf -y update echo "================================================================" echo " Update Successfully Installed " echo "================================================================" # Install Google Chrome wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm sudo dnf -y install ./google-chrome-stable_current_x86_64.rpm echo "================================================================" echo " Chrome Successfully Installed " echo "================================================================" # Install Vim sudo dnf -y install vim echo "================================================================" echo " Vim Successfully Installed " echo "================================================================" # Install VLC Media Player sudo dnf -y install vlc echo "================================================================" echo " VLC Player Successfully Installed " echo "================================================================" # Install Skype sudo dnf -y install skype echo "================================================================" echo " Skype Successfully Installed " echo "================================================================" # Install Atom Editor (if available in repo or via RPM) sudo dnf -y install atom echo "================================================================" echo " Atom Successfully Installed " echo "================================================================" # Install Aptitude (for Debian-based systems only) # You can skip this if you're on Fedora sudo apt-get -y install aptitude echo "================================================================" echo " Aptitude Successfully Installed " echo "================================================================"

⚠️ Note: The commands above are primarily for Fedora (dnf). If you're on Ubuntu or Debian-based systems, replace dnf with apt.


Step 2: Save the File

Save the file as example.sh (recommended since it's a shell script, not just plain text).


Step 3: Make the Script Executable

Now, open your terminal and run the following command to make the script executable:

bash

chmod 744 example.sh

This sets the file permissions so that:

  • You (the file owner) can read, write, and execute the script.

  • Others can only read it.


Step 4: Run the Script

Execute the script by running:

bash

./example.sh

This will start installing all the listed software, one by one, automatically.


Final Notes

  • Make sure your internet connection is active.

  • You may need to enter your password when prompted by sudo.

  • You can always add or remove software commands to suit your preferences.


Summary

Using a script file for software installation saves time and ensures consistency every time you set up a new system.

Let me know if you'd like a follow-up post on writing cross-platform install scripts for both Ubuntu and Fedora systems.

2 comments: