Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save queeup/65081f6b0d7c51d47392fed44d0c79d7 to your computer and use it in GitHub Desktop.

Select an option

Save queeup/65081f6b0d7c51d47392fed44d0c79d7 to your computer and use it in GitHub Desktop.
Fedora Cheatsheet

Fedora CheatSheet

Packages

RPM Fusion provides software that the Fedora Project or Red Hat doesn't want to ship. That software is provided as precompiled RPMs for all current Fedora versions and current Red Hat Enterprise Linux or clones versions.

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

DNF

DNF Config

CONFIG_FILE="/etc/dnf/dnf.conf" && PARAMS=(
  "defaultyes=True" # Select Y by default.
) && for PARAM in ${PARAMS[@]}; do
  grep "^$PARAM" $CONFIG_FILE || echo $PARAM | sudo tee -a $CONFIG_FILE
done

DNF Packages

APPS=(
  https://downloads.1password.com/linux/rpm/stable/x86_64/1password-latest.rpm
  https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
  https://zoom.us/client/latest/zoom_x86_64.rpm
  https://download.teamviewer.com/download/linux/teamviewer.x86_64.rpm
  
  @development-tools # Build-essentials analog.

  exfat-utils # Utilities to create, check, label and dump exFAT file system 
  htop # Terminal system monitor
  java-latest-openjdk # Jave development kit
  jq # Takes JSON input and retrieves data by query
  mc # Two panel terminal file manager
  neofetch # Shows Linux System Information with Distribution Logo
  net-tools # Base network tools
  stacer # Cool CleanMyMac alternative
  timeshift # Backup utility

  arj         # arj archiver
  lha         # lzh unarchiver
  unrar       # rar unarchiver

  libreoffice
  libreoffice-langpack-{uk,ru}
  libreoffice-help-{uk,ru}

  dia
  evolution
  evolution-ews
  flameshot
  inkscape
  telegram-desktop
  transmission
  vlc
) && sudo dnf install -y ${APPS[*]} 

Flatpak

Flatpak is a tool for managing applications and the runtimes they use. In the Flatpak model, applications can be built and distributed independently from the host system they are used on, and they are isolated from the host system ('sandboxed') to some degree, at runtime.

Add flathub remote:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Install apps:

curl https://raw.githubusercontent.com/alexander-danilenko/ubuntu-environment/ubuntu-22.04/config.yml | yq -rc '.apps.flatpak[]' | xargs flatpak install -y flathub

⚠️ NOTE: yq python package is required

Fix cursors:

flatpak --user override --filesystem=/home/$USER/.icons/:ro 
flatpak --user override --filesystem=/home/$USER/.local/share/:ro

Drivers

nVidia

⚠️ NOTE: Install RPM Fusion first.

sudo dnf install kmod-nvidia

Terminal

ZSH

ZSH is a UNIX command interpreter (shell) usable as an interactive login shell and as a shell script command processor.

Install zsh:

sudo dnf install -y zsh

Set it as default for current user:

sudo dnf install -y util-linux-user && \
chsh -s $(which zsh) && \
sudo !!

ZSH Antigen

Antigen is a small set of functions that help you easily manage your shell (zsh) plugins, called bundles. The concept is pretty much the same as bundles in a typical vim+pathogen setup. Antigen is to zsh, what Vundle is to vim.

Install and apply config:

mkdir -p $HOME/.antigen/ && \
curl -L# -o $HOME/.antigen/antigen.zsh git.io/antigen --create-dirs  && \
curl -L# -o $HOME/.profile https://raw.githubusercontent.com/alexander-danilenko/dotfiles/main/.profile && \
curl -L# -o $HOME/.zshrc https://raw.githubusercontent.com/alexander-danilenko/dotfiles/main/.zshrc

Extend inotify

https://youtrack.jetbrains.com/articles/IDEA-A-2/Inotify-Watches-Limit

Inotify requires a "watch handle" to be set for each directory in the project. Unfortunately, the default limit of watch handles may not be enough for reasonably sized projects, and reaching the limit will force IntelliJ platform to fall back to recursive scans of directory trees.

To prevent this situation it is recommended to increase the watches limit (to, say, 512K)

grep '^fs.inotify.max_user_watches=524288' /etc/sysctl.conf || \
echo  'fs.inotify.max_user_watches=524288' | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Development

Python

Python is an interpreted, interactive, object-oriented programming language that combines remarkable power with very clear syntax.

Install Python and its package manager

sudo dnf install python3 python3-pip

Install yq for parsing yml files format.

pip install yq

Install packages:

curl https://raw.githubusercontent.com/alexander-danilenko/ubuntu-environment/ubuntu-20.04/config.yml | yq -rc '.python3.pip3_global_packages[]' | xargs pip install

Node.JS

NVM allows you to quickly install and use different versions of node via the command line.

Install NVM:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | bash

Install LTS and set as default:

nvm install --lts && nvm alias default "lts/*"

Install global packages:

curl https://raw.githubusercontent.com/alexander-danilenko/ubuntu-environment/ubuntu-20.04/config.yml | yq '.node.npm_global_packages[]' -cr | xargs npm install --global

⚠️ NOTE: yq python package is required

PHP

sudo dnf install -y php-{common,cli,curl,gd,json,mbstring,mysqli,opcache,pdo,xml,zip}

Composer

mkdir -p $HOME/.composer && \
sudo curl -#fsSL https://getcomposer.org/composer-stable.phar -o /usr/local/bin/composer && \
sudo chmod 755 /usr/local/bin/composer && \
composer --version && \
composer global require drupal/coder squizlabs/php_codesniffer friendsofphp/php-cs-fixer && \
cp -rf \
  ~/.composer/vendor/drupal/coder/coder_sniffer/Drupal* \
  ~/.composer/vendor/squizlabs/php_codesniffer/src/Standards

JetBrains Toolbox

curl -Ls https://raw.githubusercontent.com/nagygergo/jetbrains-toolbox-install/master/jetbrains-toolbox.sh | sudo bash

Visual Studio Code

Add rpm repo and install code package

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo' && \
sudo dnf check-update && sudo dnf install -y code && \
curl -L# -o $HOME/.config/Code/User/settings.json --create-dirs https://raw.githubusercontent.com/alexander-danilenko/dotfiles/main/.config/Code/User/settings.json

Install extensions

curl https://raw.githubusercontent.com/alexander-danilenko/ubuntu-environment/ubuntu-20.04/config.yml | yq .apps.visual_studio_code.extensions[] -cr | while read extension; do
    code --install-extension $extension --force
done

⚠️ NOTE: yq python package is required

Sublime Apps

sudo rpm -v --import https://download.sublimetext.com/sublimehq-rpm-pub.gpg && \
sudo dnf config-manager --add-repo https://download.sublimetext.com/rpm/stable/x86_64/sublime-text.repo && \
sudo dnf install -y sublime-text sublime-merge && \
curl -L# -o $HOME/.config/sublime-text-3/Packages/User/Preferences.sublime-settings --create-dirs https://raw.githubusercontent.com/alexander-danilenko/dotfiles/main/.config/sublime-text-3/Packages/User/Preferences.sublime-settings

Wireguard VPN

Server

Quick setup script: https://github.com/Nyr/wireguard-install

wget https://git.io/wireguard -O wireguard-install.sh && bash wireguard-install.sh

Client (Fedora)

  • Install prerequisites:
    sudo dnf install wireguard-tools
  • Copy config to /etc/wireguard/wg0.conf file
  • ! Make sure port from config is whitelisted in firewall: sudo ufw allow 58320/udp
  • Enable autostart: sudo systemctl enable wg-quick@wg0
  • Disable autostart: sudo systemctl disable wg-quick@wg0
  • Start: sudo systemctl start wg-quick@wg0
  • Stop: sudo systemctl stop wg-quick@wg0
  • Status: sudo systemctl status wg-quick@wg0
#!/usr/bin/env python3

import click
import subprocess

@click.command(help='Manages Wireguard VPN.')
@click.argument('action', type=click.Choice(['start', 'stop', 'enable', 'disable', 'status']))
@click.option('--config', help='Config name.', default='wg0')
def wireguard_manager(action, config):
    if action in ['start', 'stop', 'enable', 'disable', 'status']:
        subprocess.call(f'set -ex && sudo systemctl {action} wg-quick@{config}', shell=True)

if __name__ == '__main__':
    wireguard_manager()

Containerization

Docker

Make sure current release version added in: https://download.docker.com/linux/fedora/

sudo dnf remove -y docker-{client,client-latest,common,latest,latest-logrotate,logrotate,selinux,engine-selinux,engine} && \
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo && \
sudo dnf install -y docker-ce docker-compose && \
sudo usermod -aG docker $USER && \
sudo systemctl enable docker && \
sudo systemctl restart docker && \
newgrp docker

Docksal

bash <(curl -fsSL https://get.docksal.io)

Desktop

GTK Themes / Icons

APPS=(
  papirus-icon-theme
  materia-gtk-theme
  paper-icon-theme
  yaru-theme
  yaru-sound-theme
  yaru-icon-theme
  yaru-gtk3-theme
  yaru-sound-theme
  breeze-cursor-theme
) && sudo dnf install -y ${APPS[*]}

Microsoft Fonts

When it comes to typography, Microsoft True Type fonts have entirely dominated the market. Although we have more than a thousand fonts available, the extensive use of the Windows operating system has altogether led to the increase in popularity of Microsoft True Type fonts.

Some of them like the “Times New Roman (Bold, Italic, Bold Italic)” are recommended in most documents and many writing formats like APA, MLA, Harvard, etc. and regarded as standard fonts. Microsoft True Type fonts are also in most webpages, and you can find this declared in the style sheets.

Install Microsoft Fonts to the system:

sudo rpm -i https://downloads.sourceforge.net/project/mscorefonts2/rpms/msttcore-fonts-installer-2.6-1.noarch.rpm

Google Fonts

List fonts available to install:

curl https://google-webfonts-helper.herokuapp.com/api/fonts | jq '.[].id' -cr | sort

Install needed fonts:

FONTS_DIR="$HOME/.fonts"
FONTS=(
  jetbrains-mono
  open-sans
  roboto
  roboto-mono
  roboto-slab
  ubuntu
  ubuntu-mono
) && \
mkdir -p $FONTS_DIR && \ 
for FONT in ${FONTS[@]}; do
  DOWNLOAD_URL="https://google-webfonts-helper.herokuapp.com/api/fonts/${FONT}?download=zip&formats=ttf"
  FILE_PATH="/tmp/$FONT-ttf.zip"
  curl "$DOWNLOAD_URL" -o "$FILE_PATH"
  unzip -o $FILE_PATH -d $FONTS_DIR
done

Update fonts cache (may take a while): sudo fc-cache -f -v

Gnome

Gnome Tweaks:

sudo dnf install -y gnome-tweaks gnome-extensions-app

Gnome Extensions

Name Description
Battery Percentage (for laptops) Show battery remaining power percentage at the top panel
Blyr Blur Effect to GNOME Shell UI elements
Compiz alike magic lamp effect Magic lamp effect for minimizing windows
Compiz windows effect Compiz wobbly windows effect
Dash to Dock This extension moves the dash out of the overview transforming it in a dock for an easier launching of applications and a faster switching between windows and desktops
Dash to Panel Moves the dash into the gnome main panel so that the application launchers and system tray are combined into a single panel, similar to that found in KDE Plasma and Windows 7+
Emoji Selector Provides a parametrable popup menu displaying most emojis, clicking on an emoji copies it to the clipboard
Hide Activities Button Hides the Activities button from the status bar
Notification Alert Whenever there is an unread notification (e.g. chat messages), blinks the message in the user's menu with a color chosen by the user
Sound Input & Output Device Chooser Shows a list of sound output and input devices (similar to gnome sound settings) in the status menu below the volume slider
Tray Icons: Reloaded Bring back Tray Icons to top panel, with additional features
User Themes Gnome Shell themes support
Wireless HID Shows the battery of the wireless keyboards, mice, and game controllers in percentages and colors

NFS Shares

Create directories first:

sudo mkdir -p /mnt/NAS/Books /mnt/NAS/Homes /mnt/NAS/Install /mnt/NAS/Music /mnt/NAS/Videos

Add to /etc/fstab:

192.168.50.123:/volume1/homes   /mnt/NAS/Homes   nfs defaults 0 0
192.168.50.123:/volume1/Music   /mnt/NAS/Music   nfs defaults 0 0
192.168.50.123:/volume1/Videos  /mnt/NAS/Videos  nfs defaults 0 0
192.168.50.123:/volume1/Books   /mnt/NAS/Books   nfs defaults 0 0
192.168.50.123:/volume1/Install /mnt/NAS/Install nfs defaults 0 0

SWAP

Set swap to x2:

confFile="/usr/lib/systemd/zram-generator.conf" && \
grep '^max-zram-size = none$' $confFile || echo "max-zram-size = none" | sudo tee -a $confFile && \
grep '^zram-fraction' $confFile || echo "zram-fraction = 2" | sudo tee -a $confFile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment