Last active
May 24, 2024 15:02
-
-
Save manelio/1bd07559eae002f604ed6b99a36c5825 to your computer and use it in GitHub Desktop.
Provision Ubuntu 23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export USER_EMAIL="manel@ecomm.pro" | |
| export USER_NAME="Manel R. Doménech" | |
| sudo apt install -y \ | |
| openssh-server \ | |
| curl \ | |
| vim \ | |
| git \ | |
| zsh \ | |
| jq \ | |
| nmap \ | |
| mydumper \ | |
| libxml2-utils \ | |
| ca-certificates \ | |
| curl \ | |
| gnupg \ | |
| lsb-release \ | |
| wireguard \ | |
| yt-dlp \ | |
| vlc | |
| git config --global user.email "$USER_EMAIL" | |
| git config --global user.name "$USER_NAME" | |
| sudo apt remove -y docker docker-engine docker.io containerd runc | |
| # passwordless sudo for user 1000 | |
| echo "$(id -nu 1000) ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/90-user | |
| sudo chmod 600 /etc/sudoers.d/90-user | |
| # disable the annoying system bell | |
| gsettings set org.gnome.desktop.wm.preferences audible-bell false | |
| #gsettings set org.gnome.desktop.wm.preferences visual-bell true | |
| gsettings set org.gnome.desktop.wm.preferences visual-bell false | |
| gsettings set org.gnome.desktop.wm.preferences visual-bell-type frame-flash | |
| # for some reason in gtk file chooser backspace key doesn't work for navigating back. fix it. | |
| mkdir -p ~/.themes/custom/gtk-3.0 | |
| cat <<EOF > ~/.themes/custom/gtk-3.0/gtk-keys.css | |
| @binding-set MyOwnFilechooserBindings | |
| { | |
| bind "BackSpace" { "up-folder" () }; | |
| } | |
| filechooser | |
| { | |
| -gtk-key-bindings: MyOwnFilechooserBindings | |
| } | |
| EOF | |
| gsettings set org.gnome.desktop.interface gtk-key-theme custom | |
| # configure gnome terminal | |
| PROFILE=$(gsettings get org.gnome.Terminal.ProfilesList default) | |
| PROFILE=${PROFILE:1:-1} | |
| BASE="org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$PROFILE/" | |
| gsettings set $BASE font 'DejaVu Sans Mono 18' | |
| gsettings set $BASE use-system-font false | |
| gsettings set $BASE audible-bell false | |
| # completely remove useless dock bar | |
| sudo apt --purge remove -y gnome-shell-extension-ubuntu-dock | |
| # in ubuntu 23.04 this extension (desktop icons) makes new windows losing the focus and breaks my workflow of opening terminal with unity launcher > maximize with super + up | |
| gnome-extensions disable ding@rastersoft.com | |
| # vscode | |
| wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/packages.microsoft.gpg > /dev/null | |
| echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" | sudo tee /etc/apt/sources.list.d/vscode.list | |
| sudo apt update | |
| sudo apt install code | |
| # disable wayland. atm devilspie2 does not support wayland | |
| sudo sed -i '/#WaylandEnable=false/s/^#//g' /etc/gdm3/custom.conf | |
| # fix vscode open file dialog opening in background (shame on vscode for more than a year with this shitty bug unfixed) | |
| sudo apt install -y devilspie2 | |
| mkdir -p ~/.config/devilspie2 | |
| cat << EOT > ~/.config/devilspie2/code.lua | |
| if (get_application_name() == 'code' and get_window_role() == 'GtkFileChooserDialog') then focus_window() center(); end | |
| if (get_application_name() == 'cursor' and get_window_role() == 'GtkFileChooserDialog') then focus_window() center(); end | |
| EOT | |
| mkdir -p ~/.config/autostart | |
| cat << EOT > ~/.config/autostart/devilspie2.desktop | |
| [Desktop Entry] | |
| Type=Application | |
| Exec=/usr/bin/devilspie2 | |
| Hidden=false | |
| NoDisplay=false | |
| X-GNOME-Autostart-enabled=true | |
| Name[en_US]=devilspie2 | |
| Name=devilspie2 | |
| Comment[en_US]=devilspie2 | |
| Comment=devilspie2 | |
| EOT | |
| # google chrome | |
| wget -P/tmp https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | |
| sudo dpkg -i /tmp/google-chrome-stable_current_amd64.deb | |
| # docker | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/packages.docker.gpg > /dev/null | |
| echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/trusted.gpg.d/packages.docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
| sudo apt update | |
| sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin | |
| sudo usermod -a -G docker $(id -nu 1000) | |
| exec newgrp docker | |
| # oh my zsh | |
| sudo -Hu '#1000' sh -c 'git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh' | |
| sudo -Hu '#1000' sh -c 'cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc' | |
| sudo usermod -s /bin/zsh $(id -nu 1000) | |
| git config --global --add oh-my-zsh.hide-status 1 | |
| git config --global --add oh-my-zsh.hide-dirty 1 | |
| # nvm | |
| curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash | |
| cat <<'EOT' | tee -a ~/.zshrc | |
| export NVM_DIR="$HOME/.nvm" | |
| [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
| [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
| EOT | |
| sudo -Hu '#1000' bash -c 'NVM_DIR="$HOME/.nvm"; . $NVM_DIR/nvm.sh; nvm install --lts && nvm use 'lts/*' && nvm alias default 'lts/*'' | |
| # telegram | |
| sudo snap install telegram-desktop | |
| # fira code font | |
| sudo apt install -y fonts-firacode | |
| # microk8s | |
| sudo snap install microk8s --classic | |
| sudo usermod -a -G microk8s $(id -nu 1000) | |
| exec newgrp microk8s | |
| cat <<'EOT' | tee -a ~/.zshrc | |
| alias k='microk8s kubectl' | |
| alias kubectl='microk8s kubectl' | |
| EOT | |
| cat <<'EOT' | tee -a ~/.zshrc | |
| # Yay! High voltage and arrows! | |
| ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" | |
| ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " | |
| ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" | |
| ZSH_THEME_GIT_PROMPT_CLEAN="" | |
| PROMPT='%{$fg[blue]%}%m%{$fg[red]%}|%{$fg[cyan]%}%~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}$(git_prompt_info)%{$fg[cyan]%}⇒%{$reset_color%} ' | |
| EOT | |
| sudo iptables -P FORWARD ACCEPT | |
| echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections | |
| echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections | |
| sudo apt install -y iptables-persistent | |
| sudo curl -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg | |
| echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list | |
| echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing candidate" | sudo tee /etc/apt/sources.list.d/syncthing.list | |
| sudo apt-get update | |
| sudo apt-get install -y syncthing | |
| ln -s /usr/share/applications/syncthing-start.desktop ~/.config/autostart/ | |
| corepack enable | |
| corepack prepare pnpm@latest --activate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment