Skip to content

Instantly share code, notes, and snippets.

@0xjmux
Created June 2, 2024 23:05
Show Gist options
  • Save 0xjmux/74adafeb729662564f7c29e549567be4 to your computer and use it in GitHub Desktop.
Save 0xjmux/74adafeb729662564f7c29e549567be4 to your computer and use it in GitHub Desktop.
Basic startup script for apt-based VMs and similar machines
#!/bin/bash
# base-bootstrap.sh is a basic startup script for apt-based VMs
# and other machines.
# jbokor, 11-2023
basePackages="tmux vim curl htop gnupg2 git tree software-properties-common lsof"
HOMEDIR="/root"
echo "export PS1='\[\e[31m\]\u@\h:\w\$ \[\e[0m\]'" >> $HOMEDIR/.bashrc
echo "alias sl='ls $LS_OPTIONS'" >> $HOMEDIR/.bashrc
echo "alias ll='ls $LS_OPTIONS -l'" >> $HOMEDIR/.bashrc
echo "alias la='ls $LS_OPTIONS -la'" >> $HOMEDIR/.bashrc
echo "export VISUAL=vim" >> $USER_HOME/.bashrc
echo "export EDITOR=vim" >> $USER_HOME/.bashrc
source $HOMEDIR/.bashrc
# vim setup
touch $HOMEDIR/.vimrc
echo "\" Basic vimrc " >> $HOMEDIR/.vimrc
# spaces instead of tabs
echo "set tabstop=4 shiftwidth=4 expandtab" >> $HOMEDIR/.vimrc
# syntax highlighting
echo "syntax on" >> $HOMEDIR/.vimrc
# fixes coloring issues that occur sometimes in ssh
echo "set background=dark" >> $HOMEDIR/.vimrc
# enables line numbering
echo "set number" >> $HOMEDIR/.vimrc
# prevents possible security issue
echo "set nomodeline" >> $HOMEDIR/.vimrc
echo "root .bashrc and .vimrc updated"
apt update -y
apt upgrade -y
apt install $basePackages -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment