Last active
August 6, 2025 06:54
-
-
Save ivanskodje/f345ac522c72ba53ffade230c81b1e21 to your computer and use it in GitHub Desktop.
Ivan Skodje's Ubuntu 22.04/24.04 Setup Scripts for installing various tools and apps
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
#!/bin/bash | |
install_sdkman() { | |
echo "Installing SDKMan ( https://sdkman.io/ )" | |
curl -s "https://get.sdkman.io" | bash | |
export SDKMAN_DIR="$HOME/.sdkman" | |
[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ] && source "$SDKMAN_DIR/bin/sdkman-init.sh" | |
if ! grep -q 'sdkman-init.sh' ~/.bashrc && [ -f ~/.bashrc ]; then | |
echo 'export SDKMAN_DIR="$HOME/.sdkman"' >> ~/.bashrc | |
echo '[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ] && source "$SDKMAN_DIR/bin/sdkman-init.sh"' >> ~/.bashrc | |
fi | |
if ! grep -q 'sdkman-init.sh' ~/.zshrc && [ -f ~/.zshrc ]; then | |
echo 'export SDKMAN_DIR="$HOME/.sdkman"' >> ~/.zshrc | |
echo '[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ] && source "$SDKMAN_DIR/bin/sdkman-init.sh"' >> ~/.zshrc | |
fi | |
} | |
is_sdkman_installed() { | |
if [ -d "$HOME/.sdkman" ]; then | |
echo "true" | |
else | |
echo "false" | |
fi | |
} | |
if [[ $EUID -eq 0 ]]; then | |
echo "This script should not be run as root or with sudo. Please run as a regular user." | |
exit 1 | |
fi | |
echo "Updating & Upgrading" | |
sudo apt update | |
sudo apt-get upgrade -y | |
ORIGINAL_USER=${SUDO_USER:-$(whoami)} | |
ORIGINAL_HOME=$(getent passwd "$ORIGINAL_USER" | cut -d: -f6) | |
sudo apt install dialog -y | |
input=(dialog --separate-output --checklist "Choose what to install:" 20 70 15) | |
options=(1 "Brave Browser" off | |
2 "Git" off | |
3 "oh my zsh" off | |
4 "nvm (Node Version Manager), LTS version as default" off | |
5 "Lazydocker" off | |
6 "Lazygit" off | |
7 "VLC Media Player" off | |
8 "SDKMan" off | |
9 "Java, Latest Stable (Requires SDKMan)" off | |
10 "Chrome gnome shell (for installing Gnome Extesions)" off | |
11 "VIM (with starter config)" off | |
12 "Python 3" off | |
13 "VSCode" off | |
14 "Unsnap!" off | |
15 "IntelliJ IDEA Community" off | |
16 "Obsidian" off | |
17 "Podman (Not working)" off | |
18 "Docker and Docker Compose" off | |
19 "kubectl" off | |
20 "gcloud CLI" off | |
) | |
selections=$("${input[@]}" "${options[@]}" 2>&1 >/dev/tty) | |
clear | |
for item in $selections; do | |
case $item in | |
1) | |
echo "Installing Brave Browser ( https://brave.com/linux )" | |
apt install curl -y | |
curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg | |
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-release.list | |
apt update | |
sudo apt install brave-browser -y | |
;; | |
2) | |
echo "Installing Git ( https://git-scm.com/ )" | |
apt install git -y | |
;; | |
3) | |
echo "Installing zsh" | |
sudo apt install zsh git fonts-font-awesome -y | |
RUNZSH=no CHSH=no sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
chsh -s $(which zsh) | |
# Installing plugins | |
sed -i "/plugins=/ s/)/ "sudo")/" ~/.zshrc | |
sed -i "/plugins=/ s/)/ "history")/" ~/.zshrc | |
sed -i "/plugins=/ s/)/ "copypath")/" ~/.zshrc | |
sed -i "/plugins=/ s/)/ "encode64")/" ~/.zshrc | |
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions | |
sed -i "/plugins=/ s/)/ "zsh-autosuggestions")/" ~/.zshrc | |
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting | |
sed -i "/plugins=/ s/)/ "zsh-syntax-highlighting")/" ~/.zshrc | |
;; | |
4) | |
echo "Installing Node Version Manager ( https://github.com/nvm-sh/nvm )" | |
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash | |
if ! grep -q 'NVM_DIR' ~/.bashrc && [ -f ~/.bashrc ]; then | |
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bashrc | |
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> ~/.bashrc | |
echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"' >> ~/.bashrc | |
fi | |
if ! grep -q 'NVM_DIR' ~/.zshrc && [ -f ~/.zshrc ]; then | |
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.zshrc | |
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> ~/.zshrc | |
echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"' >> ~/.zshrc | |
fi | |
nvm install --lts | |
corepack enable | |
;; | |
5) | |
echo "Installing Lazydocker ( https://github.com/jesseduffield/lazydocker )" | |
DIR="/usr/local/bin" | |
# map different architecture variations to the available binaries | |
ARCH=$(uname -m) | |
case $ARCH in | |
i386 | i686) ARCH=x86 ;; | |
armv6*) ARCH=armv6 ;; | |
armv7*) ARCH=armv7 ;; | |
aarch64*) ARCH=arm64 ;; | |
esac | |
# prepare the download URL | |
LAZYDOCKER_VERSION=$(curl -L -s -H 'Accept: application/json' https://github.com/jesseduffield/lazydocker/releases/latest | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/') | |
GITHUB_FILE="lazydocker_${LAZYDOCKER_VERSION//v/}_$(uname -s)_${ARCH}.tar.gz" | |
GITHUB_URL="https://github.com/jesseduffield/lazydocker/releases/download/${LAZYDOCKER_VERSION}/${GITHUB_FILE}" | |
# install/update the local binary | |
curl -L -o lazydocker.tar.gz $GITHUB_URL | |
tar xzvf lazydocker.tar.gz lazydocker | |
install -Dm 755 lazydocker -t "$DIR" | |
rm lazydocker lazydocker.tar.gz | |
;; | |
6) | |
echo "Installing Lazygit ( https://github.com/jesseduffield/lazygit )" | |
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*') | |
curl -Lo 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 | |
install lazygit /usr/local/bin | |
rm ./lazygit.tar.gz | |
rm ./lazygit | |
;; | |
7) | |
echo "Installing VLC Media Player ( https://www.videolan.org/vlc/ )" | |
sudo apt install vlc -y | |
;; | |
8) | |
echo "Installing SDKMan" | |
install_sdkman | |
;; | |
9) | |
sdkman_installed=$(is_sdkman_installed) | |
if [ "$sdkman_installed" = "false" ]; then | |
echo "SDKMan is required for Java installation. Installing SDKMan first." | |
install_sdkman | |
fi | |
echo "Install latest stable Java (uses SDKMan)" | |
sdk install java | |
;; | |
10) | |
echo "Installing chrome-gnome-shell for installing Gnome Extensions" | |
sudo apt install chrome-gnome-shell -y | |
;; | |
11) | |
sudo apt install vim vim-gtk3 -y | |
# Install vim-plug for plugin management | |
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
# Config .vimrc | |
VIMRC_PATH="$HOME/.vimrc" | |
echo "THIS IS VIMRC_PATH: " | |
echo "${VIMRC_PATH}" | |
if [ ! -f "$VIMRC_PATH" ]; then | |
echo "Creating .vimrc file..." | |
touch "$VIMRC_PATH" | |
else | |
echo ".vimrc file already exists." | |
fi | |
echo "Configuring VIM..." | |
cat >"$VIMRC_PATH" <<-EOF | |
" Set basic editing preferences | |
set relativenumber | |
set clipboard=unnamedplus | |
set undofile | |
syntax on | |
" Initialize plugin system | |
call plug#begin('~/.vim/plugged') | |
" Plugin list | |
Plug 'tpope/vim-fugitive' | |
Plug 'scrooloose/nerdtree' | |
Plug 'ctrlpvim/ctrlp.vim' | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'morhetz/gruvbox' | |
Plug 'preservim/tagbar' | |
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
Plug 'junegunn/fzf.vim' | |
" Initialize plugin system | |
call plug#end() | |
" Key mappings | |
map <C-n> :NERDTreeToggle<CR> | |
map <C-p> :CtrlP<CR> | |
map <C-f> :Files<CR> | |
EOF | |
echo "Installing plugins..." | |
vim +PlugInstall +qall | |
echo "\" Theme configuration" >>"$VIMRC_PATH" | |
echo "colorscheme gruvbox" >>"$VIMRC_PATH" | |
echo "set background=dark" >>"$VIMRC_PATH" | |
echo "\" Airline configuration" >>"$VIMRC_PATH" | |
echo "let g:airline_powerline_fonts = 1" >>"$VIMRC_PATH" | |
echo "Installing gruvbox..." | |
mkdir -p ~/.vim/pack/themes/start | |
git clone --depth 1 https://github.com/morhetz/gruvbox ~/.vim/pack/themes/start/gruvbox | |
;; | |
12) | |
echo "Installing Python 3 and related dependencies..." | |
sudo apt install python3 python3-pip python3.12-venv | |
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1 | |
;; | |
13) | |
echo "Installing VSCode" | |
sudo apt install software-properties-common apt-transport-https wget -y | |
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add - | |
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" | |
sudo apt install code | |
;; | |
14) | |
echo "Unsnapping and creating flakpak instead!" | |
sudo apt install git -y | |
git clone https://github.com/popey/unsnap | |
./unsnap/unsnap | |
sudo rm -R unsnap | |
;; | |
15) | |
echo "Installing IntelliJ Community Edition" | |
wget https://download.jetbrains.com/idea/ideaIC-2023.3.3.tar.gz | |
tar -xf ideaIC-2023.3.3.tar.gz | |
sudo mkdir -p /opt/idea | |
sudo mv idea-IC-*/ /opt/idea/ | |
sudo mv /opt/idea/idea-IC-*/* /opt/idea/ | |
sudo rm -rf /opt/idea/idea-IC-*/ | |
sudo ln -s /opt/idea/bin/idea.sh /usr/local/bin/idea | |
echo 'alias idea="nohup /usr/local/bin/idea $@ >/dev/null 2>&1 &"' >>~/.bashrc | |
echo 'alias idea="nohup /usr/local/bin/idea $@ >/dev/null 2>&1 &"' >>~/.zshrc | |
source ~/.bashrc | |
source ~/.zshrc | |
sudo rm ideaIC-2023.3.3.tar.gz | |
;; | |
16) | |
echo "Installing Obsidian" | |
sudo apt install libfuse2 -y | |
wget https://github.com/obsidianmd/obsidian-releases/releases/download/v1.8.10/Obsidian-1.8.10.AppImage | |
chmod +x Obsidian-1.8.10.AppImage | |
sudo mv Obsidian-1.8.10.AppImage /usr/local/bin/obsidian | |
sudo ln -s /usr/local/bin/obsidian /usr/local/bin/obsidian-1.8.10 | |
echo "Creating shortcut to Obsidian..." | |
mkdir -p ~/.local/share/applications | |
cat > ~/.local/share/applications/obsidian.desktop <<EOF | |
[Desktop Entry] | |
Name=Obsidian | |
Exec=/usr/local/bin/obsidian --no-sandbox | |
Icon=obsidian | |
Type=Application | |
Categories=Utility; | |
Terminal=false | |
StartupWMClass=obsidian | |
EOF | |
update-desktop-database ~/.local/share/applications | |
;; | |
17) | |
echo "Installing Podman" | |
sudo apt install flatpak -y | |
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo | |
flatpak install flathub io.podman_desktop.PodmanDesktop -y | |
sudo apt install podman -y | |
sudo apt install podman-docker -y | |
# alias docker=podman | |
;; | |
18) | |
echo "Installing Docker Engine and Compose" | |
sudo apt-get install ca-certificates curl gnupg -y | |
sudo install -m 0755 -d /etc/apt/keyrings | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | | |
sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
sudo chmod a+r /etc/apt/keyrings/docker.gpg | |
sudo tee /etc/apt/sources.list.d/docker.sources >/dev/null <<EOF | |
Types: deb | |
URIs: https://download.docker.com/linux/ubuntu | |
Suites: $(lsb_release -cs) | |
Components: stable | |
Architectures: $(dpkg --print-architecture) | |
Signed-By: /etc/apt/keyrings/docker.gpg | |
EOF | |
sudo apt-get update | |
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y | |
sudo usermod -aG docker ${USER} | |
docker --version | |
docker compose version | |
;; | |
19) | |
echo "Installing kubectl..." | |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl | |
rm kubectl | |
;; | |
20) | |
echo "Installing gcloud CLI..." | |
sudo apt-get install apt-transport-https ca-certificates gnupg curl -y | |
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg | |
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list | |
sudo apt-get update && sudo apt-get install google-cloud-cli -y | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment