| @@ -142,13 +142,14 @@ pg_dropcluster 9.4 main | |||
| 142 | 142 | ||
| 143 | 143 | # remove old squeeze packages left around (keep eyes open!) | |
| 144 | 144 | apt-get autoremove | |
| 145 | - | aptitude search ?obsolete | |
| 146 | - | dpkg -l | grep etch | grep -v xen | grep -v unbound | grep -v finch | awk '{print $2}' | xargs aptitude -y purge | |
| 147 | - | dpkg -l | grep lenny | grep -v xen | awk '{print $2}' | xargs aptitude -y purge | |
| 148 | - | dpkg -l | grep -E 'deb6|squeeze' | grep -v xen | awk '{print $2}' | xargs aptitude -y purge | |
| 149 | - | dpkg -l | grep -E 'deb7|wheezy' | grep -v xen | grep -v -E 'linux-image|mailscanner|openswan|debian-security-support' | awk '{print $2}' | xargs aptitude -y purge | |
| 150 | - | dpkg -l | grep -E 'deb8|jessie' | grep -v xen | grep -v -E 'linux-image|debian-security-support' | awk '{print $2}' | xargs aptitude -y purge | |
| 151 | - | aptitude -y install deborphan && deborphan | grep -v xen | grep -v libpam-cracklib | xargs aptitude -y purge | |
| 145 | + | apt-get purge $(dpkg -l | awk '/gcc-4.9/ { print $2 }') | |
| 146 | + | apt-get purge $(aptitude search ?obsolete | grep -v linux-image | awk '/^i/ { print $2 }') | |
| 147 | + | apt-get purge $(dpkg -l | grep etch | grep -v xen | grep -v unbound | grep -v finch | awk '/^rc/ { print $2 }') | |
| 148 | + | apt-get purge $(dpkg -l | grep lenny | grep -v xen | awk '/^rc/ { print $2 }') | |
| 149 | + | apt-get purge $(dpkg -l | grep -E 'deb6|squeeze' | grep -v xen | awk '/^rc/ { print $2 }') | |
| 150 | + | apt-get purge $(dpkg -l | grep -E 'deb7|wheezy' | grep -v xen | grep -v -E 'linux-image|mailscanner|openswan|debian-security-support' | awk '/^rc/ { print $2 }') | |
| 151 | + | apt-get purge $(dpkg -l | grep -E 'deb8|jessie' | grep -v xen | grep -v -E 'linux-image|debian-security-support' | awk '{ print $2 }') | |
| 152 | + | aptitude -y install deborphan && apt-get purge $(deborphan | grep -v xen | grep -v libpam-cracklib | awk '/^rc/ { print $2 }') | |
| 152 | 153 | apt-get purge $(dpkg -l | awk '/^rc/ { print $2 }') | |
| 153 | 154 | ||
| 154 | 155 | # for the brave YoloOps crowd | |
waja / gist:e518bc6006ad424b957fdd8832bb5306
Last active 5 months ago
Jan Wagner revised this gist 9 years ago · 02abd1c
1 file changed, 8 insertions, 7 deletions
Jan Wagner revised this gist 9 years ago · c9bfc10
1 file changed, 2 insertions, 2 deletions
| @@ -42,8 +42,8 @@ aptitude search "~ahold" | grep "^.h" | |||
| 42 | 42 | dpkg --get-selections | grep hold | |
| 43 | 43 | ||
| 44 | 44 | # unmark packages auto | |
| 45 | - | aptitude unmarkauto vim net-tools | |
| 46 | - | aptitude unmarkauto monitoring-plugins-standard monitoring-plugins-common monitoring-plugins-basic | |
| 45 | + | aptitude unmarkauto vim net-tools && \ | |
| 46 | + | aptitude unmarkauto monitoring-plugins-standard monitoring-plugins-common monitoring-plugins-basic && \ | |
| 47 | 47 | aptitude unmarkauto $(dpkg-query -W 'linux-image-3.16*' | cut -f1) | |
| 48 | 48 | ||
| 49 | 49 | # have a look into required and free disk space | |
Jan Wagner revised this gist 9 years ago · 6f45478
1 file changed, 18 insertions, 18 deletions
| @@ -66,19 +66,19 @@ EOF | |||
| 66 | 66 | # minimal system upgrade (keep sysvinit / see http://noone.org/talks/debian-ohne-systemd/debian-ohne-systemd-clt.html#%2811%29) | |
| 67 | 67 | aptitude upgrade | |
| 68 | 68 | ||
| 69 | - | # (re)enable wheel | |
| 70 | - | if [ -f /etc/pam.d/su.dpkg-new ]; then CFG=/etc/pam.d/su.dpkg-new; else CFG=/etc/pam.d/su; fi | |
| 71 | - | sed -i "s/# auth required pam_wheel.so/auth required pam_wheel.so/" $CFG | |
| 72 | - | ||
| 73 | - | # (re)configure snmpd | |
| 74 | - | COMMUNITY="mycommunity"; \ | |
| 75 | - | if [ -f /etc/snmp/snmpd.conf.dpkg-new ]; then CFG=/etc/snmp/snmpd.conf.dpkg-new; \ | |
| 76 | - | else CFG=/etc/snmp/snmpd.conf; fi | |
| 77 | - | sed -i "s^#rocommunity secret 10.0.0.0/16^rocommunity $COMMUNITY^g" $CFG | |
| 78 | - | sed -i s/#agentAddress/agentAddress/ $CFG | |
| 79 | - | sed -i "s/^ rocommunity public/# rocommunity public/" $CFG | |
| 80 | - | sed -i "s/^ rocommunity6 public/# rocommunity6 public/" $CFG | |
| 81 | - | sed -i "s/agentAddress udp:127/#agentAddress udp:127/" $CFG | |
| 69 | + | ## (re)enable wheel | |
| 70 | + | #if [ -f /etc/pam.d/su.dpkg-new ]; then CFG=/etc/pam.d/su.dpkg-new; else CFG=/etc/pam.d/su; fi | |
| 71 | + | #sed -i "s/# auth required pam_wheel.so/auth required pam_wheel.so/" $CFG | |
| 72 | + | ||
| 73 | + | ## (re)configure snmpd | |
| 74 | + | #COMMUNITY="mycommunity"; \ | |
| 75 | + | #if [ -f /etc/snmp/snmpd.conf.dpkg-new ]; then CFG=/etc/snmp/snmpd.conf.dpkg-new; \ | |
| 76 | + | # else CFG=/etc/snmp/snmpd.conf; fi | |
| 77 | + | #sed -i "s^#rocommunity secret 10.0.0.0/16^rocommunity $COMMUNITY^g" $CFG | |
| 78 | + | #sed -i s/#agentAddress/agentAddress/ $CFG | |
| 79 | + | #sed -i "s/^ rocommunity public/# rocommunity public/" $CFG | |
| 80 | + | #sed -i "s/^ rocommunity6 public/# rocommunity6 public/" $CFG | |
| 81 | + | #sed -i "s/agentAddress udp:127/#agentAddress udp:127/" $CFG | |
| 82 | 82 | ||
| 83 | 83 | ## fix our xen modification | |
| 84 | 84 | #rm -rf /etc/grub.d/09_linux_xen | |
| @@ -104,10 +104,10 @@ cat >> $CFG <<EOF | |||
| 104 | 104 | ||
| 105 | 105 | EOF | |
| 106 | 106 | ||
| 107 | - | # randomize crontab | |
| 108 | - | if [ -f /etc/crontab.dpkg-new ]; then CFG=/etc/crontab.dpkg-new; else CFG=/etc/crontab; fi | |
| 109 | - | sed -i 's#root cd#root perl -e "sleep int(rand(300))" \&\& cd#' $CFG | |
| 110 | - | sed -i 's#root\ttest#root\tperl -e "sleep int(rand(3600))" \&\& test#' $CFG | |
| 107 | + | ## randomize crontab | |
| 108 | + | #if [ -f /etc/crontab.dpkg-new ]; then CFG=/etc/crontab.dpkg-new; else CFG=/etc/crontab; fi | |
| 109 | + | #sed -i 's#root cd#root perl -e "sleep int(rand(300))" \&\& cd#' $CFG | |
| 110 | + | #sed -i 's#root\ttest#root\tperl -e "sleep int(rand(3600))" \&\& test#' $CFG | |
| 111 | 111 | ||
| 112 | 112 | ## phpmyadmin | |
| 113 | 113 | #if [ -f /etc/phpmyadmin/config.inc.php.dpkg-new ]; then CFG=/etc/phpmyadmin/config.inc.php.dpkg-new; \ | |
| @@ -120,7 +120,7 @@ sed -i 's#root\ttest#root\tperl -e "sleep int(rand(3600))" \&\& test#' $CFG | |||
| 120 | 120 | systemctl enable shorewall | |
| 121 | 121 | ||
| 122 | 122 | # full-upgrade | |
| 123 | - | aptitude full-upgrade | |
| 123 | + | apt-get dist-upgrade | |
| 124 | 124 | ||
| 125 | 125 | # Upgrade postgres | |
| 126 | 126 | # See also https://www.debian.org/releases/stretch/amd64/release-notes/ch-information.de.html#plperl | |
Jan Wagner revised this gist 9 years ago · ac4647d
1 file changed, 16 insertions
| @@ -88,6 +88,22 @@ sed -i "s/agentAddress udp:127/#agentAddress udp:127/" $CFG | |||
| 88 | 88 | if [ -f /etc/chrony/chrony.conf.new ]; then CFG=/etc/chrony/chrony.conf.new; else CFG=/etc/chrony/chrony.conf; fi | |
| 89 | 89 | sed -i s/2.debian.pool/0.de.pool/g $CFG | |
| 90 | 90 | ||
| 91 | + | # migrate unattended-upgrades config | |
| 92 | + | if [ -f /etc/apt/apt.conf.d/50unattended-upgrades.dpkg-new ]; then CFG=/etc/apt/apt.conf.d/50unattended-upgrades.dpkg-new; \ | |
| 93 | + | else CFG=/etc/apt/apt.conf.d/50unattended-upgrades; fi | |
| 94 | + | sed -i s/jessie/stretch/g $CFG | |
| 95 | + | sed -i s/crontrib/contrib/g $CFG | |
| 96 | + | sed -i "s#// If automatic reboot is enabled and needed, reboot at the specific#// Automatically reboot even if there are users currently logged in.\n//Unattended-Upgrade::Automatic-Reboot-WithUsers \"true\";\n\n// If automatic reboot is enabled and needed, reboot at the specific#" $CFG | |
| 97 | + | cat >> $CFG <<EOF | |
| 98 | + | ||
| 99 | + | // Enable logging to syslog. Default is False | |
| 100 | + | // Unattended-Upgrade::SyslogEnable "false"; | |
| 101 | + | ||
| 102 | + | // Specify syslog facility. Default is daemon | |
| 103 | + | // Unattended-Upgrade::SyslogFacility "daemon"; | |
| 104 | + | ||
| 105 | + | EOF | |
| 106 | + | ||
| 91 | 107 | # randomize crontab | |
| 92 | 108 | if [ -f /etc/crontab.dpkg-new ]; then CFG=/etc/crontab.dpkg-new; else CFG=/etc/crontab; fi | |
| 93 | 109 | sed -i 's#root cd#root perl -e "sleep int(rand(300))" \&\& cd#' $CFG | |
Jan Wagner revised this gist 9 years ago · 7995555
1 file changed, 1 insertion, 1 deletion
| @@ -86,7 +86,7 @@ sed -i "s/agentAddress udp:127/#agentAddress udp:127/" $CFG | |||
| 86 | 86 | ||
| 87 | 87 | # chrony update | |
| 88 | 88 | if [ -f /etc/chrony/chrony.conf.new ]; then CFG=/etc/chrony/chrony.conf.new; else CFG=/etc/chrony/chrony.conf; fi | |
| 89 | - | sed -i s/debian.pool/de.pool/g $CFG | |
| 89 | + | sed -i s/2.debian.pool/0.de.pool/g $CFG | |
| 90 | 90 | ||
| 91 | 91 | # randomize crontab | |
| 92 | 92 | if [ -f /etc/crontab.dpkg-new ]; then CFG=/etc/crontab.dpkg-new; else CFG=/etc/crontab; fi | |
Jan Wagner revised this gist 9 years ago · 0796bf3
1 file changed, 4 insertions
| @@ -10,6 +10,10 @@ rm -rf /etc/network/options /etc/environment | |||
| 10 | 10 | # migrate over to systemd (before the upgrade) | |
| 11 | 11 | aptitude install systemd | |
| 12 | 12 | ||
| 13 | + | # Disable loading defaults.vim | |
| 14 | + | echo '" disable the loading of defaults.vim' >> /etc/vim/vimrc.local | |
| 15 | + | echo "let g:skip_defaults_vim = 1" >> /etc/vim/vimrc.local | |
| 16 | + | ||
| 13 | 17 | # are there 3rd party packages installed? (https://www.debian.org/releases/stretch/amd64/release-notes/ch-upgrading.de.html#system-status) | |
| 14 | 18 | aptitude search '~i(!~ODebian)' | |
| 15 | 19 | ||
Jan Wagner revised this gist 9 years ago · a3228e2
1 file changed, 1 insertion, 1 deletion
| @@ -14,7 +14,7 @@ aptitude install systemd | |||
| 14 | 14 | aptitude search '~i(!~ODebian)' | |
| 15 | 15 | ||
| 16 | 16 | # check for ftp protocol in sources lists (https://www.debian.org/releases/stretch/amd64/release-notes/ch-information.en.html#deprecation-of-ftp-apt-mirrors) | |
| 17 | - | grep --color "deb ftp" /etc/apt/sources.list* | |
| 17 | + | rgrep --color "deb ftp" /etc/apt/sources.list* | |
| 18 | 18 | ||
| 19 | 19 | # Transition and remove entries from older releases | |
| 20 | 20 | sed -i /etch/d /etc/apt/sources.list* | |
Jan Wagner revised this gist 9 years ago · 454647b
1 file changed, 13 insertions, 7 deletions
| @@ -6,7 +6,16 @@ dpkg-reconfigure locales | |||
| 6 | 6 | ||
| 7 | 7 | # remove unused config file | |
| 8 | 8 | rm -rf /etc/network/options /etc/environment | |
| 9 | - | ||
| 9 | + | ||
| 10 | + | # migrate over to systemd (before the upgrade) | |
| 11 | + | aptitude install systemd | |
| 12 | + | ||
| 13 | + | # are there 3rd party packages installed? (https://www.debian.org/releases/stretch/amd64/release-notes/ch-upgrading.de.html#system-status) | |
| 14 | + | aptitude search '~i(!~ODebian)' | |
| 15 | + | ||
| 16 | + | # check for ftp protocol in sources lists (https://www.debian.org/releases/stretch/amd64/release-notes/ch-information.en.html#deprecation-of-ftp-apt-mirrors) | |
| 17 | + | grep --color "deb ftp" /etc/apt/sources.list* | |
| 18 | + | ||
| 10 | 19 | # Transition and remove entries from older releases | |
| 11 | 20 | sed -i /etch/d /etc/apt/sources.list* | |
| 12 | 21 | sed -i /lenny/d /etc/apt/sources.list* | |
| @@ -29,9 +38,8 @@ aptitude search "~ahold" | grep "^.h" | |||
| 29 | 38 | dpkg --get-selections | grep hold | |
| 30 | 39 | ||
| 31 | 40 | # unmark packages auto | |
| 32 | - | aptitude unmarkauto vim | |
| 41 | + | aptitude unmarkauto vim net-tools | |
| 33 | 42 | aptitude unmarkauto monitoring-plugins-standard monitoring-plugins-common monitoring-plugins-basic | |
| 34 | - | aptitude unmarkauto open-vm-tools-dkms ifenslave | |
| 35 | 43 | aptitude unmarkauto $(dpkg-query -W 'linux-image-3.16*' | cut -f1) | |
| 36 | 44 | ||
| 37 | 45 | # have a look into required and free disk space | |
| @@ -51,9 +59,6 @@ EOF | |||
| 51 | 59 | # update aptitude first | |
| 52 | 60 | [ "$(which aptitude)" = "/usr/bin/aptitude" ] && aptitude install aptitude | |
| 53 | 61 | ||
| 54 | - | # migrate over to systemd | |
| 55 | - | aptitude install systemd | |
| 56 | - | ||
| 57 | 62 | # minimal system upgrade (keep sysvinit / see http://noone.org/talks/debian-ohne-systemd/debian-ohne-systemd-clt.html#%2811%29) | |
| 58 | 63 | aptitude upgrade | |
| 59 | 64 | ||
| @@ -98,6 +103,7 @@ systemctl enable shorewall | |||
| 98 | 103 | aptitude full-upgrade | |
| 99 | 104 | ||
| 100 | 105 | # Upgrade postgres | |
| 106 | + | # See also https://www.debian.org/releases/stretch/amd64/release-notes/ch-information.de.html#plperl | |
| 101 | 107 | if [ "$(dpkg -l | grep "postgresql-9.4" | awk {'print $2'})" = "postgresql-9.4" ]; then \ | |
| 102 | 108 | aptitude install postgresql-9.6 && \ | |
| 103 | 109 | pg_dropcluster --stop 9.6 main && \ | |
| @@ -123,7 +129,7 @@ dpkg -l | grep -E 'deb6|squeeze' | grep -v xen | awk '{print $2}' | xargs aptitu | |||
| 123 | 129 | dpkg -l | grep -E 'deb7|wheezy' | grep -v xen | grep -v -E 'linux-image|mailscanner|openswan|debian-security-support' | awk '{print $2}' | xargs aptitude -y purge | |
| 124 | 130 | dpkg -l | grep -E 'deb8|jessie' | grep -v xen | grep -v -E 'linux-image|debian-security-support' | awk '{print $2}' | xargs aptitude -y purge | |
| 125 | 131 | aptitude -y install deborphan && deborphan | grep -v xen | grep -v libpam-cracklib | xargs aptitude -y purge | |
| 126 | - | dpkg -l | grep ^r | awk '{print $2}' | xargs aptitude -y purge | |
| 132 | + | apt-get purge $(dpkg -l | awk '/^rc/ { print $2 }') | |
| 127 | 133 | ||
| 128 | 134 | # for the brave YoloOps crowd | |
| 129 | 135 | reboot && sleep 180; echo u > /proc/sysrq-trigger ; sleep 2 ; echo s > /proc/sysrq-trigger ; sleep 2 ; echo b > /proc/sysrq-trigger | |
Jan Wagner revised this gist 9 years ago · a78bbfe
1 file changed, 37 insertions, 86 deletions
Diff is too large to be shown
Jan Wagner revised this gist 9 years ago · 1677519
3 files changed, 28 deletions
File renamed without changes
| @@ -1,11 +0,0 @@ | |||
| 1 | - | # when <Directory > config is applied on / instead of DocumentRoot, we need to fix that | |
| 2 | - | cat > /tmp/a2conf_dir_migrate << EOF | |
| 3 | - | grep -i "<directory />" /etc/apache2/sites-enabled/* | |
| 4 | - | for HOST in \$(grep -i "<directory />" /etc/apache2/sites-enabled/* | grep -v 000-default | awk -F':' '{print \$1}' | sed "s/.conf//" | sed "s#^/etc/apache2/sites-enabled/##"); do | |
| 5 | - | DOCROOT=\$(grep DocumentRoot /etc/apache2/sites-enabled/\${HOST} | awk '{print \$2}'); | |
| 6 | - | sed -i "s#<Directory />#<Directory \${DOCROOT}>#" /etc/apache2/sites-available/\${HOST}; | |
| 7 | - | done | |
| 8 | - | echo -e "Migration done.\nRemaining problematic configurations, please investigate:" | |
| 9 | - | grep -i "<directory />" /etc/apache2/sites-enabled/* | |
| 10 | - | EOF | |
| 11 | - | sh /tmp/a2conf_dir_migrate | |
| @@ -1,17 +0,0 @@ | |||
| 1 | - | # Migrating the Apache config files into new places and naming scheme | |
| 2 | - | ||
| 3 | - | see https://gist.github.com/waja/86a3a055c1fedfba3c58#file-wheezy2jessie-sh | |
| 4 | - | ||
| 5 | - | # Upstream changes | |
| 6 | - | ||
| 7 | - | * [Order](http://httpd.apache.org/docs/2.4/mod/mod_access_compat.html#order), [Allow](http://httpd.apache.org/docs/2.4/mod/mod_access_compat.html#allow), [Deny](http://httpd.apache.org/docs/2.4/mod/mod_access_compat.html#deny) and [Satisfy](http://httpd.apache.org/docs/2.4/mod/mod_access_compat.html#satisfy) are obsolete, you should read [Run-Time Configuration Changes](http://httpd.apache.org/docs/2.4/upgrading.html#run-time) or [Beyond just authorization](http://httpd.apache.org/docs/2.4/howto/auth.html#beyond) | |
| 8 | - | * Mixing [Options](http://httpd.apache.org/docs/current/mod/core.html#options) with a + or - with those without is not valid syntax, and will be rejected during server startup by the syntax check with an abort. | |
| 9 | - | * Certificate handleing has changed, obsoletes [SSLCertificateChainFile](http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslcertificatechainfile), please use [SSLCertificateFile](http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslcertificatefile), it may also include intermediate CA certificates, sorted from leaf to root now | |
| 10 | - | * Several other changes can be found in the [Upgrading to 2.4 from 2.2](http://httpd.apache.org/docs/2.4/upgrading.html) documentation | |
| 11 | - | ||
| 12 | - | ||
| 13 | - | # Some more other handy resources | |
| 14 | - | ||
| 15 | - | https://www.digitalocean.com/community/tutorials/migrating-your-apache-configuration-from-2-2-to-2-4-syntax | |
| 16 | - | https://www.linode.com/docs/security/upgrading/updating-virtual-host-settings-from-apache-2-2-to-apache-2-4 | |
| 17 | - | http://linoxide.com/linux-how-to/apache-migration-2-2-to-2-4-ubuntu-14-04/ | |