Skip to content

Instantly share code, notes, and snippets.

@manti-by
Last active March 18, 2024 16:29
Show Gist options
  • Save manti-by/1a0ca9d48a1a99c045a1700da55f971a to your computer and use it in GitHub Desktop.
Save manti-by/1a0ca9d48a1a99c045a1700da55f971a to your computer and use it in GitHub Desktop.
Ubuntu installation
#!/bin/bash
echo "Add user and disable password prompt"
adduser manti
usermod -aG sudo manti
echo "manti ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
echo "Remove unnecessary packages"
apt remove -y needrestart
echo "Install base system packages"
apt update && apt upgrade -y
apt install -y git make wget curl llvm vim gcc zip unzip yasm dkms linux-headers-generic \
autoconf automake build-essential cmake libtool texinfo pkg-config \
ca-certificates gnupg lsb-release net-tools
echo "Install GUI system packages"
apt install -y gir1.2-gtop-2.0 gir1.2-clutter-1.0 \
firefox terminator gnome-tweaks chrome-gnome-shell
echo "Install additional system library packages"
apt install -y zlib1g-dev tk-dev libssl-dev libxml2-dev \
libxmlsec1-dev libreadline-dev libsasl2-dev libldap2-dev \
liblzma-dev libbz2-dev libsqlite3-dev libffi-dev
echo "Install additional system media packages"
apt install -y libass-dev libfreetype6-dev libmp3lame-dev libtheora-dev libvorbis-dev
echo "Install Docker"
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update && apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
usermod -aG docker manti
echo "Install Redis server"
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
apt update && apt install -y redis
echo "Install Postgres server"
sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
apt update && apt install -y postgresql
echo "Create necessary directories"
mkdir -p /home/manti/bin/
mkdir -p /home/manti/usr/
mkdir -p /home/manti/download/
mkdir -p /mnt/data/
chown -R manti:manti /home/manti/ /mnt/data/
mkdir -p /home/manti/usr/Desktop
mkdir -p /home/manti/usr/Templates
mkdir -p /home/manti/usr/Public
mkdir -p /home/manti/usr/Documents
mkdir -p /home/manti/usr/Music
mkdir -p /home/manti/usr/Photo/Screenshots/
mkdir -p /home/manti/.config/terminator/
echo "Install Paper theme"
add-apt-repository -u ppa:snwh/ppa
apt install -y paper-icon-theme
gsettings set org.gnome.desktop.interface icon-theme "Paper"
echo "Set base settings"
gsettings set org.gnome.desktop.session idle-delay 900
gsettings set org.gnome.nautilus.preferences default-sort-order type
gsettings set org.gtk.Settings.FileChooser show-hidden false
gsettings set org.gtk.Settings.FileChooser sort-directories-first true
gsettings set org.gnome.gedit.preferences.editor auto-save true
gsettings set org.gnome.gedit.preferences.editor display-line-numbers true
gsettings set org.gnome.gedit.preferences.editor display-right-margin true
gsettings set org.gnome.gedit.preferences.editor insert-spaces true
gsettings set org.gnome.gedit.preferences.editor tabs-size 4
echo "Install pyenv, autoenv and NVM"
curl https://pyenv.run | bash
wget --show-progress -o /dev/null -O- 'https://raw.githubusercontent.com/hyperupcall/autoenv/master/scripts/install.sh' | sh
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
echo "Copy configs"
conf_path="https://gist.githubusercontent.com/manti-by/1a0ca9d48a1a99c045a1700da55f971a/raw/499e54540434516e5fa1dc3a8b046294b3c8b4f5"
wget -O - $conf_path/root.bashrc.conf | /root/.bashrc
wget -O - $conf_path/manti.bashrc.conf | /home/manti/.bashrc
wget -O - $conf_path/terminator.conf | /home/manti/.config/terminator/config
wget -O - $conf_path/user-dirs.conf | /home/manti/.config/user-dirs.dirs
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# Don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# Append to the history file, don't overwrite it
shopt -s histappend
# For setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# Check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# Make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# Set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# Colored prompt
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
# If this is an xterm set the title to user@host:dir
case "$TERM" in xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# Enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
fi
# Colored GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# Some more aliases
alias ll='ls -ahlF'
alias time='/usr/bin/time'
alias space='df -h --type=ext4'
# Enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
# Node version manager
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
# PyEnv
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
# Autoenv
source "$HOME/.autoenv/activate.sh"
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=999999
HISTFILESIZE=999999
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[01;33m\]\w \[\033[01;35m\]\$ \[\033[00m\]'
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# Enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
fi
# Colored GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# Some more ls aliases
alias ll='ls -alF'
alias time='/usr/bin/time'
alias space='df -h --type=ext4'
# Alias definitions
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
[global_config]
enabled_plugins = InactivityWatch, LaunchpadCodeURLHandler, APTURLHandler, LaunchpadBugURLHandler
inactive_color_offset = 1.0
suppress_multiple_term_dialog = True
title_transmit_bg_color = "#efefef"
[keybindings]
[layouts]
[[default]]
[[[child0]]]
fullscreen = False
last_active_term = f1c38c47-921a-4e59-80d3-e19310257a0b
last_active_window = True
maximised = True
order = 0
parent = ""
position = 1920:27
size = 1920, 989
type = Window
[[[child1]]]
order = 0
parent = child0
position = 493
ratio = 0.501016260163
type = VPaned
[[[child2]]]
order = 0
parent = child1
position = 960
ratio = 0.501305483029
type = HPaned
[[[terminal3]]]
directory = /home/manti/www
order = 0
parent = child2
profile = default
type = Terminal
uuid = f1c38c47-921a-4e59-80d3-e19310257a0b
[[[terminal4]]]
directory = /home/manti
order = 1
parent = child2
profile = default
type = Terminal
uuid = 699bdd4b-f36a-446c-8587-df6fdd2ae057
[[[terminal5]]]
directory = /home/manti/www
order = 1
parent = child1
profile = default
type = Terminal
uuid = c4057cac-db05-43ac-9d2d-7c3a626f633e
[plugins]
[profiles]
[[default]]
background_color = "#222222"
background_darkness = 0.99
background_type = transparent
cursor_color = "#aaaaaa"
foreground_color = "#eeeeec"
scrollback_infinite = True
scrollback_lines = 10000
XDG_DOWNLOAD_DIR="$HOME/download"
XDG_DESKTOP_DIR="$HOME/usr/Desktop"
XDG_TEMPLATES_DIR="$HOME/usr/Templates"
XDG_PUBLICSHARE_DIR="$HOME/usr/Public"
XDG_DOCUMENTS_DIR="$HOME/usr/Documents"
XDG_MUSIC_DIR="$HOME/usr/Music"
XDG_PICTURES_DIR="$HOME/usr/Photo"
XDG_VIDEOS_DIR="$HOME/usr/Video"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment