Created
February 13, 2024 11:28
-
-
Save ivanskodje/f345ac522c72ba53ffade230c81b1e21 to your computer and use it in GitHub Desktop.
Ivan Skodje's Ubuntu 22.04 Setup Scripts for installing various tools and apps
This file contains 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 | |
source "$HOME/.sdkman/bin/sdkman-init.sh" | |
echo 'source "$HOME/.sdkman/bin/sdkman-init.sh"' >>~/.zshrc | |
echo 'source "$HOME/.sdkman/bin/sdkman-init.sh"' >>~/.bashrc | |
} | |
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 "NordVPN" off | |
4 "nvm (Node Version Manager), Node 18 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 "oh my zsh" 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 | |
) | |
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 NordVPN ( https://nordvpn.com/ )" | |
wget https://repo.nordvpn.com/deb/nordvpn/debian/pool/main/nordvpn-release_1.0.0_all.deb | |
sudo apt install ./nordvpn-release_1.0.0_all.deb | |
apt update | |
sudo apt install nordvpn -y | |
usermod -aG nordvpn $USER | |
rm ./nordvpn-release_1.0.0_all.deb | |
;; | |
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 | |
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 | |
nvm install 18 | |
npm install --global yarn | |
;; | |
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 -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" | |
;; | |
12) | |
echo "Installing zsh" | |
sudo apt install zsh git fonts-font-awesome -y | |
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 | |
;; | |
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" | |
wget https://github.com/obsidianmd/obsidian-releases/releases/download/v1.5.3/Obsidian-1.5.3.AppImage | |
chmod +x Obsidian-1.5.3.AppImage | |
sudo mv Obsidian-1.5.3.AppImage /usr/local/bin/obsidian | |
sudo ln -s /usr/local/bin/obsidian /usr/local/bin/obsidian-1.5.3 | |
;; | |
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 and Docker Compose" | |
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.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 | |
apt-cache policy docker-ce | |
sudo apt install docker-ce -y | |
sudo usermod -aG docker ${USER} | |
# Compose | |
mkdir -p ~/.docker/cli-plugins/ | |
curl -SL https://github.com/docker/compose/releases/download/v2.3.3/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose | |
chmod +x ~/.docker/cli-plugins/docker-compose | |
docker compose version | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment