Linux Tip | Use a Script to Make Re-installing Easier

  Рет қаралды 24,601

Joe Collins

Joe Collins

Күн бұрын

I create and test a Bash script to automate software installation and do some system tweaks. Watch the whole video to see if it works or not.
To learn more about Bash scripting: linuxcommand.org/index.php
Here's the solution to the problem I had with the command to change swappiness: superuser.com/questions/136646...
Check out www.ezeelinux.com for more about Linux.

Пікірлер: 90
@username65585
@username65585 7 жыл бұрын
echo "vm.swappiness = 10" | sudo tee -a /etc/sysctl.conf or sudo su -c "echo 'vm.swappiness = 10' >> /etc/sysctl.conf"
@davehahn5632
@davehahn5632 7 жыл бұрын
Joe just thought I'd drop you a note. I've been on and off Linux for a few years now. Still stuck with mac and windows due to work. But lately been moving to Linux more and more. I have a few backup servers and proxmox vm Server mostly running debian. So I finally took the full plunge and loaded Debian with a kde desktop. It's a dual boot with windows via a hot swap bay. After seeing this video I played around with writing a similar script. Tweaked it in vm's till I got it 100% saves me hours of typing apt-get install xxx. I have it updating my fstab file and write all of my crontab scripts. About the only thing I need to do after the script I only need to make my cron entries and make all my visual tweaks. Awesome job with this video. As well as many others. 👍
@peterjansen4826
@peterjansen4826 7 жыл бұрын
I love that feature of the text editor which shows with a "*" that the file has been edited but not yet saved. It should be standard for any text editor/office...
@RKBibleStudy
@RKBibleStudy 7 жыл бұрын
This seems like exactly the next thing I need to learn. I'm going to study on this. Thanks for posting.
@gartennelke
@gartennelke 7 жыл бұрын
What a great idea, I've done a few re-installs, it's taken ages and I've always forgotten something. A script, so obvious!
@rob441
@rob441 7 жыл бұрын
Had this thought about 6 months ago when I was setting up a new install. So so much better the point and click for each machine.
@maximebaillot145
@maximebaillot145 7 жыл бұрын
Awesome! I never did thought about doing a Script for that Thank you! :D
@RuudKuin
@RuudKuin 3 жыл бұрын
Hi Joe, although this clip is quite dated, it still is very informative, explaining what you have written, what it does and how it works in chronological order... Thanks for sharing these great tutorials!
@hugo7302
@hugo7302 7 жыл бұрын
Cool video. Thanks for the step by step Joe, nice for us newbies.
@experimental0000
@experimental0000 7 жыл бұрын
This is pretty darn handy. I'll have to look into using this in the future.
@RockHeiland
@RockHeiland 7 жыл бұрын
I got inspired to write my own setup scripts to get my virtual machines ready for java developing (i'm testing the scripts on the virtual machines, the final scripts are used for my workingstations ofc). What i did was setting up a Github Repository and manage my Scripts there. That way i have always access to them from whereever i need to run the script, the script is always up-to-date and can be editted whenever i encounter a deprecated url or something similar.
@fernandoescobar4039
@fernandoescobar4039 6 жыл бұрын
Nice video.. Because of you only I am falling in love with linux. Thanks.
@theguyinthefunnyhat
@theguyinthefunnyhat 6 жыл бұрын
I wish I could have been arsed to do this years ago. This would have saved so much time when spinning up Linux on a new machine.
@tomormiston6592
@tomormiston6592 7 жыл бұрын
thanks for this, I'll use this approach when I next redo my dads Mint box. I think I'll also test the script in a VM first too.
@CarloLobrano
@CarloLobrano 7 жыл бұрын
Hey, cool video. I too use a script for reinstalling and found useful to use "set -e" at the beginning so the script will stop at the first error, which can be better if the following commands expect that everything went fine before them
@anarita2998
@anarita2998 7 жыл бұрын
Loved the video especially at the end where it did not work ans you go "Oh well" loved that I just laugh but it was fun watching the video and learning the advance stuff in Linux :)
@jonspoonamore3721
@jonspoonamore3721 7 жыл бұрын
Really good video today!!!! Kudos. I would like to add that I always make backup copies of files before modification. I have an Alias file that I keep up to date and it travels everywhere ever I go. I have this Alias setup: alias dstamp='date +%Y%m%d-%H%M%S' It simply creates a date and time stamp in a format of my choosing. In the case of your script, I would include this command before making any changes to a file and/or script: cp config-file.conf config-file.$(dstamp) This way, you have date/time stamped copies of the file in case something horribly goes wrong. ;)
@PiddeBas
@PiddeBas 7 жыл бұрын
Same here with an Alias file!
@AdityaKonarde
@AdityaKonarde 7 жыл бұрын
Good one. What I do is maintain a script on my GitHub, so that whenever I have a clean install I just run that script and it takes care of everything.
@pulkitnehra5308
@pulkitnehra5308 3 жыл бұрын
Could you please share the link to the repository
@eznix
@eznix 7 жыл бұрын
Thanks for the great video. I never thought to script my after install routine for Ubuntu. I try to reinstall as little as possible and after using systemback, I find I do not need to do as much after install stuff. Still, I very informative video and the bits about adjusting swappiness and such may come in handy.
@EzeeLinux
@EzeeLinux 7 жыл бұрын
Thanks! :)
@trubadyr99
@trubadyr99 7 жыл бұрын
Hat's off to you Joe Collins!
@Khyree_Holmes
@Khyree_Holmes 6 жыл бұрын
I made my own script following this video of all the single scripts I have made to install stuff with.
@bikutoso
@bikutoso 7 жыл бұрын
If i where to make a script that automates software installation I would not hard code it in the script, and instead use to csv files. One for installing tools needed later, and the second for installing normal packages and possibly the ones requiring special tools installed in the first file. And i don't think "Sudo echo 'vm.swappiness = 10' >> /etc/sysctl.conf" is a problem with systemd but rather a problem with sudo. Since I had similar problems when testing systems using OpenRC. I think what is happening is that echo gets superuser privileges but does not append to the file as a superuser. You can run the command if logged in to a superuser account.
@geodude9537
@geodude9537 6 жыл бұрын
fantastic joe, learned a lot in just a few min,, woul dlike a quick download of the script, lol
@EzeeLinux
@EzeeLinux 6 жыл бұрын
Send me a message through ezeelinux.com and I'll send them to you. :)
@ThirdEyeGoat369
@ThirdEyeGoat369 6 жыл бұрын
Awesome thanks for this video. Is there a way to just double click on the script to get it to run instead of running from the terminal?
@EzeeLinux
@EzeeLinux 6 жыл бұрын
Yes but it's more of f pain than it's worth. You can install the alacarte menu editor, create a menu entry for it and then you can just click on it or just pop open a terminal and type it in. :)
@BrunoRegno
@BrunoRegno 7 жыл бұрын
Hi joe. the problem with the sudo echo line is that sudo privilege is being applied to the echo command an not to the pipe, whose privilege is at the shell's level. you are better off removing all the sudo commands from the script and then running it as sudo ./ubuntu-install so the whole shell instance is privileged. please try it to see if I am correct.
@EzeeLinux
@EzeeLinux 7 жыл бұрын
The script runs as root from the first privileged command on. It wouldn't make a difference if you ran it with sudo from the start. It would come out the same. The solution to the problem is posted in the description. I figured it out only after posting the video. Thanks for the feedback! :)
@Tuxon86
@Tuxon86 7 жыл бұрын
Haha... Now i know your VM password! It's clicketyclick,click, clack, clack and enter 😜
@QThain
@QThain 7 жыл бұрын
There is memory problem with Ubuntu 16.04 - bugs.launchpad.net/ubuntu/+source/linux/+bug/1572801 , it lasts for 7 months, but nobody does anything. What do you think about that?
@AdityaKonarde
@AdityaKonarde 7 жыл бұрын
And yes, you can use kickstart to do all this at the time of installation, so you just boot from the flash drive, come back in some time and its all done.
@drgregoryhouse1470
@drgregoryhouse1470 4 жыл бұрын
I think you could maybe replace the user "joe" to the variable $USER, so the installscript will work independently from your user.
@iampwc
@iampwc 7 жыл бұрын
Will this script work on Mint?
@tsunamisurfer7344
@tsunamisurfer7344 7 жыл бұрын
This was awesome! I have a quick question why didn't you write a command to reboot the computer at the end of the script? Is it because this was your first time running the script and you wanted to be sure it installed everything???
@EzeeLinux
@EzeeLinux 7 жыл бұрын
Yes, you can put a reboot command in the script but I like to do that when I'm ready and not have the machine do it automatically. You never know what might happen to make you want to keep it up and running for a while. It might be transferring files while the script is running, for instance. :) :)
@xiangzhou8188
@xiangzhou8188 3 жыл бұрын
16.04 with unity still looks slick in 2021
@lifestain
@lifestain 7 жыл бұрын
Great video, I really should make my own. A nice follow-up would be to make it distro-agnostic ;)
@EzeeLinux
@EzeeLinux 7 жыл бұрын
The only way to make something like this dsitro agnostic would be to do a lot of 'if' statements with subscripts and that's way above my paygrade. :)
@lifestain
@lifestain 7 жыл бұрын
Absolutely, I won't ask that, you're already generous of your time. But, this is definately something I would want to do. I will begin by writing mine first. :)
@bradsw57
@bradsw57 7 жыл бұрын
Can I ask why you change into your home dir using "cd ~", but then use "/home/joe/whatever" in mkdir and things rather than "~/whatever". The way you've coded it seems to mandate tat only user "joe" can run the script...
@EzeeLinux
@EzeeLinux 7 жыл бұрын
You got it. This script can only run under my account on whatever machine I use it on. Adding the ~ throughout will make it user agnostic but when creating directories and running commands it's always best to use absolute paths. :)
@bradsw57
@bradsw57 7 жыл бұрын
Hmmm.... if you're outside the "home" tree, I'd agree - or if you chose to use one or the other consistently, that'd be cool too - it's just the mixing that struck me as unusual. And if you're staying in the home tree, ~/ is significantly less typo-prone :)
@linuxoptimus
@linuxoptimus 7 жыл бұрын
Cool stuff. The only thing I'd suggest is using $USER instead of joe in your script :)
@StevenDeZalia
@StevenDeZalia 6 жыл бұрын
Do you have a copy of this script your using on github or the such for me to look at deeper and poke at?
@EzeeLinux
@EzeeLinux 6 жыл бұрын
The script changes from person to person so I don't have it posted anywhere. However, I do have a bunch of nice scripts aty www.ezeelinux.com you can check out. :)
@blackeagle041
@blackeagle041 7 жыл бұрын
Now you intrigued me to bulid one for arch. Can you make a tutorial video or post the script on something like github? I would be very grateful. :)
@johndark2728
@johndark2728 7 жыл бұрын
Here you go: drive.google.com/open?id=0B1x49qDq5dEELTFDNU1ZbE9SdFE
@EzeeLinux
@EzeeLinux 7 жыл бұрын
All the commands would be different for Arch. Unfortunately, KZbin won't let me post this in the description either. Contact me through www.ezeelinux.com and I will shoot it to you in an e-mail. :)
@gz6616
@gz6616 7 жыл бұрын
If one line of command fails, will it move along or quit executing?
@EzeeLinux
@EzeeLinux 7 жыл бұрын
It will show an error then move on to the next line. :)
@andyv3965
@andyv3965 7 жыл бұрын
sudo echo "vm.swappiness = 10" >> sudo /etc/sysctl.conf ?
@bopowl4413
@bopowl4413 6 жыл бұрын
on the man page for apt-get for debian I don't see -yy as an option just -y?
@EzeeLinux
@EzeeLinux 6 жыл бұрын
The extra y forces the script to execute no matter what. I looked at the man page myself and couldn't find either. Must be a hold over from an earlier versions but it still works. :)
@GoldenGrenadier
@GoldenGrenadier 7 жыл бұрын
What I hate is how I HAVE to reinstall my Linux distro so often. Sooner or later something becomes hopelessly broken and the use case scenario is so specific that there's no fixing it. At this point a reinstall is necessary. is there a way to create a script that brings the system to a fresh install state without uninstalling all of its programs?
@GoldenGrenadier
@GoldenGrenadier 7 жыл бұрын
vista202 Ubuntu, Linux mint, Debian, and recently arch Linux. they all have intricacies that hinder full usefulness. the Debian based ones all Start having sound issues over HDMI at some point be it from my 980ti or my igpu and arch has a problem with the file manager where in neither memo or nautilus can open the properties tab without crashing.
@motoryzen
@motoryzen Жыл бұрын
Joe- you're probably getting tired of me bugging ya. 😁.. There is one last thing I'm struggling to figure out... how to turn that bash script into a GUI launcher button to simply double left click on and it launches a terminal window and auto executes all the commands within that bash script tried making a Launcher with the command without quotes " gnome-terminal -x watch scriptfile but nothing happens..made it EXECUTABLE.. nothing happens I'm wondering if I have to use gnome-termonal bash -c scriptfile or something like that. I know I had to change my free -h and du -h commands from gnome-terminal -x to that gnome-terminal bash -c for them to launch just double clicking them my gut says it's something simple I'm missing
@EzeeLinux
@EzeeLinux Жыл бұрын
It depends on your desktop. If it's gnome based, you can install alacarte which is a menu editor. It lets you create launchers and all you have to do is check the "run in terminal" box for scripts. :)
@motoryzen
@motoryzen Жыл бұрын
@@EzeeLinux Linux Mint Cinnamon. Is my daily driver. So I wonder if alacarte would work with it since by default aka OOTB it uses gnome-terminal.
@EzeeLinux
@EzeeLinux Жыл бұрын
@@motoryzen Yes, it works perfectly.... :)
@motoryzen
@motoryzen Жыл бұрын
@@EzeeLinux* bows humbly* Hai!! Arigato Sensei!! 😁👍
@johngreene6783
@johngreene6783 3 жыл бұрын
I could live without your "greetings and salutations" intro lol
@NMY556L
@NMY556L 7 жыл бұрын
just had a look and have spotted some code which you could include to set the desktop background from the shell script if you wanted as it might be something you'd like to have done as part of the process :- askubuntu.com/questions/66914/how-to-change-desktop-background-from-command-line-in-unity
@Dexter101x
@Dexter101x 7 жыл бұрын
How do you install it using a script from a clean installation?
@EzeeLinux
@EzeeLinux 7 жыл бұрын
It's in the video.
@Dexter101x
@Dexter101x 7 жыл бұрын
Joe Collins This is for re-installation from terminal
@PatriciaCurtin
@PatriciaCurtin 7 жыл бұрын
Store the script on say a USB drive or an external media of some kind?
@NMY556L
@NMY556L 7 жыл бұрын
Also it might be good to set the system to a particular screen resolution as part of the script see here:- askubuntu.com/questions/281509/how-do-i-change-the-screen-resolution-using-ubuntu-command-line/398740
@gaston-alegre-stotzer
@gaston-alegre-stotzer 4 жыл бұрын
Hi there! It's almost 2020
@VulcanOnWheels
@VulcanOnWheels 7 жыл бұрын
0:04 I wonder who, because me...I feel very different about it. 3:00 I would call that a hash. 7:00 I thought that was called an escape.
@PatriciaCurtin
@PatriciaCurtin 7 жыл бұрын
I've always called it a pound because in the days when we switched from rotary phones to touch tone thats what it was called.
@aderibigbeomisore7103
@aderibigbeomisore7103 5 жыл бұрын
Scripting made me run away from Linux, i also have a problem.. i don’t get when we do things on the server or the client workstations. How do we deploy things we do to our clients’ workstation. These videos only show us running scripts on our own computerThese issues made me fear the linux systems. I need someone to just enlighten me and not make fun of me.
@0779BooBoo
@0779BooBoo 7 жыл бұрын
I hate to say it, but I still like synaptic package manager to load up my stuff.
@VincentAndre_HK
@VincentAndre_HK 7 жыл бұрын
I used to do that, and unless you are a guy installing every week, that's more a loss of time than a real useful thing: - First, you have to be organized enough to have the script backed up properly, that's a pity if you spend more time to find it rather than typing the code directly. :) - Then you have to be a non-distro hopper, because the install commands are different whether you are DEB based or RPM or anything else. - You have to work only with repositories, no software downloaded from source (or even pre-packaged) as those have usually the version number in the download URL, when you re-install a system, you want the latest version. - Finally, you have to be using only long-term software and stick with it. Personally, I go back and forth with the browsers (Chrome, Firefox), same goes with other software. a good example I just faced, for my webserver, since the update to PHP5, all install command changed. They now changed again with PHP7. Last but not least : if you use the script to install different PC, then likelyhood that you have different usernames is high, your script won't be useful.
@DrayseSchneider
@DrayseSchneider 7 жыл бұрын
#! * hash, bang, splat. :)
@Dexter101x
@Dexter101x 7 жыл бұрын
Shebang!!!!!!
@tux1313
@tux1313 7 жыл бұрын
# = octothorpe -- look it up - it's real
@weirdscix
@weirdscix 7 жыл бұрын
It's a hash, damn Americans messing with stuff ;-) This is a £ sign lol
@weirdscix
@weirdscix 7 жыл бұрын
I've worked with computers for 30 plus years, it's always been called the hash key in the UK, probably as you say because US keyboards use a different layout
@DrayseSchneider
@DrayseSchneider 7 жыл бұрын
Скуби Ду Yeah, I honestly never heard the shell declaration as a shebang before. I have always referred to it as a hashbang though. You learn something new everyday.
@DrayseSchneider
@DrayseSchneider 7 жыл бұрын
Скуби Ду Yeah, I honestly never heard the shell declaration as a shebang before. I have always referred to it as a hashbang though. You learn something new everyday.
@hadeseye2297
@hadeseye2297 7 жыл бұрын
I wonder why it it is called shebang. Does she really like that bang?
@weirdscix
@weirdscix 7 жыл бұрын
shebang, shebang why is a Ricky Martin song echoing through my head lol
@cprn.
@cprn. 7 жыл бұрын
So... Why in a world would you ever need to *re-install*? o.O
@PatriciaCurtin
@PatriciaCurtin 7 жыл бұрын
Your drive totally died suddenly & unexpectedly maybe?
@randoschannel3801
@randoschannel3801 3 жыл бұрын
Arch users monthly task, Distrohopping, oh no my cat spilled a glass of water on my laptop, Fucked up permissions on a massive level
Linux Tip | How To Automate Tasks using Cron
38:44
Joe Collins
Рет қаралды 48 М.
Linux Tip | Moving to a New /home
30:35
Joe Collins
Рет қаралды 29 М.
Получилось у Миланы?😂
00:13
ХАБИБ
Рет қаралды 3,4 МЛН
39kgのガリガリが踊る絵文字ダンス/39kg boney emoji dance#dance #ダンス #にんげんっていいな
00:16
💀Skeleton Ninja🥷【にんげんっていいなチャンネル】
Рет қаралды 8 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:40
CRAZY GREAPA
Рет қаралды 7 МЛН
Slow motion boy #shorts by Tsuriki Show
00:14
Tsuriki Show
Рет қаралды 9 МЛН
Learning Awk Is Essential For Linux Users
20:02
DistroTube
Рет қаралды 291 М.
Linux Tip(s) | A Bunch Of Tips And Fun Tricks
27:09
Joe Collins
Рет қаралды 21 М.
Anti-Virus and Firewall Software for Linux
26:12
Joe Collins
Рет қаралды 111 М.
Linux Tip | Keep It Clean!
19:21
Joe Collins
Рет қаралды 40 М.
Useful Linux Applications | What You'll Need To Get Things Done
34:33
Linux Tip | Refresh Network Connections with a Command
19:58
Joe Collins
Рет қаралды 10 М.
Linux Tip | The "Disk Destroyer" | How to Use the dd Command.
37:56
18 Commands That Will Change The Way You Use Linux Forever
29:50
Akamai Developer
Рет қаралды 1,2 МЛН
TailsOS Guide For The Ultra Paranoid
35:32
Mental Outlaw
Рет қаралды 411 М.
Functions and Arrays in Linux | bash shell scripting
21:39
nikkiinit
Рет қаралды 6 М.
САМОЕ СЛОЖНОЕ СОРЕВНОВАНИЕ
0:41
MakkClips
Рет қаралды 1,7 МЛН
A teacher captured the cutest moment at the nursery #shorts
0:33
Fabiosa Stories
Рет қаралды 45 МЛН
Бедная бабушка...
0:56
Почему?
Рет қаралды 3,9 МЛН
Дал денег, закрыл долги прохожим
0:24
Сергей Миракл
Рет қаралды 4,1 МЛН
Телега - hahalivars
1:00
HAHALIVARS
Рет қаралды 6 МЛН
No es por nada pero ya estoy a otro nivel de fuerte 💪🏻😅
0:15