#!/bin/bash # Exit immediately if a command exits with a non-zero status. set -e # --- Color Variables --- RESET='\033[0m' # Reset all attributes back to normal # Use Bold Cyan for emphasis - choose a color you like (e.g., BOLD_GREEN='\033[1;32m') HIGHLIGHT='\033[1;36m' # Bold Cyan # --- Update System --- echo -e "${HIGHLIGHT}---> Updating package lists...${RESET}" sudo apt update echo -e "${HIGHLIGHT}---> Upgrading existing packages...${RESET}" sudo apt upgrade -y # --- Install Core Utilities --- echo -e "${HIGHLIGHT}---> Installing htop, lsof, and ufw...${RESET}" sudo apt install -y htop lsof ufw # --- Shell and Editor Customizations --- echo -e "${HIGHLIGHT}---> Adding 'll' alias system-wide...${RESET}" # Append the alias to the system-wide bashrc file. # This will apply to new interactive shells for all users. echo "alias ll='ls -alF --color=auto'" | sudo tee -a /etc/bash.bashrc echo -e "${HIGHLIGHT}---> Creating basic system-wide Vim configuration...${RESET}" # Create or overwrite vimrc.local with basic settings for all users. # This config will be read by vim-tiny and full vim if installed later. # These settings won't override user-specific ~/.vimrc files. sudo tee /etc/vim/vimrc.local > /dev/null <<'EOF' " Basic System-Wide Vim Settings (/etc/vim/vimrc.local) set nocompatible " Use Vim settings instead of Vi set encoding=utf-8 " Use UTF-8 encoding set number " Show line numbers set ruler " Show cursor position set showcmd " Show incomplete commands set incsearch " Show match while typing search set hlsearch " Highlight all search matches set ignorecase " Ignore case in searches set smartcase " Override ignorecase when search includes uppercase set autoindent " Copy indent from current line for new line set smartindent " Smart autoindenting for programming " Syntax and Colors syntax enable " Enable syntax highlighting set background=dark " Use dark background colorscheme desert " Set color scheme (if available) " Tabs and Spaces set expandtab " Use spaces instead of tabs set tabstop=4 " Number of spaces for tab set shiftwidth=4 " Number of spaces for autoindent set softtabstop=4 " Number of spaces for tab in insert mode " File Type Settings filetype plugin indent on " Enable file type detection and plugins " Backups and Swaps set nobackup " Don't create backup files set nowritebackup " Don't create backup while editing set noswapfile " Don't create swap files " UI Settings set laststatus=2 " Always show status line set wildmenu " Better command-line completion set showmatch " Show matching brackets set cursorline " Highlight current line " quick move with hjkl nnoremap ^ nnoremap $ nnoremap 4j nnoremap 4k EOF # Ensure the file has appropriate permissions (readable by all) sudo chmod a+r /etc/vim/vimrc.local # --- Install Docker (Using Official Steps) --- echo -e "${HIGHLIGHT}---> Setting up Docker using the official steps...${RESET}" # 1. Install prerequisites echo -e "${HIGHLIGHT} -> Installing prerequisites for Docker repository (ca-certificates, curl)...${RESET}" sudo apt-get update # Update before installing prerequisites sudo apt-get install -y ca-certificates curl # 2. Add Docker's official GPG key echo -e "${HIGHLIGHT} -> Creating directory for apt keyrings...${RESET}" sudo install -m 0755 -d /etc/apt/keyrings echo -e "${HIGHLIGHT} -> Downloading Docker GPG key...${RESET}" sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc # 3. Add the repository to Apt sources echo -e "${HIGHLIGHT} -> Adding Docker APT repository...${RESET}" echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null # 4. Update apt package index again echo -e "${HIGHLIGHT} -> Updating package lists after adding Docker repo...${RESET}" sudo apt-get update # 5. Install Docker Engine, CLI, Containerd, and plugins echo -e "${HIGHLIGHT} -> Installing Docker Engine, CLI, Containerd, and plugins...${RESET}" sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin # 6. Verify Docker installation echo -e "${HIGHLIGHT}---> Verifying Docker installation by running hello-world...${RESET}" sudo docker run hello-world # --- Final Message --- echo -e "${HIGHLIGHT}-----------------------------------------------------${RESET}" echo -e "${HIGHLIGHT}Setup complete!${RESET}" echo -e "${HIGHLIGHT}Installed: htop, lsof, ufw, Docker${RESET}" echo -e "${HIGHLIGHT}-----------------------------------------------------${RESET}"