Skip to content

Instantly share code, notes, and snippets.

@nstapelbroek
Last active January 22, 2021 08:40
Show Gist options
  • Save nstapelbroek/36c5bdbca657a56955f85fb10241a985 to your computer and use it in GitHub Desktop.
Save nstapelbroek/36c5bdbca657a56955f85fb10241a985 to your computer and use it in GitHub Desktop.
Reads, fixes and how-to's after re-installing your OS with Fedora
[user]
email = [email protected]
name = your name
[core]
autocrlf = input
excludesfile = ~/.gitignore_global
editor = vim
[aliases]
pr = "!f() { git fetch -fu ${2:-upstream} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f"
pr-clean = "!git for-each-ref refs/heads/pr/* --format='%(refname)' | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done"
mr = "!f() { git fetch -fu ${2:-upstream} merge-requests/$1/head:mr/$1 && git checkout mr/$1; }; f"
mr-clean = "!git for-each-ref refs/heads/mr/* --format='%(refname)' | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done"
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[rebase]
autoStash = true
[url "[email protected]:"]
insteadOf = https://github.com
[init]
templatedir = ~/.git-templates
.idea
.buildpath
.project
.settings
.vagrant
.DS_Store
nbproject
.thumbs
.vscode
.docker-compose.override.yml
# Path to your oh-my-zsh installation.
export ZSH=/home/nstapelbroek/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="bullet-train"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git docker cp history history-substring-search fedora vagrant zsh-navigation-tools themes)
# User configuration
export PATH="/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/nstapelbroek/.local/bin:/home/nstapelbroek/bin:/home/nstapelbroek/.composer/vendor/bin:/home/nstapelbroek/Projects/golang/bin"
# export MANPATH="/usr/local/man:$MANPATH"
source $ZSH/oh-my-zsh.sh
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
export NVM_DIR="/home/nstapelbroek/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
export GOPATH=$HOME/Projects/golang
export PATH="$PATH:$HOME/.npm-packages/bin"
export ANDROID_HOME=$HOME/Android/Sdk
export PATH="$PATH:$HOME/flutter/bin"%
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/nico/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="bullet-train"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git docker docker-compose encode64 history-substring-search zsh-navigation-tools composer ssh man go golang autojump python pyenv k)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# alias python=python3
# alias pip=pip3
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
export GOPATH=~/Projects/go
export PATH=~/Projects/go/bin:/usr/local/bin:/usr/local/sbin:$PATH
export TERM="xterm-256color"
export WONDERLAND_GITHUB_TOKEN=""
export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.6.0/bin:$PATH"%
fs.inotify.max_user_watches=524288
# Allow the management of NFS exports.
Cmnd_Alias VAGRANT_EXPORTS_CHECK = /usr/bin/tee /etc/exports
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports
Cmnd_Alias VAGRANT_EXPORTS_COPY = /usr/bin/cp /tmp/exports /etc/exports
Cmnd_Alias VAGRANT_EXPORTS_CHOWN = /usr/bin/chown * /tmp/vagrant*
Cmnd_Alias VAGRANT_EXPORTS_MOVE = /usr/bin/mv -f /tmp/vagrant* /etc/exports
Cmnd_Alias VAGRANT_NFSD_CHECK = /etc/init.d/nfs-kernel-server status
Cmnd_Alias VAGRANT_NFSD_START = /usr/sbin/service nfs-server start
Cmnd_Alias VAGRANT_NFSD_APPLY = /usr/sbin/exportfs -ar
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /usr/bin/sed -r -e * d -ibak /tmp/exports
nico ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_EXPORTS_COPY, VAGRANT_EXPORTS_CHECK, VAGRANT_EXPORTS_CHOWN, VAGRANT_EXPORTS_MOVE, VAGRANT_NFSD_CHECK, VAGRANT_NFSD_START, VAGRANT_NFSD_APPLY, VAGRANT_EXPORTS_REMOVE
# Allow passwordless startup of Vagrant with vagrant-hostsupdater.
Cmnd_Alias VAGRANT_HOSTS_ADD = /usr/bin/sh -c echo "*" >> /etc/hosts
Cmnd_Alias VAGRANT_HOSTS_REMOVE = /usr/bin/sed -i -e /*/ d /etc/hosts
nico ALL=(root) NOPASSWD: VAGRANT_HOSTS_ADD, VAGRANT_HOSTS_REMOVE
{
"bip": "192.168.230.1/24"
}

1. Safety first

Make sure you installed Fedora/Debian/Arch/Whatever with full disk encryption. You can configure locking when the screen goes off in Fedora in the privacy menu and the timeout for screen dimming in the power settings.

2. Folkswithhats Fedy

this tool installs packages that are "non-free". For that, you'll have to manually enable these repositories by downloading and installing the packages here: https://rpmfusion.org/Configuration/

After this, you can use Fedy (https://www.folkswithhats.org/) to do a bunch of installations / configurations for you!

3. Install packages you're using daily

sudo dnf install libreoffice-langpack-nl redhat-rpm-config rubygem-json ruby-devel vim htop php php-mcrypt php-json php-mysqli php-xdebug php-intl php-zip poedit meld exfat-utils encfs gimp mariadb postgresql zsh virt-manager gcc libcxx php-pcntl php-xml php-process php-mbstring openssl-devel yamllint httpd-tools php-soap ncdu php-gd smem

sudo dnf groupinstall 'Development Tools'
sudo dnf groupinstall "C Development Tools and Libraries"

4. Install development tools and software

5. Tweaking your tools:

a. NFS using UDP is disabled

On the developer.fedora portal they tell you to use tcp instead. I'd like to yolo my local packets and think that the TCP overhead is potentially killing for performance. Here's a guide how to enable UDP again on your nfs server: https://robertbasic.com/blog/enable-udp-for-nfs-on-fedora/ The solution is to edit /etc/sysconfig/nfs and add --udp to RPCNFSDARGS: RPCNFSDARGS="--udp"

b. Passwordless vagrant up

The sudoers file is attached to this gist. Place it in /etc/sudoers.d.

c. Change your docker default network subnet by chaning the daemon.json in /etc/docker https://docs.docker.com/engine/userguide/networking/default_network/custom-docker0/ my config is atached in this gist.

d. configure your oh-my-zsh plugins my config:

plugins=(aws battery git dnf docker docker-compose encode64 history-substring-search fedora vagrant zsh-navigation-tools composer themes libvirt ssh symfony2 wp-cli sudo redis-cli node laravel5 man go golang python autojump emoji nmap python pyenv screen yarn npm)

e. Vagrant had some additional complaints about native ruby extensions missing.

I tried fixing it but it doesnt seem to work. Here's what i tried: Make sure gcc is installed (step 2) an build the ruby extensions like the example below.

Example warning: Ignoring json-2.0.3 because its extensions are not built. Try: gem pristine json --version 2.0.3 Ignoring nokogiri-1.6.8.1 because its extensions are not built. Try: gem pristine nokogiri --version 1.6.8.1

Example fix:

gem install json -v 2.0.3
gem install nokogiri -v 1.6.8.1
gem pristine json --version 2.0.3
gem pristine nokogiri --version 1.6.8.1

f. NPM should never escalate beyond your home directory

I'd rather install dependencies in my local home folder. here's why: npm/npm#19883 npm config set prefix '~/.npm-packages'

Make sure you update your path in the .zshrc or whatever you're using. A temporary fix is: export PATH="$PATH:$HOME/.npm-packages/bin"

g. Some optional Android stuff

sudo dnf install zlib.i686 ncurses-libs.i686 bzip2-libs.i686 android-tools And download the studio from here: https://developer.android.com/studio/install.html

h. Bump inotify watches

While 524288 is the maximum number of files that can be watched, if you're in an environment that is particularly memory constrained, you may wish to lower the number. Each file watch takes up 540 bytes (32-bit) or ~1kB (64-bit), so assuming that all 524288 watches are consumed that results in an upper bound of around 256MB (32-bit) or 512MB (64-bit).

Place the 20-inotify-watches.conf file in /etc/sysctl.d and make sure the file has his appropriate permissions.

i. ZSHRC

In case I do not r-sync a backup: there is a ZSHRC file attached to this gist.

j. Nvidia

On my current setup (GTX 850M), installing: xorg-x11-drv-nvidia-cuda works and this allows me to use "NVIDIA Hardware accelerated encoding".

sudo dnf install xorg-x11-drv-nvidia-cuda

6. (optional) Restore you home directory

R-sync your personal backup or settings back. Here are some commands I use when backing up & restoring: rsync -a --exclude-from=/run/media/nico/Backup\ Data/rsync-ignorelist --progress /home/nico /run/media/nico/Backup\ Data/lenovo_enrise_fedora_25

@todo: include rsync-ignorelist

You're good to go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment