Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My Ubuntu 18.04 Install Setup Script
#1
Lightbulb 
ne of the nicest things about having BASH be such an integrated part of Linux is the way it let's users be "aggressively lazy." You can use a bash script to automate just about anything... This script automates the basic setup of my main Ubuntu machine. Now, this won't be exactly what you'd need but it serves as a good example of this kind of script. Take from it what you will.



The first step in the process is to install Ubuntu. Next, I run all the updates and configure the Update Manager the way I want. A quick reboot and then I can run this script to grab all the basic stuff I need to get going. This gets my system about 90 percent setup. There are some scripts and downloaded software I will install manually. Could I put that in the spirit? Sure! The main reason I have left it out is because I want this to work whether or not I have copied all my personal data over to the new system. 

Scripts like this tend to change over time so I have put very clear comments in here and left space between different functions so I can come back and edit it with ease. 

UPDATE: I did decide to go on and put automatic installation of my local. deb packages. I keep these in a directory called 'Packages' is down loads. I added some code to test for that directory and if it's there when the script runs it will go on install those programs. If that directory has not yet been copied in, the script will post a warning and keep going. I also made the script call the local @USER variable to make it easier for others to adapt it for their own use.

ubuntu-18-04-install-script.sh (Original script from video.)

Code:
#!/bin/bash

# Ubuntu (GNOME) 18.04 setup script.

# First, let's install a bunch of software:

sudo apt install virtualbox virtualbox-guest-additions-iso virtualbox-ext-pack \
nvidia-340 net-tools htop grsync lame asunder soundconverter brasero git mc \
openssh-server sshfs gedit-plugin-text-size simplescreenrecorder libreoffice \
ubuntu-restricted-extras mpv vlc gthumb gnome-tweaks tracker chrome-gnome-shell \
qt5-style-plugins spell gdebi synaptic -yy

# Add me to any groups I might need to be a part of:

sudo adduser joe vboxusers

# Remove undesirable packages:

sudo apt purge gstreamer1.0-fluendo-mp3 deja-dup shotwell -yy

# Remove snaps and get packages from apt:

sudo snap remove gnome-characters gnome-calculator gnome-system-monitor
sudo apt install gnome-characters gnome-calculator gnome-system-monitor -yy

# Purge Firefox, install Google Chrome:

rm -r .mozilla .cache/mozilla
sudo apt purge firefox -yy
sudo apt purge firefox-locale-en -yy
mkdir /tmp/gc-install-tmp
pushd /tmp/gc-install-tmp
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo gdebi -n google-chrome-stable_current_amd64.deb
popd
rm -rf /tmp/gc-install-tmp

# set Qt variable in /etc/environment:

sudo bash -c "echo 'QT_QPA_PLATFORMTHEME=gtk2' >> /etc/environment"

# Gotta reboot now:

echo "*** All done! Please reboot now. ***"
exit

ubuntu-18-04-install-script.sh (Mew updated version.)

Code:
#!/bin/bash

# Ubuntu (GNOME) 18.04 setup script.

# Must have Gdebi!:

dpkg -l | grep -qw gdebi || sudo apt-get install -yyq gdebi

# First, let's install a bunch of software:

sudo apt install virtualbox virtualbox-guest-additions-iso virtualbox-ext-pack \
nvidia-340 net-tools htop grsync lame asunder soundconverter brasero git mc \
openssh-server sshfs gedit-plugin-text-size simplescreenrecorder libreoffice \
ubuntu-restricted-extras mpv vlc gthumb gnome-tweaks tracker chrome-gnome-shell \
qt5-style-plugins spell synaptic -yy

# Install all local .deb packages, if available:

if [ -d "/home/$USER/Downloads/Packages" ]; then
    echo "Installing local .deb packages..."
    pushd /home/$USER/Downloads/Packages
    for FILE in ./*
   do
       sudo gdebi -n "$FILE"
   done
    popd
else
    echo $'\n'$"WARNING! There's no ~/Downloads/Packages directory."
    echo "Local .deb packages can't be automatically installed."
    sleep 5 # The script pauses so this message can be read.
fi

# Add me to any groups I might need to be a part of:

sudo adduser $USER vboxusers

# Remove undesirable packages:

sudo apt purge gstreamer1.0-fluendo-mp3 deja-dup shotwell -yy

# Remove snaps and get packages from apt:

sudo snap remove gnome-characters gnome-calculator gnome-system-monitor
sudo apt install gnome-characters gnome-calculator gnome-system-monitor -yy

# Purge Firefox, install Google Chrome:

sudo apt purge firefox -yy
sudo apt purge firefox-locale-en -yy
if [ -d "/home/$USER/.mozilla" ]; then
    rm -rf /home/$USER/.mozilla
fi
if [ -d "/home/$USER/.cache/mozilla" ]; then
    rm -rf /home/$USER/.cache/mozilla
fi
mkdir /tmp/gc-install-tmp
pushd /tmp/gc-install-tmp
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo gdebi -n google-chrome-stable_current_amd64.deb
popd
rm -rf /tmp/gc-install-tmp

# Install Timeshift:

sudo apt-add-repository -y ppa:teejee2008/ppa -y
sudo apt install timeshift

# set Qt variable in /etc/environment:

sudo bash -c "echo 'QT_QPA_PLATFORMTHEME=gtk2' >> /etc/environment"

# Gotta reboot now:

echo $'\n'$"*** All done! Please reboot now. ***"
exit

Have fun!
-- Your Fearless Leader!

Reply
#2
Thanks for the script Joe!

Would adding 'gimp-plugin-registry' be of any use? Its about 100 very popular Gimp plug-ins. They are easily installed for Gimp 2.8, but need to copy across the scripts to Gimp 2.10 plug-ins folder.

This works for me via terminal (I had Gimp 2.8 installed but purged to test)

Note: I assumed Gimp 2.10 already installed via Snap or Flatpak ---

$ sudo mkdir -p /usr/lib/gimp/2.0/plug-ins
$ sudo apt install gimp-plugin-registry

I'm a fan of Snap's and Flatpak so I figured out there directories hence
for Flatpak
$ cp -r /usr/lib/gimp/2.0/plug-ins ~/.var/app/org.gimp.GIMP/config/GIMP/2.10

for Snap
$ cp -r /usr/lib/gimp/2.0/plug-ins ~/snap/gimp/47/.config/GIMP/2.10

[ I'm not sure where an 'apt install' of Gimp 2.10 would be but if one opens up Gimp 2.10 then
Edit --> Preferences --> scroll down to Folders. Cloick on '2.10' folder and then 'others' you can see the path. ]

I guess an install script could have a conditional to test to see if snaps or Flatpak were installed

Anyhow just my pennies worth Wink
PS Hope I'm posting in the right way, just registered!
Reply
#3
(09-01-2018, 07:14 PM)Tomdom Wrote: Thanks for the script Joe!

Would adding 'gimp-plugin-registry' be of any use? Its about 100 very popular Gimp plug-ins. They are easily installed for Gimp 2.8, but need to copy across the scripts to Gimp 2.10 plug-ins folder.

This works for me via terminal (I had Gimp 2.8 installed but purged to test)
Whatever works for you... If you need to set it up at install, add it. Smile
-- Your Fearless Leader!

Reply
#4
Great video. I'm about to install a fresh Ubuntu MATE for my wife as she gets ready for the next school year. She's a teacher and I'm trying to encourage her to use a Lenovo instead of a school issued Windows 10 computer. I might use your script to finish the install since I like your suggestions about additional packages to install. I was just curious about why you prefer software that comes from the repositories over Snaps, to the point of removing pre-installed snaps only to then reinstall the same packages from the repos? Thanks for everything that you do!
Reply
#5
(09-01-2018, 09:14 PM)Rob Wrote: Great video. I'm about to install a fresh Ubuntu MATE for my wife as she gets ready for the next school year. She's a teacher and I'm trying to encourage her to use a Lenovo instead of a school issued Windows 10 computer. I might use your script to finish the install since I like your suggestions about additional packages to install. I was just curious about why you prefer software that comes from the repositories over Snaps, to the point of removing pre-installed snaps only to then reinstall the same packages from the repos? Thanks for everything that you do!

Snaps don't follow the desktop theme. I'd prefer to have the ones from the repos that do. That's it. Best of luck switching your wife! Smile
-- Your Fearless Leader!

Reply
#6
Thank you, Joe, for creating this script. I watched the entire video and I like that BASH scripts exists. The only thing is that I do not know what to do with the code you provided and I did not find any instructions even if I watched your BASH videos. It must have slipped me... So can you please tell me where do I paste the code and how do I run it? Thank you!
Reply
#7
(09-02-2018, 11:59 AM)ovisergiu Wrote: Thank you, Joe, for creating this script. I watched the entire video and I like that BASH scripts exists. The only thing is that I do not know what to do with the code you provided and I did not find any instructions even if I watched your BASH videos. It must have slipped me... So can you please tell me where do I paste the code and how do I run it? Thank you!
Copy it in to a text editor, save it as a file. Make that file executable. You can do that by right clicking in a file manager, choose Properties and then Permissions and check the box that allows it to be executed as a program. You run it in a terminal after installing and updating Ubuntu. ( ./name-ofscript-.sh with the terminal open to the directory where you have the script.) Remove the nvidia drivers from the list and replace it with the ones for you card, if you need them at all. 


Smile
-- Your Fearless Leader!

Reply
#8
enjoyed the video learned will try it out once at least thank you
 Linux Laptop: Hp DV6 3028tx i5
 User --> Ubuntu Desktop 18.04, 16.04, 14.04.
Reply
#9
Really like the idea of an tailored installscript for my needs and ease of use when reinstalling.
I have a question thou:

I would like to make it so the script automatically installs a couple of repos before continue further installing more software.
I know how to install a repo manually, but my question is how does the command look like to automatically get past where I need to "Hit Enter to Proceed" part of adding a repo ?
Linux..the way it was meant to be !
Reply
#10
(09-04-2018, 12:55 AM)mrazster Wrote: Really like the idea of an tailored installscript for my needs and ease of use when reinstalling.
I have a question thou:

I would like to make it so the script automatically installs a couple of repos before continue further installing more software.
I know how to install a repo manually, but my question is how does the command look like to automatically get past where I need to "Hit Enter to Proceed" part of adding a repo ?

Just do something like this:


Code:
sudo add-apt-repository ppa:(Your ppa here) -y


Smile
-- Your Fearless Leader!

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)