From: Christian Heller Date: Sat, 8 Aug 2015 03:11:17 +0000 (+0200) Subject: Add server post-install config script. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7Bdb.prefix%7D%7D/day_todos?a=commitdiff_plain;h=8e23f0b00865e0287720be8e542fc1bf1775bec6;p=config Add server post-install config script. --- diff --git a/jessie_start_server.sh b/jessie_start_server.sh new file mode 100755 index 0000000..67c7e6d --- /dev/null +++ b/jessie_start_server.sh @@ -0,0 +1,57 @@ +#!/bin/sh +set -x +set -e + +# Set root pw. +passwd + +# Post-installation reduction. (Answer "no" to GRUB question.) +dpkg-query -Wf '${Package} ${Priority}\n' | grep ' required' | sed 's/ required//' > list_white_unsorted +echo 'ifupdown' >> list_white_unsorted +echo 'isc-dhcp-client' >> list_white_unsorted +sort list_white_unsorted > list_white +dpkg-query -Wf '${Package}\n' > list_all_packages +sort list_all_packages > foo +mv foo list_all_packages +comm -3 list_all_packages list_white > list_black +apt-mark auto `cat list_black` +echo 'APT::AutoRemove::RecommendsImportant "false";' > /etc/apt/apt.conf.d/99mindeps +echo 'APT::AutoRemove::SuggestsImportant "false";' >> /etc/apt/apt.conf.d/99mindeps +DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove +rm list_all_packages list_white_unsorted list_white list_black +echo 'APT::Install-Recommends "false";' >> /etc/apt/apt.conf.d/99mindeps +echo 'APT::Install-Suggests "false";' >> /etc/apt/apt.conf.d/99mindeps + +# Set up manuals. +apt-get -y install man-db manpages less + +# Locale config. +apt-get -y install locales +echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen +locale-gen + +# Clone git repository. +apt-get -y install ca-certificates +apt-get -y install git +git clone http://github.com/plomlompom/config +config/symlink.sh + +# Add user. Remove old user's config/ if it exists. +useradd -m -s /bin/bash plom +rm -rf /home/plom/config +su - plom -c 'git clone http://github.com/plomlompom/config /home/plom/config' +su plom -c '/home/plom/config/symlink.sh' + +# Set up editor. +apt-get -y install vim +mkdir -p .vimbackups +su plom -c 'mkdir -p /home/plom/.vimbackups/' + +# Set up openssh-server. +apt-get -y install openssh-server + +# Clean up. +rm jessie_start_server.sh + +# Set password for user. +passwd plom