Created
October 4, 2017 16:16
-
-
Save jnalley/40b8e5cb2e33154a0bfa7e9f6a82a98c to your computer and use it in GitHub Desktop.
Debian Setup Script
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
#!/usr/bin/env bash | |
DOTFILES='https://github.com/jnalley/dotfiles.git' | |
export DEBIAN_FRONTEND=noninteractive | |
rm -vf /etc/apt/sources.list \ | |
/etc/apt/sources.list.d/*.list | |
cat > /etc/apt/preferences.d/security.pref <<EOF | |
Package: * | |
Pin: release l=Debian-Security | |
Pin-Priority: 1000 | |
EOF | |
cat > /etc/apt/preferences.d/stable.pref <<EOF | |
Package: * | |
Pin: release a=stable | |
Pin-Priority: 900 | |
EOF | |
cat > /etc/apt/preferences.d/testing.pref <<EOF | |
Package: * | |
Pin: release a=testing | |
Pin-Priority: 100 | |
EOF | |
cat > /etc/apt/preferences.d/unstable.pref <<EOF | |
Package: * | |
Pin: release a=unstable | |
Pin-Priority: 50 | |
EOF | |
cat > /etc/apt/preferences.d/experimental.pref <<EOF | |
Package: * | |
Pin: release a=experimental | |
Pin-Priority: 1 | |
EOF | |
# apt sources | |
cat > /etc/apt/sources.list.d/security.list <<EOF | |
deb http://cloudfront.debian.net/debian-security stable/updates main contrib non-free | |
deb http://cloudfront.debian.net/debian-security testing/updates main contrib non-free | |
EOF | |
for dist in stable testing unstable experimental; do | |
echo "deb http://cloudfront.debian.net/debian ${dist} main contrib non-free" \ | |
> /etc/apt/sources.list.d/${dist}.list | |
done | |
# update everything | |
apt-get update | |
apt-get -o Dpkg::Options::="--force-confnew" --force-yes --yes dist-upgrade | |
# install packages | |
apt-get install -t testing --yes \ | |
awscli \ | |
cmake \ | |
colordiff \ | |
curl \ | |
git \ | |
htop \ | |
jq \ | |
neovim \ | |
silversearcher-ag \ | |
tmux \ | |
unrar | |
apt-get clean --yes | |
apt-get autoremove --purge --yes | |
# create user | |
useradd -m -U -s /bin/bash -k /dev/null jnalley | |
# install dotfiles | |
/bin/su - jnalley <<EOF | |
mkdir -p ~/.ssh | |
ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts | |
git clone ${DOTFILES} .dotfiles | |
./.dotfiles/install.sh | |
EOF | |
cat > ~jnalley/.git.user <<EOF | |
[user] | |
name = Jon Nalley | |
email-github-com = code@bluebot.org | |
EOF | |
# copy ssh key | |
cp -v ~admin/.ssh/authorized_keys ~jnalley/.ssh/authorized_keys | |
chown -R jnalley.jnalley ~jnalley | |
rm -f ~jnalley/.bash_history |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment