Do you prepare for a power outage?

I see those are a heap of extra stuff, I guess no distri will offer out of the box.
My advice is, that install everything frim cli. You can gather the know how for that. Just keep a note, write into a file what commands you used ti install those. Can you imagine, this note is basically an install script, you can run anytime on any computer. I have szch a script. It’s so easy to install to multiple computers the same set of apps and settings…

3 Likes

You would have to be close to the most sophisticated user at this forum .
I agree with @kovacslt … no distro will have all that by default. It is a lot of work to install and configure all those apps. I hope this current gliche with MX does not repeat itself. Some regular system backups are necessary.

2 Likes

You have a script to install and setup apps? This I need to know about. Please elaborate.

Let’s take a simple app that you use this script with.

I understand using CLI to install some apps. In fact, I had to use that for Crossover last time as it refused to register that I owned it with GUI. So looked up the CLI and it instantly registered. But you still have to set them up with GUI do you not? You can’t script the setup, can you? I have the various dot folders in backups, but I guess I do not understand how to write all of the needed factors into a script I can run.

Sheila

1 Like

Theoretically yes, but it would require a lot of knowledge and would be difficult to keep up with apps changing their config file formats.
A set of config notes is what I use. Then I can just use CLI and copy/paste from the notes.

2 Likes

I don’t consider myself that, but what is the saying, Necessity is the Mother of Invention? That is me.

I have a problem to resolve. I know I can find a way. Sometimes that requires a lot of forum posting :laughing: so that others can assist me. But until you have the need, you may not even know something to fill it is available.

That is why I am continually amazed at what you can do with Linux. Password manager in CLI–yep. I just need to get time to learn how to use it, then I can stop using password managers.

And I am sure there are other options out there, unknown to me, that could maybe replace most of those apps I require. But for now, I use what I know.

Need to connect your phone to your computer, use it as a remote control while watching videos or listening to music, need to send a photo immediately to your /Pictures folder? Quickly answer a text message? All of that I found and use in Linux, and much more.

But @kovacslt is correct about the command line usage. I know how to do that and I do write down what I do to complete a task. I just never thought of somehow using those commands in a script.

Sheila

1 Like

I use vim for that. It can keep encrypted files.

Good on you, that is the true spirit of Linux

2 Likes

That’s going to be long, but as you whish… :smiley:

This is the script I currently have:

#!/bin/bash

cat <<_EOF >/etc/apt/sources.list

# See https://wiki.debian.org/SourcesList for more information.
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian bookworm main non-free-firmware


deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian bookworm-updates main non-free-firmware

deb http://security.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src http://security.debian.org/debian-security/ bookworm-security main non-free-firmware

# Backports allow you to install newer versions of software made available for this release
deb http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware
#deb-src http://deb.debian.org/debian bookworm-backports main non-free-firmware

_EOF

apt update
apt install wget -y

dpkg --add-architecture i386

apt update

################## setup repos

##Seafile repo
wget https://linux-clients.seafile.com/seafile.asc -O /usr/share/keyrings/seafile-keyring.asc
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/seafile-keyring.asc] https://linux-clients.seafile.com/seafile-deb/$(lsb_release -cs)/ stable main" > /etc/apt/sources.list.d/seafile.list 
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/seafile-keyring.asc] https://linux-clients.seafile.com/seadrive-deb/$(lsb_release -cs)/ stable main" >> /etc/apt/sources.list.d/seafile.list 

##home repo
echo "deb [signed-by=/usr/share/keyrings/ungvar44.gpg ] https://ungvar44.dynu.net/repo/bookworm ./ " > /etc/apt/sources.list.d/ungvar44.list
curl -sS https://ungvar44.dynu.net/repo/bookworm/public.gpg |  gpg --dearmor | tee /usr/share/keyrings/ungvar44.gpg

##Spotify repo
curl -sS https://download.spotify.com/debian/pubkey_C85668DF69375001.gpg | gpg --dearmor |  tee /usr/share/keyrings/spotify.gpg
echo "deb [signed-by=/usr/share/keyrings/spotify.gpg] http://repository.spotify.com stable non-free" > /etc/apt/sources.list.d/spotify.list

##Softmaker repo
curl -fsSL https://shop.softmaker.com/repo/linux-repo-public.key | gpg --dearmor | tee /usr/share/keyrings/softmaker.gpg
echo "deb [signed-by=/usr/share/keyrings/softmaker.gpg] https://shop.softmaker.com/repo/apt stable non-free" > /etc/apt/sources.list.d/softmaker.list

##Google repo
curl -fSsL https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor | tee /usr/share/keyrings/google-chrome.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list

##teamviewer repo
curl -fSsL https://download.teamviewer.com/download/linux/signature/TeamViewer2017.asc | gpg --dearmor |  tee /usr/share/keyrings/teamview.gpg 
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/teamview.gpg] http://linux.teamviewer.com/deb stable main" > /etc/apt/sources.list.d/teamviewer.list


##Vrtualbox repo
curl -fsSL https://www.virtualbox.org/download/oracle_vbox_2016.asc| gpg --dearmor -o /etc/apt/trusted.gpg.d/vbox.gpg
curl -fsSL https://www.virtualbox.org/download/oracle_vbox.asc| gpg --dearmor -o /etc/apt/trusted.gpg.d/oracle_vbox.gpg
echo "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" > /etc/apt/sources.list.d/virtualbox.list

apt update

apt upgrade -y 

##install basic components

apt purge gnome-text-editor -y

apt install -y mate-calc ddcutil gedit sstp-client openssh-server mc sshpass gparted gnome-disk-utility gnome-system-tools gnome-tweaks lshw cups cups-client foomatic-db system-config-printer intel-microcode firmware-linux pavucontrol font-manager qt5ct qt5-style-plugins gvfs-fuse ttf-mscorefonts-installer va-driver-all vdpau-driver-all samba smbclient python3-smbc rsync smartmontools sysstat htop earlyoom dcfldd sane xsane 

##for quicksync to work non-free driver is required
apt install intel-media-va-driver-non-free  -y


#multimedia apps
apt install -y musescore3 guvcview mkvtoolnix mkvtoolnix-gui mediainfo-gui fontforge audacious audacity openshot-qt minikonverter obs-studio ffmpeg obs-color-monitor obs-advanced-scene-switcher celluloid mpv
apt install -y -t bookworm-backports obs-ashmanix-blur-filter

#graphics apps
apt install -y simple-scan gimp fontforge inkscape scribus dia gthumb xnview rawtherapee gcolor3

#development and virtualization and 
apt install -y  lazarus 
apt install -y virtualbox-7.0 

#learning and games

apt install -y  r-base rstudio
apt install -y stellarium avogadro
apt install -y supertuxkart-repack

#internet
apt install -y seafile-gui seadrive-gui thunderbird-l10n-hu megasync google-chrome-stable mumble m3dviewer zoom discord chromium chromium-l10n thunderbird evolution caprine teamviewer spotify-client
apt install -y 4kvideodownloaderplus

#office and tools
apt install -y  gimagereader tesseract-ocr tesseract-ocr-hun gucharmap pdfarranger softmaker-freeoffice-2024
apt install -y -t bookworm-backports calibre libreoffice libreoffice-l10n-hu libreoffice-gtk3 --install-recommends
apt install -y doublecmd-gtk 

#my  scripts packaged
apt install -y systemback autoupdater

#collection for look&feel
apt install -y mythemes myfonts numix-icon-theme 
apt install -y my-gnome-ext gnome-shell-extension-appindicator gnome-shell-extension-dashtodock gnome-shell-extension-dash-to-panel 

#system-wide changes
rm /etc/apparmor.d/usr.bin.evince

#mpv to use quicksync:
mkdir -p /etc/mpv
cat << _EOFMPV > /etc/mpv/mpv.conf 
hwdec
hwdec-codecs=all
vd=h264_qsv,hevc_qsv,mpeg2_qsv,mjpeg_qsv,vp8_qsv,vp9_qsv,vc1_qsv,av1_qsv
_EOFMPV


#instruct dconf to store data in text:
echo "service-db:keyfile/user" > /etc/dconf/profile/user

#overwirite freshly installed samba a sane conf's with previously stored working configs: 
cp smb.conf /etc/samba/
cp net.conf /etc/sane.d/

##system configuration changes
echo fs.inotify.max_user_watches=524288 | tee -a /etc/sysctl.conf
echo vm.min_free_kbytes=8192| tee -a /etc/sysctl.conf

## USB attached disks will be writeable without root privileges
echo 'KERNEL=="sd*", SUBSYSTEMS=="usb", MODE="0666"' | tee /etc/udev/rules.d/99-usb-storage.rules

#lpadmin -p printername -E -v ipp://192.168.1.111/ipp/print -m everywhere

##nvidia drivers with wayland support

#apt install nvidia-driver libcuda1 libnvidia-encode1 nvidia-opencl-icd
#echo 'options nvidia NVreg_PreserveVideoMemoryAllocations=1' > /etc/modprobe.d/nvidia-power-management.conf
#TMPL_PATH=nvidia-wayland
#install "${TMPL_PATH}/nvidia-sleep.sh" /usr/bin
#install "${TMPL_PATH}/system-sleep/nvidia" /lib/systemd/system-sleep
#install --mode 644 "${TMPL_PATH}/system/nvidia-resume.service" /etc/systemd/system
#install --mode 644 "${TMPL_PATH}/system/nvidia-hibernate.service" /etc/systemd/system
#install --mode 644 "${TMPL_PATH}/system/nvidia-suspend.service" /etc/systemd/system

#systemctl enable nvidia-resume.service
#systemctl enable nvidia-hibernate.service
#systemctl enable nvidia-suspend.serviceapt

#####This installation of nvidia drivers is not needed anymore


###libcuda fix for Dvinci resolve
#ln -s /usr/lib/x86_64-linux-gnu/libcuda.so /usr/lib64/libcuda.so

###WINE
apt install -y winetricks wine wine32 wine64

###clean up stuff I don't need

apt purge -y gnome-calculator hamster* goldendict transmission* hdate* hitori gnome-music quadrapassel swell-foop tali aisleriot blender gnome-mines gnome-2048 gnome-klotski gnome-mahjongg gnome-nibbles gnome-robots gnome-sound-recorder gnome-sudoku gnome-taquin gnome-tetravex vlc rhythmbox* brasero sound-juicer gnome-calculator totem*  usbguard pidgin* hexchat* apache* flatpak* exim* gnome-software unattended-upgrades anthy* mozc* fcitx*

apt autoremove --purge -y

And another script, which removes unwanted locales and fonts (mostly arabic, chinese, vietnamese and such):
Note the localizations to keep in the config part:

#!/bin/bash
 
# purge-alien-loc.sh - V. 1.1.0
# Remove oriental/medio-oriental/african/etc. fonts
#   + Libreoffice localization not of use in IT/GB/USA
#
# Author: Rik - www.riksoft.it
# Licence: LGPL
#
# Changelog
# 1.1.0 Added fonts-teluguvijayam
 
#--------- CONFIG ------------------------------
 
# localisations to keep (pipe separated)
KEEP="en-gb|en-us|hu"
 
#-----------------------------------------------
 
 
 
 
sudo apt update
 
# Remove all oriental/arabic/asian fonts in Debian/Ubuntu/Mint
 
fonts="fonts-kacst fonts-kacst-one fonts-khmeros-core fonts-lklug-sinhala fonts-guru fonts-nanum fonts-noto-cjk"
fonts="$fonts fonts-takao-pgothic fonts-tibetan-machine fonts-guru-extra fonts-lao fonts-sil-padauk fonts-sil-abyssinica"
fonts="$fonts fonts-tlwg-* fonts-lohit-* fonts-beng fonts-beng-extra fonts-gargi fonts-gubbi fonts-gujr fonts-gujr-extra"
fonts="$fonts fonts-kalapi fonts-lohit-gujr fonts-samyak-* fonts-noto-unhinted fonts-noto-hinted fonts-navilu fonts-nakula"
fonts="$fonts fonts-orya-extra fonts-pagul fonts-sahadeva fonts-sarai fonts-smc fonts-telu-extra fonts-wqy-microhei"
fonts="$fonts fonts-hosny-amiri fonts-smc-anjalioldlipi fonts-sil-andika fonts-arphic-ukai fonts-arphic-uming"
fonts="$fonts fonts-sipa-arundina fonts-bpg-georgian fonts-khmeros fonts-smc-chilanka fonts-smc-* fonts-noto-ui-extra"
fonts="$fonts fonts-noto-ui-core fonts-noto-extra fonts-noto-core culmus fonts-ipafont fonts-ipafont-*"
fonts="$fonts fonts-farsiweb fonts-hosny-thabit fonts-ukij-uyghur fonts-yrsa-rasa fonts-sil-scheherazade"
fonts="$fonts fonts-unikurdweb fonts-dzongkha fonts-deva-extra fonts-teluguvijayam"
 
IFS=' ' read -ra aFonts <<< "$fonts"
 
for font in "${aFonts[@]}"; do
  sudo apt purge -y $font
done
 
 
 
#remove orphans/rubbish
sudo rm -r /usr/share/fonts/opentype/fonts-hosny-amiri \
/usr/share/fonts/truetype/andika \
/usr/share/fonts/truetype/arphic \
/usr/share/fonts/truetype/arundina \
/usr/share/fonts/truetype/fonts-bpg-georgian \
/usr/share/fonts/truetype/khmeros \
/usr/share/fonts/opentype/malayalam \
/usr/share/fonts/truetype/malayalam \
/usr/share/fonts/truetype/malayalam \
/usr/share/fonts/truetype/culmus \
/usr/share/fonts/opentype/ipafont-gothic \
/usr/share/fonts/opentype/ipafont-mincho \
/usr/share/fonts/truetype/farsiweb \
/usr/share/fonts/opentype/fonts-hosny-thabit \
/usr/share/fonts/truetype/fonts-ukij-uyghur \
/usr/share/fonts/truetype/fonts-yrsa-rasa \
/usr/share/fonts/truetype/scheherazade \
/usr/share/fonts/truetype/unikurdweb \
/usr/share/fonts/truetype/dzongkha \
/usr/share/fonts/truetype/fonts-deva-extra \
/usr/share/doc/fonts-teluguvijayam \
/usr/share/fonts/truetype/teluguvijayam
 
 
echo "==== Fixing font cache"
sudo fc-cache -f -v && sudo dpkg-reconfigure fontconfig
 
echo "==== Packages left (each containing multiple fonts)"
sudo dpkg -l fonts\*|grep ^ii|awk '{print $2}'
 
 
 
 
echo
echo "We are going to remove Libreoffice Help in any language except $KEEP"
 
#unfortunately this one-liner cannot be used :-(
#because bash doesn't support lookahead
#sudo apt purge '^libreoffice-help-(?!it|en)[a-z]{2}(-[a-z]{2})?$'
#... so... I'll go this way
#sudo apt purge '^libreoffice-help-[a-z]{2,3}(-[a-z]{2})?$'
#sudo apt install libreoffice-help-en-gb libreoffice-help-en-us libreoffice-help-it
#or more cleaner/secure as follows...
 
list=$(sudo dpkg --get-selections | cut -f1 | grep -E '^libreoffice-help-[a-z]{2,3}(-[a-z]{2})?$')
for pkg in $list; do
	if [[ "$pkg" =~ ^(libreoffice-help-($KEEP))$ ]]; then
		echo "Skipping $pkg"
	else
		sudo apt purge -y "$pkg"
	fi
done
 
 
 
 
echo
echo "We are going to remove Libreoffice locales except $KEEP"
 
#sudo apt remove '^libreoffice-l10n-[a-z]{2,3}(-[a-z]{2})?$'
#sudo apt install libreoffice-l10n-en-gb libreoffice-l10n-it
#Safer as follows...
 
list=$(sudo dpkg --get-selections | cut -f1 | grep -E '^libreoffice-l10n-[a-z]{2,3}(-[a-z]{2})?$')
for pkg in $list; do
	if [[ "$pkg" =~ ^(libreoffice-l10n-($KEEP))$ ]]; then
		echo "Skipping $pkg"
	else
		sudo apt purge -y "$pkg"
	fi
done
 
 
 
 
 
echo
echo "Firefox is bound to Libreoffice locales so apt will"
echo "cope installing the missing locales for Firefox."
echo "We are going to remove them as well, except for $KEEP."
 
#sudo apt remove -y  '^firefox-esr-l10n-[a-z]{2,3}(-[a-z]{2})?$'
#sudo apt install firefox-esr-l10n-en-gb firefox-esr-l10n-it
#Safer as follows...
 
list=$(sudo dpkg --get-selections | cut -f1 | grep -E '^firefox-esr-l10n-[a-z]{2,3}(-[a-z]{2})?$')
for pkg in $list; do
	if [[ "$pkg" =~ ^(firefox-esr-l10n-($KEEP))$ ]]; then
		echo "Skipping $pkg"
	else
		sudo apt purge -y "$pkg"
	fi
done
  
# This could be implemented as well, leaving only the interested languages...
#task-*-desktop
  
sudo apt autoremove -y

This is not something you can use directly, it’s jus to get the idea.
The first script makes a pure and clean Debian (with GNOME) install look&feel the way I like (and need).
I tried to translate some comments in it to english, so you may understand what it is about.
The first part is about to set up the repositories.
Then there are the numerous apt installs, those fetch and install packages I want to install. This is basically installing the apps.
Then you see some configurations, all of them system-wide.
(User level configurations are in the users home dir, that’s a different story.)
The default Debian install with GNOME comes with a number of games and some bloat’s I don’t want to have installed, those are purged.

I commented out the way I installed nvidia driver, because since a while I have an AMD card in my desktop, how I install its drivers, is in another topic, how I broke the law.

The clean-foregin script removes some fonts and localizations present in Debian by default. I don’t know MX would have those.

I have a systemback snapshot of my system, so if I break it with an unsuccessful experiment, I can easily restore.
I like systemback, because it was the first such tool I found, it’s made in Hungary :slight_smile: , it’s just a shell-script with very few dependencies, and I can use it on all my computers, not just laptop/desktop, but also on my Exynos based Odroid-HC4 server and on my Raspberry of course, as well as on my VPS somewhere physically far away from me…

So I need this install script in very rare cases, for example my son got a new laptop this Christmas, and make it usable, I just installed a clean pure Debian, ran those scripts, cloned his home dir from his previous computer, and done…

The script I show here is Debian 12 with GNOME, I have similar collection for Cinnamon and KDE (those variants of Debian come with different defaults).

MX Linux may need different settings, surely different repos, but the basic idea is the same:
-collect the repos needed, and setup them via script
-install the packages needed
-remove packages not needed
-modify configurations according to actual needs
May sound complicated, but not a rocket science :wink:

5 Likes

Is that the best link?

1 Like

It’s not the same. That was a GUI program before, which was abandoned by the author, but some forked it keeping the same name.
I’m referring to it’s ancestor successor, which is just a script:

Edit:
Sorry, I used the wrong word. I really meant “successor”, not “ancestor”.
First there was the GUI program, maybe there was a cli version of it.
It was written in C.
The shell script came later, it is the newer.
The original GUI program still seduces some people, because it promises to create a live system based on an installed one. But more and more problems arise with it, especially on modern UEFI systems.

5 Likes

Wow! I’m eternally glad to be retired and have no older family members to take care of. I dropped Proton Bridge when they introduced Proton Desktop. Their Calendar is my standard, and Proton Pass has replaced Bitwarden.

If I can help you, I will.

4 Likes

Wow I am impressed, may not be rocket science for you but for us (me) lower mortals… yes it is

3 Likes

It’s just quantity, not quality, just collected by another lower mortal. :smiley:
You can do it on your own too.
If you get the recipe, how to install something into Linux Mint using commands in terminal: the difference is only to put in a file before actual execution, rather than just paste into terminal, and execute instantly.
That’s it.
The most advanced thing in my script is the “heredoc” or whatever it is called.
That’s the

cat <<_UPTO_HERE > into-a-file.txt
blabla
blablabla
blahhh
_UPTO_HERE

And the blablabla’s will be written to the into-a-file.txt.
I use this sometimes to store some config or other text in the script itself.

4 Likes

@kovacslt :

Hi László, :wave:

I always wanted to know the deeper meaning of it.
May I take this opportunity to get to know it better?

These are the facts I already know:

  • <EOF> would be equal to CTRL+D
  • In this example:
a=0
cat <<EOF
$a
EOF

EOF (End-Of-File) denotes the beginning and the end of the routine to be worked on.
In this case it´s only one step.

What I don´t know

  • what is the EOF expression called?
  • Apparently it doesn´t have to be EOF but can be any other word, as you used _UPTO_HERE as an example. Is that correct?

Thanks a lot in advance. :heart:

Many greetings from Rosika :slightly_smiling_face:

P.S.:

bealdung defines heredoc thus:

In Linux, here document (also commonly referred to as heredoc) refers to a special block of code that contains multi-line strings that will be redirected to a command.

On the other hand, here string is a simpler version of heredoc, offering somewhat similar functionality, albeit not as powerful as the latter.

P.S.2:

Seems I found out what EOF is called.
According to bealdung (see link above) it´s a delimiter token.

Plus:

The delimiter token can be any value as long as it is unique enough that it won’t appear within the content.

I guess this would answer my questions.

Sorry for the bother.

3 Likes

Hi Rosika,
Yes it can be any word.
The acronym EOF stands for ‘end of file’ and was formerly used to mark the end of a card deck or a paper tape, so it is sort of appropriate. I use FINIS

The '<<` symbol is what tells the shell that a ‘hereis’ document is starting… at least in sh and bash.

We used to use it a lot to make a program read its instructions from the following lines.

Regards
Neville

4 Likes

Hi Neville, :wave:

thanks so much for your reply.

Seems I understood it correctly then. :blush:

Right. But no special characters for telling that the hereis document ended.
Just the chosen delimiter token, it seems. Like EOF or FINIS or whatever…

Thanks again and many greetings from Rosika :slightly_smiling_face:

4 Likes

You found a better answer than I could provide :slight_smile:

I love that site! :star_struck:

4 Likes

Hi László, :wave:

Your answer was perfect. No need to worry.
Thanks a lot for your help. :heart:

Yes, I love the baeldung site too, although it´s pretty new to me.

Many greetings from Rosika :slightly_smiling_face:

4 Likes

Now it seems, I have to deploy a Seafile server for a friend, but without DDNS, and it should work only in his LAN. No external availability is required.
Of course, occasionally I may need to ssh into it to maintain, or solve some problem, or whatever… but it’s going to be behind a NAT, without portforwardings. So the job:
make it accessible via SSH.
I wouldn’t love to connect from my Linux machine via Teamviewer to my friends computer (Windows of course) from where I could Putty the server actually…

Instead, I plan to setup a reveres SSH tunnel from that server to my VPS, from where I can easily SSH into the currently deployed server.

Now this seems to be doable, I still work on it.
I mention this only because I was currently reading Baeldung again:
https://www.baeldung.com/linux/ssh-tunneling-and-proxying

Great source of informations! :grin:

4 Likes

Hi László, :wave:

thanks for the feedback.

Great that you´ll be able to work it out. That´s quite some topic you´re currently working on. :+1:

Seems I should consult baeldung more often. :blush:

Cheers from Rosika :slightly_smiling_face:

3 Likes

There are not many sites like Baeldung that concentrate on CLI.

4 Likes