Skip to content

Instantly share code, notes, and snippets.

@marcaurele
Last active September 18, 2018 14:27
Show Gist options
  • Save marcaurele/598f4b810c3c1a9debcd8e23169a264a to your computer and use it in GitHub Desktop.
Save marcaurele/598f4b810c3c1a9debcd8e23169a264a to your computer and use it in GitHub Desktop.
Installer for my debian laptop
#!/usr/bin/env bash
set -e
# Debian installer to be executed after a fresh installation
# curl -H 'Cache-Control: no-cache' -L http://bit.ly/liskam-installer | bash
# curl -H 'Cache-Control: no-cache' -L https://gist.githubusercontent.com/marcaurele/598f4b810c3c1a9debcd8e23169a264a/raw/debian-installer | /bin/bash
echo "Debian Installer 🤖"
export DEBIAN_FRONTEND=noninteractive
echo -n "What is the local username on this machine: "
read username < /dev/tty
if [ ! -d "/home/$username" ]; then
echo "The $username home directory does not exist, bye!"
exit 1
fi
echo "Switching APT sources to Debian testing"
# Switch from debian release to debian testing
# Edit /etc/apt/sources.list
cat <<EOF > /etc/apt/sources.list
# Debian testing APT sources using ethz.ch mirror
deb http://debian.ethz.ch/debian testing main contrib non-free
deb-src http://debian.ethz.ch/debian testing main contrib non-free
deb http://security.debian.org/debian-security testing/updates main contrib non-free
deb-src http://security.debian.org/debian-security testing/updates main contrib non-free
EOF
echo "Installing base programs for this script"
apt install -y -o Dpkg::Options::="--force-confdef" software-properties-common curl apt-transport-https gpg
echo "Adding extra APT sources"
# Sublime text editor
curl https://download.sublimetext.com/sublimehq-pub.gpg | apt-key add -
echo "deb https://download.sublimetext.com/ apt/stable/" | tee /etc/apt/sources.list.d/sublime-text.list
# Docker
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable edge"
# Yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
echo "Updating APT cache"
# Update the APT cache
apt update -qq
echo "Upgrading all current packages"
# Upgrade all packages
apt upgrade -y -o Dpkg::Options::="--force-confold"
echo "Reconfiguring locales"
# Reconfigure locale
# locale - https://wiki.debian.org/Locale
# fr_CH.UTF-8 UTF-8
sed -E 's/# fr_CH.UTF-8 UTF-8/fr_CH.UTF-8 UTF-8/' -i /etc/locale.gen
# en_US.UTF-8 UTF-8
sed -E 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' -i /etc/locale.gen
# en_CA.UTF-8 UTF-8
sed -E 's/# en_CA.UTF-8 UTF-8/en_CA.UTF-8 UTF-8/' -i /etc/locale.gen
locale-gen
echo "Settings locale at different places"
# localectl set-locale LANG=en_CA.UTF-8
# Edit locales in different files
cat <<EOF > /etc/default/locale
LANG="en_CA.UTF-8"
LANGUAGE="en_CA.UTF-8"
LC_TIME="fr_CH.UTF-8"
LC_PAPER="fr_CH.UTF-8"
LC_MEASUREMENT="fr_CH.UTF-8"
EOF
echo "Installing packages"
apt install -y -o Dpkg::Options::="--force-confdef" \
byobu sudo man htop iftop git xfce4-terminal gpg gpg-agent mtr wget curl oathtool ipcalc zsh pigz qrencode fonts-symbola \
pwgen dnsutils whois net-tools pssh ack openssl pass remmina brightnessctl apt-transport-https inputplug xinput \
docker-ce docker-compose vagrant virt-manager qemu qemu-kvm libvirt-clients libvirt-daemon \
python python-pip python3 python3-pip \
maven openjdk-8-jdk \
kafkacat yarn \
chromium rdesktop gimp vlc libreoffice calibre inkscape treesheets sublime-text weechat \
i3 i3status i3lock suckless-tools xsettingsd network-manager blueman pulseaudio pavucontrol network-manager-gnome \
gocryptfs \
automake make cmake build-essential libtool libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
qtbase5-dev qttools5-dev-tools libqt5sql5-sqlite libqt5sql5-mysql libqt5sql5-psql libmariadbclient-dev-compat \
xz-utils tk-dev
echo "Cleaning APT cache"
apt clean
echo "Changing default JDK to 1.8"
update-java-alternatives -s `update-java-alternatives -l | grep "1.8" | awk '{print $1}'`
echo "Installing NodeJS"
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
apt-get install -y nodejs
echo "Performing operation for $username"
su - $username
mkdir ~/soft
echo "Installing DropBox"
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
echo "Please run ~/.dropbox-dist/dropboxd to configure Dropbox"
#~/.dropbox-dist/dropboxd
echo "Installing Telegram"
wget --content-disposition https://telegram.org/dl/desktop/linux
find . -type f -name tsetup* | xargs tar xf $1 -C ~/soft/
echo "Installing Intellij"
wget --content-disposition "https://data.services.jetbrains.com/products/download?code=IIU&platform=linux"
find . -type f -name idea* | xargs tar xf $1 -C ~/soft/
echo "Configuring keyboard"
setxkbmap -option ctrl:nocaps
echo "Configure logrotate for IRC"
echo "TODO - http://vdwaa.nl/archlinux/systemd/weechat/logs/logrotate-weechat-logs/"
# https://www.bootc.net/archives/2013/06/09/my-perfect-gnupg-ssh-agent-setup/
# Firefox settings
# mousewheel.acceleration.factor;40
# mousewheel.acceleration.start;0
# Python things
pip install virtualenv
# pisi
curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python
# Pyenv
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
~/.pyenv/bin/pyenv install 2.7.15
~/.pyenv/bin/pyenv install 3.5.6
~/.pyenv/bin/pyenv install 3.6.6
~/.pyenv/bin/pyenv install 3.7.0
DEFAULT_PYENV='3.6.6'
~/.local/bin/pipsi install --python ~/.pyenv/versions/$DEFAULT_PYENV/bin/python cs
~/.local/bin/pipsi install --python ~/.pyenv/versions/$DEFAULT_PYENV/bin/python flake8
~/.local/venvs/flake8/bin/pip install flake8-import-order flake8-bugbear
~/.local/bin/pipsi install --python ~/.pyenv/versions/$DEFAULT_PYENV/bin/python pip-tools
~/.local/bin/pipsi install --python ~/.pyenv/versions/$DEFAULT_PYENV/bin/python sphinx
~/.local/venvs/sphinx/bin/pip install sphinx-rtd-theme
~/.local/bin/pipsi install --python ~/.pyenv/versions/$DEFAULT_PYENV/bin/python runstatus-cli
~/.local/bin/pipsi install --python ~/.pyenv/versions/$DEFAULT_PYENV/bin/python black
# ZNC tricks for weechat
#/set irc.server_default.capabilities account-notify,away-notify,cap-notify,multi-prefix,server-time,znc.in/server-time-iso,znc.in/self-message
# /reconnect -all
ssh-keyscan github.com >> .ssh/known_hosts
git clone https://github.com/marcaurele/dotfiles.git .dotfiles
cd ~/.dotfiles
./script/bootstrap
echo "Done 👏🏽🎉👻🏁"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment