Saturday, June 22, 2019

Fedora Customizations

Finally crossed my mind i could use a script for customizing Fedora 27 XFCE. After finishing manual partitioning with preserving home directory with all data and settings including for Chrome (i choose manual partitioning at installation and i have a scheme like 256 MB for /boot, 6 GB for / and /var, 2 for /temp and swap and 32 for /home which i don't reformat, have more NTFS partitions with old pictures and music, up to 500 GB).

First thing i do i go to /etc/lighdm and edit the file lightdm.conf in order to enable automatic login to user george2 by uncommenting two lines and specifying user name.

autologin-user=george2
autologin-user-timeout=0

And since i keep the home directory, i keep there the script too.

Here it is.

#removing unwanted apps, list can be completed
dnf remove claws-mail pidgin libpurple spice-vdagent sendmail pragha remmina tigervnc-server-minimal transmission liferea midori samba* openssh*
#could not prove to myself firewalld is really working so i remove it
systemctl stop firewalld

systemctl disable firewalld
dnf remove firewalld
#copy the two customs iptables files with rules for iptables

\cp /home/george2/"Before and After"/iptables /etc/sysconfig
\cp /home/george2/"Before and After"/ip6tables /etc/sysconfig
#installing iptables-services from Fedora repo (installed by default)
dnf install iptables-services

systemctl enable iptables
systemctl start iptables
systemctl enable ip6tables
systemctl start ip6tables
#updating (should be more than 600 packages)
dnf update
#installing repos for video drivers, others

rpm -ivhh https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-27.noarch.rpm
rpm -ivhh https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-27.noarch.rpm
dnf update
#installing video drivers for my old nvidia GeForce 6 series from rpmfusion repos

dnf install kmod-nvidia-304
#copying modified fstab files to etc directory
\cp /home/george2/"Before and After"/fstab /etc
#downloading and copying hosts file to /etc directory. This command line is similar to installing an ad blocker in Windows and speeds up your browser 2-3 times

wget http://winhelp2002.mvps.org/hosts.txt --output-document=/etc/hosts
#creating a directory in tmp for myramdisk

mkdir /tmp/myramdisk
#installing Stellarium, just to prove how easy is to install an app in Fedora, provided you already have the repo installed, and that is another line, like for rpmfusion above.
dnf install stellarium
#installing google chrome

dnf install fedora-workstation-repositories
dnf config-manager --set-enabled google-chrome

dnf install googe-chrome-stable

Custom iptables files, modified fstab and hosts files in the same Before and After directory. The way i built iptables and ip6tables. Started with blocking everything then adding rules for only what i need.

Here is a minimalist example (For obvious reasons, i cannot publicize my whole iptables files)

# Generated by iptables-save v1.4.21 on Sat Dec 27 23:21:37 2014
*filter
:INPUT DROP
:FORWARD DROP
:OUTPUT DROP
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p udp -m udp --sport 53 -j ACCEPT
-A INPUT -p udp -m udp --sport 5353 -j ACCEPT
-A INPUT -p udp -m udp --sport 123 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 80 --dport 30000:65535 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 443 --dport 30000:65535 -j ACCEPT

Here is the modified fstab

#
# /etc/fstab
# Created by anaconda on Fri Jun 21 20:50:06 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=f15194a9-ef11-48c4-9cd4-bbd99de246d8 /                       ext4    defaults        1 1
UUID=25219d3d-0056-4a86-bf6a-070dd502a992 /boot                   ext4    defaults        1 2
UUID=83232fe0-b51f-4700-bc1a-fc3ea433b87f /home                   ext4    defaults        1 2
UUID=4cf0a374-6e0e-4001-b78d-aec1f4eca944 /tmp                    ext4    defaults        1 2
UUID=02d1d512-ef45-4d41-9662-250b67202f80 /var                    ext4    defaults        1 2
UUID=91a2065a-7131-4b8c-a7b3-c26af37c179e swap                    swap    defaults        0 0

tmpfs /tmp/myramdisk tmpfs defaults,noatime,mode=1777,nosuid,size=640M 0 0

With an added last line for creating RAM temp directory for Chrome

Hosts file is for blocking ads.

Modify Chrome command line to

/usr/bin/google-chrome-stable --disk-cache-dir=/tmp/myramdisk %U
For that you have to right click on Chrome launch button, properties, than again right click on Google Chrome and edit the command line.

Then i go to chrome://settings/ and disable hardware acceleration (gives me wavy scrolling which made me lose half more day today because i forgot how i've done it last time).

But will i ever reinstall Fedora again on this computer? Hopefully not, cause they got to version 30 while i cannot install more than 27 because they don't support anymore video drivers for my card.

But this is what i said last time.

Yeah i know. fstab, dracut, anaconda, python, ncurses, bash, name of files and packages in Fedora.

https://www.google.com/search?q=torvalds+linus+swearing

06-26. Guess what. Got drunk yesterday (my birthday) more than usually and crashed it again. Tried the procedure above and didn't quite work though i got quite sober by 4 AM. Today after many tries which involved about ... 10 reinstalls, i found the reason. By moving fstab file in the working directory then back in /etc something happens though i still don't know what, so i just figured how to add the line for the ramdisk in fstab without moving the file, with command echo, and got to two (proved working) bash scripts. One is run with command yes|./ which involves automatic yes answer to all questions. But i had to brake it up because for some reason would give an error at downloading gpg keys. So the rest of it is run and answered manually.

before.sh
echo "tmpfs /tmp/myramdisk tmpfs defaults,noatime,mode=1777,nosuid,size=640M 0 0" >> /etc/fstab
\cp /home/george2/"Before and After"/lightdm.conf /etc/lightdm
\cp /home/george2/"Before and After"/iptables /etc/sysconfig
\cp /home/george2/"Before and After"/ip6tables /etc/sysconfig
dnf remove claws-mail pidgin libpurple spice-vdagent pragha tigervnc-server-minimal transmission samba* openssh*
systemctl stop firewalld
systemctl disable firewalld
dnf remove firewalld
sudo ip link set wlp1s9 up
nmcli dev wifi connect FiOS-Frontier password *************
dnf install iptables-services
systemctl enable iptables
systemctl start iptables
systemctl enable ip6tables
systemctl start ip6tables
dnf update
wget http://winhelp2002.mvps.org/hosts.txt --output-document=/etc/hosts


after.sh
rpm -ivhh https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-27.noarch.rpm
rpm -ivhh https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-27.noarch.rpm
dnf update
dnf install kmod-nvidia-304*
dnf install fedora-workstation-repositories
dnf config-manager --set-enabled google-chrome
dnf install google-chrome-stable

So it's installing with live installation then login as root and run these two. Provided you have the necessary files in the running directory, in my case /home/george2/"Before and After"/. I would assume the scripts can be tailored for any needs. Summarize 7 years of installing and customizing Fedora experiences. Lines in red are usable on any existing Linux system as commands in root prompt with immediate, visible results in improving speed (needs rebooting or restarting Chrome).

Here in this screenshot you can see with the file manager myramdisk created using one line in a script which can be also done via terminal command.

As for removing ads with hosts file in Windows using one command line. You can go to Start and type cmd.exe and choose to run as an administrative account (will be prompted for the password) or follow the instructions here. Then go to the terminal window (the black one) and paste the command below as one line next to a prompt and hit enter. Your browser's speed is going to improve dramatically since it won't open any of the sites listed here http://winhelp2002.mvps.org/hosts.txt and you won't see the adds from those sites embedded in normal sites anymore but also will not be able to open the sites marked in google searches as adds anymore, pretty much similar with using an add blocker but without the overhead of installing an app. It is reversible, you can go and delete everything in the hosts file in c:\windows\system32\drivers\etc\hosts

Here is the command

bitsadmin /transfer myDownloadJob /download /priority normal http://winhelp2002.mvps.org/hosts.txt c:\windows\system32\drivers\etc\hosts

(I built this line by the sample from here but can't make it won't work on Angela's computer as some vibrations in my ears from a carpet cleaner do not allow me to think right now or all i can think is... Windows! Will try later).

No comments:

Post a Comment

Friendly comments welcome

Note: Only a member of this blog may post a comment.