• Important: We recently upgraded our forum software - please let us know if you run into any issues.

Making a Switch

I've been an avid Mint user for at least the past 3 years, and still love the distro and would still definitely recommend it to new users. Or to anyone I suppose. But having been running Fedora 27 one one of my laptops and on a laptop at work in a VM, I am ready to make the switch to it on my primary machine.

I created a text file with a command to install a dozen or so programs I want on any fresh install. I'd like to turn it into a script so that's the next thing I need to learn.

So far it seems like dnf is easier to use than apt. Less verbiage. At least what I've been using the cli for.
 


atanere

Moderator
Gold Supporter
That's what it's all about... freedom... deb/rpm/src... hdd/usb/dvd/vm... so many ways to run and enjoy Linux. :cool::D

Are you going with the standard Gnome desktop on Fedora? Or choosing one of the spins?

Cheers
 
I hate Gnome 3, which is what I believe Fedora's default DE is. I had grown accustomed to Cinnamon on Mint so that's what I'm using on F27 now. Have tried KDE on a few occasions but keep finding myself going back to Cinnamon.

What's your distro/DE of choice?
 

atanere

Moderator
Gold Supporter
I hate Gnome 3, which is what I believe Fedora's default DE is. I had grown accustomed to Cinnamon on Mint so that's what I'm using on F27 now. Have tried KDE on a few occasions but keep finding myself going back to Cinnamon.

What's your distro/DE of choice?
In recent years I have mostly used Linux Mint too, and MATE has been very steady and stable for me. I like Cinnamon too, but I had some video hiccups with it so I have not used it as much (but I do currently have a laptop with Mint/Cinnamon on it). I also like LXDE very well for layout, speed, and low resource requirements.

I can get around in Gnome 3, KDE, Unity, and the others, but I've never settled into any for long term use. But I download new distros all the time and keep a large pile of DVD's nearby that I can boot up and run for troubleshooting, so I've played with just about all of them at one time or another. Checking out new stuff is a big part of the fun for me. :D
 

wizardfromoz

Super Moderator
Staff member
Gold Supporter
An IT Coordinator, eh? We can make use of him, Stan ? (@atanere )

Welcome, @mrcrossroads , hope you enjoy this site :D

I am from Down Under, so I hope you get used to my sometimes bizarre sense of humour.

Wizard's Rule of Thumb:

Always keep a live USB/DVD of Ubuntu or Linux Mint on hand ... incredibly reliable for kickstarting your system when it is borked. You can always get rid of it later (I use Linux from the five major Families).

Cheers and avagudweegend.

ANY of them beats the W10 GUI! :-D
Good taste ;)

BTW - if you share the list of apps with us, and whether you just want it for RPM-based such as Fedora, or other, we will probably have someone within our ranks whom can assist. Or you might rather wish to work it out yourself. I use the term "druther" - I'd rather do this, or I'd rather do that. So what's your druther?

Edited - added BTW
 
Last edited:
Thanks @wizardfromoz nice to meet you.

I always appreciate a good sense of humor, even if it's bizarre. The things going on in the world sucks so it's good to enjoy company with folks with like interests. ;)

I appreciate the script offer. I think I'd like to just learn how to do it. I want to get past being just a basic Linux user and start digging a little deeper.
 

JasKinasis

Well-Known Member
I created a text file with a command to install a dozen or so programs I want on any fresh install. I'd like to turn it into a script so that's the next thing I need to learn.
It sounds like you already have 99% of a script.
Turning it into a script is quite simple.

Assuming you have a text file like this:
PostInstallActions.txt
Code:
To install my preferred programs
from a fresh install use the command:
dnf install program1 program2 program3
First up add a shebang (#!) line at the top of the file that tells the shell which interpreter to use. So if you use bash you can add:
Code:
#!/bin/bash
NOTE: This must be the very first line in the file.
Also, if you use a different shell you can specify it there - e.g. sh, zsh, csh etc etc.

Also, any lines of text that are not part of the command should be commented out using a # at the start of the line. So we should comment out the lines that contain our note to ourself.

So now we have a file that looks like this:
Code:
#!/bin/bash
# To install my preferred programs
# from a fresh install use the command:
dnf install program1 program2 program3
Alternatively, the commented out notes could be removed leaving us with:
Code:
#!/bin/bash
dnf install program1 program2 program3
Whatever you choose to do - now your text file is a valid shell-script.
The final task is to make it executable:
Code:
chmod +x PostInstallActions.txt
Optionally, you might also want to rename the script to lose the .txt extension, or rename it entirely:
Code:
mv ./PostInstallActions.txt mypostinstall.sh
Now we have a script called mypostinstall.sh which we can execute using:
Code:
./mypostinstall.sh
You can back that up somewhere (on a USB stick) and then run it each time you do a fresh install on one of your PCs.
Job done! You've created your first simple script.

Edit:
There is a lot of other shell-scripting syntax for looping and branching and dealing with variables - allowing you to create much more complex scripts - I won't touch on that - I'll leave it to you to look into that.
There are a lot of websites and ebooks available that can help you to learn shell-scripting.
And there are several of us here who can help with any shell-scripting questions you might have along the way.

But for now, if you just want to run a sequence of simple commands in a script all you need to know is:
1. The first line must be a shebang line telling the shell which command interpreter to use
2. Comments always start with # - everything else is a command. Add any commands you want to run with some useful comments
3. Make the script executable

And that's about it at the simplest level.

I hope this was a useful start for you!
 
Last edited:
@JasKinasis

Wow man, thanks! That's simple enough. I'll try it out this evening.

I appreciate the help. :)

So, would this be legit?

________________________________________________
#!/bin/bash

sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

dnf install -y vlc dropbox unzip icedtea-web java-openjdk gimp qbittorrent VirtualBox wine youtube-dl mediawriter terminator bleachbit redshift chromium filezilla wireshark-qt p7zip p7zip-plugins unrar

dnf install -y gstreamer1-plugins-base gstreamer1-plugins-good gstreamer1-plugins-ugly gstreamer1-plugins-bad-free gstreamer1-plugins-bad-freeworld gstreamer1-plugins-bad-free-extras ffmpeg

dnf config-manager --add-repo=http://negativo17.org/repos/fedora-steam.repo
dnf -y install steam

dnf config-manager --add-repo=http://negativo17.org/repos/fedora-spotify.repo

dnf install -y spotify-client
 
Last edited:

JasKinasis

Well-Known Member
@JasKinasis
So, would this be legit?

________________________________________________
#!/bin/bash

sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

dnf install -y vlc dropbox unzip icedtea-web java-openjdk gimp qbittorrent VirtualBox wine youtube-dl mediawriter terminator bleachbit redshift chromium filezilla wireshark-qt p7zip p7zip-plugins unrar

dnf install -y gstreamer1-plugins-base gstreamer1-plugins-good gstreamer1-plugins-ugly gstreamer1-plugins-bad-free gstreamer1-plugins-bad-freeworld gstreamer1-plugins-bad-free-extras ffmpeg

dnf config-manager --add-repo=http://negativo17.org/repos/fedora-steam.repo
dnf -y install steam

dnf config-manager --add-repo=http://negativo17.org/repos/fedora-spotify.repo

dnf install -y spotify-client
As long as each of those dnf commands are valid and work - then yup, seems legit to me!
I haven't used any Red Hat based distros for many years... Long before dnf arrived!
 

atanere

Moderator
Gold Supporter
As long as each of those dnf commands are valid and work - then yup, seems legit to me!
I haven't used any Red Hat based distros for many years... Long before dnf arrived!
I'll just throw in my two cents also. If your list of commands fails to work completely, you may need to concatenate them together. I use rsync to perform a number of separate backups from different folders, and I have these commands saved to a text file that I paste into a terminal to execute. Each of my commands are listed on a separate line with && at the end to join (concatenate) them together... kind of like this:

Code:
command #1 &&
command #2 &&
command #3 &&
command #4
So, after I paste all the of the commands into a terminal and hit Enter, they all execute sequentially. Perhaps this isn't needed in a Bash script though... I am not sure. It is just a thought in case your run into trouble creating your script.

Cheers
 
I'll just throw in my two cents also. If your list of commands fails to work completely, you may need to concatenate them together. I use rsync to perform a number of separate backups from different folders, and I have these commands saved to a text file that I paste into a terminal to execute. Each of my commands are listed on a separate line with && at the end to join (concatenate) them together... kind of like this:

Code:
command #1 &&
command #2 &&
command #3 &&
command #4
So, after I paste all the of the commands into a terminal and hit Enter, they all execute sequentially. Perhaps this isn't needed in a Bash script though... I am not sure. It is just a thought in case your run into trouble creating your script.

Cheers
Thanks for the pointer. I may get around to converting my last machine from Mint to Fedora this week. Will have this page handy! :-D
 

wizardfromoz

Super Moderator
Staff member
Gold Supporter
@nina22 - Nina, is English your first language? Or are you on your meds?

Your comment is simply copied and pasted from the first post.

Wizard
 

kenJackson

Member
I created a text file with a command to install a dozen or so programs I want on any fresh install.
Excellent!

I have a very elaborate script that doesn't actually install packages from repositories, but checks and reports what needs to be installed. It also creates ssh keys, installs my pub ssh keys from other machines, installs my universal .bashrc file and quite a number of my favorite scripts and configuration files. It fixes up my directories (~/img instead of ~/Pictures, etc.) and edits ~/.config/user-dirs.dirs.

Like you, I've found the dnf (or yum) tools more convenient than the apt tools.

Most DEs irritate me. I've found IceWM to be very preferable to all others.
 

wizardfromoz

Super Moderator
Staff member
Gold Supporter
Maybe you can share that with us some time over in Command Line, Ken? :)

Jas (@JasKinasis ) is our resident "Man" on scripting, but I dabble a little too, and I am sure we would be interested.

Cheers

Wizard
 

dos2unix

Member
If you want to completely automate an install, kickstart is kind of cool. Not always practical for a "one shot" single build, but if you have another computer with a VM on it
it makes life easier.
 

Members online

No members online now.

Top