Skip to content

Instantly share code, notes, and snippets.

@alextakitani
Last active May 13, 2025 15:39
Show Gist options
  • Save alextakitani/5495daa5256de4efd631c951332ed60d to your computer and use it in GitHub Desktop.
Save alextakitani/5495daa5256de4efd631c951332ed60d to your computer and use it in GitHub Desktop.
Kubuntu 25.04 Rails Dev setup
#( KUbuntu 25.04 )
# como usar:
# Clique ali em cima no botão raw
# salve o arquivo no seu disco.
# abra o terminal na pasta onde vc baixou o arquivo.
# de permissão de execução chmod +x post_install.sh
# rode:
# ./post_install_k.sh
# coloque sua senha
# ao final pedirá novamente a senha para mudar o shell pra zsh.
# TODO:
# configurar o KDE pra dar autostart no dropbox, desabilitar o clipboard padrao, configurar o shortcut do copyq
# configurar copyq para autostart
#
# configurar o spetacle para abrir com select retangle
sudo mkdir -p /etc/apt/keyrings
wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | sudo gpg --dearmor -o /etc/apt/keyrings/gierens.gpg
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | sudo tee /etc/apt/sources.list.d/gierens.list
sudo chmod 644 /etc/apt/keyrings/gierens.gpg /etc/apt/sources.list.d/gierens.list
sudo apt update && sudo apt upgrade -y
sudo apt install -y qtchooser zsh ssh curl nfs-common zenity gnome-keyring git cmake g++ build-essential vim libcurl4-openssl-dev htop iotop libmagickwand-dev imagemagick fonts-firacode imwheel tmux autokey-qt rustc libyaml-dev gawk translate-shell zsh-antigen fzf ripgrep bat eza flatpak plasma-discover-backend-flatpak postgresql-client-17 libpq-dev xclip ethtool flatpak
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
sudo apt install kde-config-flatpak
sudo locale-gen pt_BR.UTF-8
# cedilha no teclado en-us internacional
#wget https://raw.githubusercontent.com/silveira/cedilha.sh/master/cedilha.sh
#sudo bash cedilha.sh
#rm cedilha.sh
#test -f $HOME/.XCompose || touch $HOME/.XCompose
#bash -c 'cat << EOF > $HOME/.XCompose
#include "%L"
#<dead_acute> <c> : "ç" ccedilla
#<dead_acute> <Ç> : "Ç" ccedilla
#EOF'
wget -q https://raw.githubusercontent.com/marcopaganini/gnome-cedilla-fix/master/fix-cedilla -O fix-cedilla
chmod 755 fix-cedilla
./fix-cedilla
rm fix-cedilla
# Add the official Docker repo
sudo install -m 0755 -d /etc/apt/keyrings
sudo wget -qO /etc/apt/keyrings/docker.asc https://download.docker.com/linux/ubuntu/gpg
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
# Install Docker engine and standard plugins
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
# Give this user privileged Docker access
sudo usermod -aG docker ${USER}
# Limit log size to avoid running out of disk
echo '{"log-driver":"json-file","log-opts":{"max-size":"10m","max-file":"5"}}' | sudo tee /etc/docker/daemon.json
DOCKER_COMPOSE_VERSION="2.27.0"
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -sSL https://github.com/docker/compose/releases/download/v$DOCKER_COMPOSE_VERSION/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
sudo docker create --restart unless-stopped -p "127.0.0.1:6379:6379" --name=redis redis:7
sudo docker create --restart unless-stopped -p "127.0.0.1:5433:5432" --name=postgres17 -e POSTGRES_HOST_AUTH_METHOD=trust -e LANG=en_US.UTF-8 -e LC_ALL=en_US.UTF-8 postgres:17
cd ~/Downloads
LAZYDOCKER_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazydocker/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
curl -sLo lazydocker.tar.gz "https://github.com/jesseduffield/lazydocker/releases/latest/download/lazydocker_${LAZYDOCKER_VERSION}_Linux_x86_64.tar.gz"
tar -xf lazydocker.tar.gz lazydocker
sudo install lazydocker /usr/local/bin
rm lazydocker.tar.gz lazydocker
cd -
mkdir -p ~/.local/share/fonts
cd ~/Downloads
wget https://github.com/ryanoasis/nerd-fonts/releases/latest/download/CascadiaMono.zip
unzip CascadiaMono.zip -d CascadiaFont
cp CascadiaFont/*.ttf ~/.local/share/fonts
rm -rf CascadiaMono.zip CascadiaFont
wget https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FiraCode.zip
unzip FiraCode.zip -d FiraCode
cp FiraCode/*.ttf ~/.local/share/fonts
rm -rf FiraMono.zip FiraMono
wget https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FiraMono.zip
unzip FiraMono.zip -d FiraMono
cp FiraMono/*.otf ~/.local/share/fonts
rm -rf FiraMono.zip FiraMono
wget https://github.com/ryanoasis/nerd-fonts/releases/latest/download/JetBrainsMono.zip
unzip JetBrainsMono.zip -d JetBrainsMono
cp JetBrainsMono/*.ttf ~/.local/share/fonts
rm -rf JetBrainsMono.zip JetBrainsMono
wget https://github.com/ryanoasis/nerd-fonts/releases/latest/download/Meslo.zip
unzip Meslo.zip -d Meslo
cp Meslo/*.ttf ~/.local/share/fonts
rm -rf Meslo.zip Meslo
fc-cache
cd -
test -f $HOME/.zshrc || touch $HOME/.zshrc
curl -L git.io/antigen > $HOME/antigen.zsh
cat << EOF >> ~/.zshrc
source $HOME/antigen.zsh
# Load the oh-my-zsh's library
antigen use oh-my-zsh
antigen bundle git
# Syntax highlighting bundle.
antigen bundle zsh-users/zsh-syntax-highlighting
# Fish-like auto suggestions
antigen bundle zsh-users/zsh-autosuggestions
# Extra zsh completions
antigen bundle zsh-users/zsh-completions
antigen bundle command-not-found
antigen bundle bundler
antigen bundle z
# Load the theme
#antigen theme robbyrussell
antigen theme romkatv/powerlevel10k
# Tell antigen that you're done
antigen apply
alias dm='bundle exec rake db:migrate'
alias dmt='bundle exec rake db:migrate && rake db:test:prepare'
alias dmp='RAILS_ENV=production bundle exec rake db:migrate'
alias rc='bundle exec rails c'
alias rg='bundle exec rails g'
alias rcp='RAILS_ENV=production bundle exec rails c'
alias rs='bundle exec rails s'
alias rsp='RAILS_ENV=production bundle exec rails s'
alias pywww='python -m SimpleHTTPServer'
alias os='overmind s'
alias oc='overmind connect web'
alias ls='eza -lh --group-directories-first --icons'
alias lsa='ls -a'
alias lt='eza --tree --level=2 --long --icons --git'
alias lta='lt -a'
alias ff="fzf --preview 'batcat --style=numbers --color=always {}'"
EOF
# Install mise for managing multiple versions of languages. See https://mise.jdx.dev/
sudo apt update -y && sudo apt install -y gpg sudo wget curl
sudo install -dm 755 /etc/apt/keyrings
wget -qO - https://mise.jdx.dev/gpg-key.pub | gpg --dearmor | sudo tee /etc/apt/keyrings/mise-archive-keyring.gpg 1>/dev/null
echo "deb [signed-by=/etc/apt/keyrings/mise-archive-keyring.gpg arch=amd64] https://mise.jdx.dev/deb stable main" | sudo tee /etc/apt/sources.list.d/mise.list
sudo apt update
sudo apt install -y mise
echo 'eval "$(/usr/bin/mise activate zsh)"' >> ~/.zshrc
# add link for rubylsp
mkdir -p /home/alex/.local/bin
ln -s /usr/bin/mise /home/alex/.local/bin/mise
# VsCode
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt update && sudo apt install code -y
# Vscode Better erros
# no seu app rails, instale a gem better_errors: https://github.com/charliesome/better_errors
# ainda no seu app crie o arquivo initializers/better_errors.rb
# coloque a linha
# BetterErrors.editor = "code://open?url=file://%{file}&line=%{line}"
# agora, quando der erro, vc pode clicar no link e o vscode abrirá no arquivo e linha corretos
sudo bash -c 'cat << EOF > /usr/share/applications/vscode-urihandler.desktop
[Desktop Entry]
Name=VSCode
Comment=Open code:// links in Atom editor
GenericName=URI handler
Exec=/usr/bin/code-urihandler %U
Icon=code
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Utility;TextEditor;Development;
MimeType=x-scheme-handler/code
EOF'
sudo bash -c 'cat << EOF > /usr/bin/code-urihandler
#!/bin/bash
request=\${1:23}
request=\${request//%2F//}
request=\${request/&line=/:}
code -g "\$request"
EOF'
sudo chmod +x /usr/bin/code-urihandler
sudo update-desktop-database
sudo bash -c 'cat << EOF > /etc/sysctl.conf
fs.inotify.max_user_watches=524288
fs.inotify.max_user_instances = 256
EOF'
echo 'gem: --no-document' > ~/.gemrc
sudo chsh -s /bin/zsh
flatpak install flathub io.missioncenter.MissionCenter com.github.hluk.copyq com.discordapp.Discord io.dbeaver.DBeaverCommunity org.gnome.meld org.gnome.Calculator com.github.tchx84.Flatseal com.bitwarden.desktop com.rtosta.zapzap com.dropbox.Client org.gimp.GIMP org.kde.kolourpaint net.cozic.joplin_desktop com.github.dynobo.normcap io.gitlab.liferooter.TextPieces io.github.thetumultuousunicornofdarkness.cpu-x org.localsend.localsend_app -y
zsh -c 'source ~/.zshrc; mise use --global node@20'
zsh -c 'source ~/.zshrc; mise use [email protected]'
zsh -c 'source ~/.zshrc; RUBY_CONFIGURE_OPTS=--enable-yjit mise use --global [email protected]'
#NVIM
mise install neovim@stable -y
mise use --global neovim@stable
sudo ln -s $(which nvim) /usr/local/bin/nvim
mv ~/.config/nvim{,.bak}
git clone https://github.com/LazyVim/starter ~/.config/nvim
rm -rf ~/.config/nvim/.git
#Overmind
OVERMIND_LAST_VERSION=`curl -s https://api.github.com/repos/DarthSim/overmind/releases/latest | jq '.assets[] | select(.name|match("linux-amd64.gz$")) | .name' | tr -d '"'`
OVERMIND_LAST_VERSION_FILE=`echo $OVERMIND_LAST_VERSION | rev | cut -f 2- -d '.' | rev`
curl -s https://api.github.com/repos/DarthSim/overmind/releases/latest | jq '.assets[] | select(.name|match("linux-amd64.gz$")) | .browser_download_url' | xargs -n 1 wget
gunzip $OVERMIND_LAST_VERSION
sudo mv $OVERMIND_LAST_VERSION_FILE /usr/local/bin/overmind
chmod +x /usr/local/bin/overmind
# makes Krunner open with the Meta Key
# kwriteconfig6 --file ~/.config/kwinrc --group ModifierOnlyShortcuts --key Meta "org.kde.kglobalaccel,/component/org_kde_krunner_desktop,,invokeShortcut,_launch" && qdbus6 org.kde.KWin /KWin reconfigure
# LAZYGIT
cd /tmp
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
curl -sLo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
tar -xf lazygit.tar.gz lazygit
sudo install lazygit /usr/local/bin
rm lazygit.tar.gz lazygit
cd -
# Browse the web with the most popular browser. See https://www.google.com/chrome/
cd /tmp
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install -y ./google-chrome-stable_current_amd64.deb
rm google-chrome-stable_current_amd64.deb
xdg-settings set default-web-browser google-chrome.desktop
cd -
#DEBGET
sudo apt install curl lsb-release wget
curl -sL https://raw.githubusercontent.com/wimpysworld/deb-get/main/deb-get | sudo -E bash -s install deb-get
deb-get update
deb-get upgrade
deb-get install balena-etcher brave-browser insync fastfetch microsoft-edge-stable
# ATUIN
curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh
sed -i 's|eval "$(atuin init zsh)"|eval "$(atuin init zsh --disable-up-arrow)"|' ~/.zshrc
# Konsole
cat << EOF >> "$HOME/.local/share/konsole/Profile 1.profile"
[Appearance]
ColorScheme=Solarized
Font=FiraMono Nerd Font Mono,10,-1,5,50,0,0,0,0,0
[General]
Command=/bin/zsh -l
Environment=TERM=xterm-256color,COLORTERM=truecolor,SHELL=/bin/zsh
Name=Profile 1
Parent=FALLBACK/
[Interaction Options]
AutoCopySelectedText=true
TextEditorCmd=6
TextEditorCmdCustom=code -g PATH:LINE
TrimLeadingSpacesInSelectedText=true
TrimTrailingSpacesInSelectedText=true
UnderlineFilesEnabled=true
EOF
sed -i '1i\[Desktop Entry]\nDefaultProfile=Profile 1.profile\n' ~/.config/konsolerc
#WOL
# Descobre a interface principal
interface=$(ip route | awk '/default/ {print $5}')
# Verifica se a interface foi encontrada
if [ -z "$interface" ]; then
echo "Erro: Não foi possível encontrar a interface principal."
exit 1
fi
# Descobre o caminho completo do comando ethtool
ethtool_path=$(command -v ethtool)
# Verifica se o ethtool está instalado
if [ -z "$ethtool_path" ]; then
echo "Erro: ethtool não está instalado. Instale-o com: sudo apt install ethtool"
exit 1
fi
# Conteúdo do serviço
service_content="[Unit]
Description=Enable Wake On Lan
[Service]
Type=oneshot
ExecStart=$ethtool_path --change $interface wol g
[Install]
WantedBy=basic.target
"
# Caminho para o arquivo do serviço
service_file="/etc/systemd/system/wol.service"
# Cria o arquivo do serviço
echo "Criando o arquivo $service_file..."
echo "$service_content" | sudo tee $service_file > /dev/null
# Define as permissões corretas
sudo chmod 644 $service_file
# Recarrega o systemd e habilita o serviço
echo "Recarregando o systemd e habilitando o serviço..."
sudo systemctl daemon-reload
sudo systemctl enable wol.service
sudo apt autoremove -y
# Ghostty
bash -c "$(curl -fsSL https://raw.githubusercontent.com/mkasberg/ghostty-ubuntu/HEAD/install.sh)"
mkdir -p "$HOME/.config/ghostty"
# Garante que a linha 'command = zsh' esteja presente e correta
if grep -q "^command" "$HOME/.config/ghostty/config" 2>/dev/null; then
sed -i 's|^command.*|command = zsh|' "$HOME/.config/ghostty/config"
else
echo "command = zsh" >> "$HOME/.config/ghostty/config"
fi
# Garante que a linha 'window-decoration = client' esteja presente e correta
if grep -q "^window-decoration" "$HOME/.config/ghostty/config" 2>/dev/null; then
sed -i 's|^window-decoration.*|window-decoration = client|' "$HOME/.config/ghostty/config"
else
echo "window-decoration = client" >> "$HOME/.config/ghostty/config"
fi
# Garante que o diretório de autostart existe
mkdir -p "$HOME/.config/autostart"
# Cria/atualiza arquivos de autostart corretamente
cat << EOF > "$HOME/.config/autostart/autokey.desktop"
# $Id: autokey-qt.desktop 22 2008-01-29 11:29:13Z peabody $
[Desktop Entry]
Name=AutoKey (Qt)
GenericName=Keyboard Automation
Comment=Program keyboard shortcuts
Keywords=macros keyboard auto key autokey ak automation shortcut bind
Exec=autokey-qt
Terminal=false
Type=Application
Icon=autokey
Categories=Qt;Utility;
EOF
cat << EOF > "$HOME/.config/autostart/com.dropbox.Client.desktop"
[Desktop Entry]
Categories=Network;FileTransfer;
Comment=Access your files from any computer
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=/app/bin/dropbox-app com.dropbox.Client
Icon=com.dropbox.Client
Name=Dropbox
StartupNotify=false
Type=Application
Version=1.0
X-Flatpak=com.dropbox.Client
EOF
cat << EOF > "$HOME/.config/autostart/com.github.hluk.copyq.desktop"
[Desktop Entry]
Categories=Qt;KDE;Utility;
Comment[en_US]=A cut & paste history utility
Comment=A cut & paste history utility
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=copyq com.github.hluk.copyq --start-server
GenericName[en_US]=Clipboard Manager
GenericName=Clipboard Manager
Icon=com.github.hluk.copyq
MimeType=
Name[en_US]=CopyQ
Name=CopyQ
Path=
StartupNotify=false
Terminal=false
TerminalOptions=
Type=Application
X-Flatpak=com.github.hluk.copyq
X-GNOME-Autostart-Delay=3
X-KDE-StartupNotify=false
X-KDE-SubstituteUID=false
X-KDE-UniqueApplet=true
X-KDE-Username=
X-KDE-autostart-after=panel
EOF
cat << EOF > "$HOME/.config/autostart/insync.desktop"
[Desktop Entry]
Version=1.0
Type=Application
Name=Insync
GenericName=Insync
Comment=Launch Insync
Icon=insync
Categories=Network;
Exec=insync start --no-daemon
TryExec=insync
Terminal=false
X-GNOME-Autostart-Delay=3
EOF
# copyq
# Adiciona atalho global do CopyQ (meta+v) ao copyq-commands.ini, se não existir
COPYQ_CMD_FILE="$HOME/.var/app/com.github.hluk.copyq/config/copyq/copyq-commands.ini"
if [ -f "$COPYQ_CMD_FILE" ] && ! grep -q "7\\\\Command=copyq: menu()" "$COPYQ_CMD_FILE"; then
sed -i '/^size=/i \
7\\Command=copyq: menu()\
7\\GlobalShortcut=meta+v\
7\\Icon=\
7\\InternalId=copyq_global_menu\
7\\IsGlobalShortcut=true\
7\\Name=Show the tray menu\
' "$COPYQ_CMD_FILE"
fi
# Edita maxitems e tray_items no copyq.conf
COPYQ_CONF_FILE="$HOME/.var/app/com.github.hluk.copyq/config/copyq/copyq.conf"
if [ -f "$COPYQ_CONF_FILE" ]; then
grep -q '^maxitems=' "$COPYQ_CONF_FILE" && \
sed -i 's/^maxitems=.*/maxitems=200/' "$COPYQ_CONF_FILE" || \
echo "maxitems=200" >> "$COPYQ_CONF_FILE"
grep -q '^tray_items=' "$COPYQ_CONF_FILE" && \
sed -i 's/^tray_items=.*/tray_items=20/' "$COPYQ_CONF_FILE" || \
echo "tray_items=20" >> "$COPYQ_CONF_FILE"
fi
# Ajusta o atalho do lançador de aplicativos no Plasma (remove Meta\t, deixa só Alt+F1)
KSC_FILE="$HOME/.config/kglobalshortcutsrc"
if [ -f "$KSC_FILE" ]; then
sed -i '/^activate application launcher=/s/Meta\\t//g' "$KSC_FILE"
fi
# Garante atalho do KRunner no kglobalshortcutsrc
KSC_FILE="$HOME/.config/kglobalshortcutsrc"
if [ -f "$KSC_FILE" ] && ! grep -q '^\[services\]\[org.kde.krunner.desktop\]' "$KSC_FILE"; then
{
echo ""
echo "[services][org.kde.krunner.desktop]"
echo "_launch=Search\\tMeta\\tAlt+F2\\tAlt+Space"
} >> "$KSC_FILE"
fi
chsh -s /bin/zsh
echo "Acabou! De um boot ou logout".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment