I have a tendency to play around with my system, which has been both very good and very bad for me. On one hand, I have learned so much from tinkering and inspecting files and breaking things, that I probably would not have otherwise learned. On the other hand, I do occasionally break the system beyond repair, which requires a fresh start and a couple hours of time to run the installation and follow up with re-setting all of my configurations. Since I tend to do this quite a bit, I figured it would be a good idea to just go ahead and automate this process. I have a small set of programs that I always need, and a small set of configuration files to go with them. By automating the installation and configuration of them, I give myself a lot more free time since I don’t have to manage these processes myself. Not to mention, this puts me in a good spot for upgrade time, which is about every 3 years for Debian. Each time a new release comes out, my post-installation setup will only take me about 5 minutes of actual attention required.
I’ve split the scripts into two different ones: one is to download the various programs that I want, and the other is to back up my configuration files and store them elsewhere. First, here’s the installation script:
# Set paths for various commands needed in script
# Fix the sources for apt-get
echo <<EOF > /etc/apt/sources.list
# deb cdrom:[Debian GNU/Linux 8.4.0 _Jessie_ – Official amd64 xfce-CD Binary-1 20160402-14:44]/ jessie main
#deb cdrom:[Debian GNU/Linux 8.4.0 _Jessie_ – Official amd64 xfce-CD Binary-1 20160402-14:44]/ jessie main
deb http://ftp.mx.debian.org/debian/ jessie main non-free contrib
deb-src http://ftp.mx.debian.org/debian/ jessie main non-free contrib
deb http://security.debian.org/ jessie/updates main
deb-src http://security.debian.org/ jessie/updates main
# jessie-updates, previously known as ‘volatile’
deb http://ftp.mx.debian.org/debian/ jessie-updates main
deb-src http://ftp.mx.debian.org/debian/ jessie-updates main
# Grab some tools needed for Docker install
$APTGET install -y apt-transport-https ca-certificates curl
# Install Dropbox
# Install Google Chrome
# Install Skype
$DPKG –add-architecture i386
# Install Atom Editor
# Install Slack
# Install Moka Icon theme
# Install Telegram
$WGET https://updates.tdesktop.com/tlinux/tsetup.0.9.49.tar.xz && $TAR -xvf tsetup.0.9.49.tar.xz -C /opt/ && $LN -s /opt/Telegram/Telegram /usr/bin/Telegram
# Install PHPStorm
$WGET https://d1opms6zj7jotq.cloudfront.net/webide/PhpStorm-2016.1.1.tar.gz && $TAR -xvf PhpStorm-2016.1.1.tar.gz -C $HOME/
# Add Spotify to source list
$APTKEY adv –keyserver hkp://keyserver.ubuntu.com:80 –recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886
echo deb http://repository.spotify.com stable non-free | $TEE /etc/apt/sources.list.d/spotify.list
# Set up Docker Install
$APTKEY adv –keyserver hkp://p80.pool.sks-keyservers.net:80 –recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo debian-jessie main" > /etc/apt/sources.list.d/docker.list
$USERMOD -aG docker,sudo billy
# Install all of the deb packages
$DPKG -i $HOME/Downloads/*.deb
# Update sources and install other software not already installed along with dependencies for the deb packages
$APTGET -f install -y vim tmux spotify-client git openvpn zsh docker-engine
# Install Docker Compose
$CURL -L https://github.com/docker/compose/releases/download/1.7.1/docker-compose-`$UNAME -s`-`$UNAME -m` > /usr/local/bin/docker-compose
$CHMOD +x /usr/local/bin/docker-compose
# Clean up
For obvious reasons, this script must be run as root or with sudo. This grabs all the basic software I need in addition to the base install to get me up and running for work and play. Next up, for the configuration backup script:
# Move to the home dir
# Create the tar archive of the config files
echo "Creating tar archive…"
$TAR -cjf home.tar.bz2 \
if [ $? -eq 0 ]; then
echo "FAILED: $?"
# Upload archive to server
echo "Uploading archive to remote server…"
$SCP home.tar.bz2 email@example.com:
echo "Backup complete"
This is a tad bit shorter, but it basically grabs all the configuration files that I wouldn’t want to lose, stores them in a bzipped2 tar archive, and then uploads them to a remote server. When I need to restore them, I simply pull down the tar file and decompress it in my home directory, automatically setting most of my configuration settings. This is not an exhaustive list by any means, and I still need to take some time to find some other configuration files without bloat, such as for Google Chrome for example. This also doesn’t grab my configuration for cinnamon, my DE of choice, nor any custom key bindings. I still have a little more to do to perfect it, but this gets about 90% of it for me, so that’s good enough for now. I’d also like to modify it a bit to not only manage the backups, but also the restoration.
So, these are my scripts! Got anything better? Any ideas on how I can improve these? Please share, either in the comments or via email. I love feedback and contructive criticism.