Debian 8(Jessie)’den Debian 9(Stretch) yükseltme nasıl yapılır?
SSH tabanlı oturumda komut satırı kullanarak Debian 8 (Jessie) sistemimi Debian 9’a (Stretch) nasıl yükseltebilirim?
Debian 8’den Debian 9’a ssh üzerinden yükseltmek mümkün mü? Bu eğitimde, komut satırı kullanarak Debian 8 Jessie Linux’tan Debian 9 Stretch’e nasıl yükseltileceği gösterilmektedir.
Lütfen Debian 9’un önemli değişiklikler yaptığını ve veri formatlarındaki değişiklikler nedeniyle veri bozulması da dahil olmak üzere yükseltme başarısız olabileceğini lütfen unutmayın.
Debianın yükseltme esnasında dikkat edilmesi gereken hususları mutlaka okuyun.
1.ADIM:Sunucuda önemli verileri yedekle
- rsnapshot
- rsync
- ssh client and ssh-keys
- 2nd hard disk ( RAID array is suggested) –birincil sabitdiskinizi kullanabilirsiniz.
- Password less login configured using ssh keys
- /disk1/backup – Backup directory
- /disk1/backup/server1 – Backup dizini uzak sunucuda server1 olarak adlandırılacaktır.
- /disk1/backup/server2 – Backup dizini uzak sunucuda server2 olarak adlandırılacaktır.
- /disk1/backup/localhost – Backup dizini yerel sunucuda localhost olarak adlandırılacaktır.
Uzak sunucuda gerekli yazılım
- OpenSSH sshd server
- Şifresiz ayarlanmış ssh keys
a)rsnapshot ve rsync yazılımları yüklenir.
b)Şifresiz giriş için genel anahtarı ile oturum açmayı yapılandır.
# ssh-keygen -t rsa
# ssh-copy-id -i $HOME/.ssh/id_rsa.pub root@remotebox1.server.com:.ssh/authorized_keys2
##[*** or use scp command instead of ssh-copy-id ***]##
# scp .ssh/id_rsa.pub root@remotebox1.server.com:.ssh/authorized_keys2
c)rsnapshot ayarları
snapshot_root /disk1/backup/
Snapshot_root ve / disk1 / ‘ı bir [tab] tuşuyla ayırmanız gerektiğini unutmayın, yani snapshot_root [tab] tuşuna bir kez basın ve / disk1 / backup / yazın. Tüm anlık görüntüler bu kök dizininde (/ disk1 / backup /) saklanır.
d) Yedekleme ilkesini yapılandır.
interval hourly 6 interval daily 7
Konfigürasyonunuzu yedekleme ihtiyaçlarınıza göre uyarlayın.
e)Yerel ve uzaktan yedekleme dizinleri belirtin
############################### ### BACKUP POINTS / SCRIPTS ### ###############################
Varsayılan yedekleme dizinlerini yorumlamanız / silmeniz gerekir. / Home /, / etc /, / webroot / dizinleri için / disk1 / backup / localhost anlık görüntüleri oluşturmak için şunu girin:
backup /home/ localhost/ backup /etc/ localhost/ backup /webroot/ localhost/
Uzak server1 / home /, / etc /, / var / spool / mail /, / webroot / dizinlerini / disk1 / backup / server1 dosyasına yedeklemek için şunu girin:
backup root@remotebox1.server.com:/home/ server1/ backup root@remotebox1.server.com:/etc/ server1/ backup root@remotebox1.server.com:/webroot/ server1/ backup root@remotebox1.server.com:/var/spool/mail/ server1/ backup root@remotebox2.server.com:/home/ server2/
Kaydedin ve kapatın.
f)Yapılandırma dosyanızda hatalar olup olmadığını test edin
# rsnapshot configtest
Çıktı:
Syntax OK
İşlemini görüntülemek için rsnapshot’ı bir test modunda da çalıştırabilirsiniz:
# rsnapshot -t hourly
g)Rsnapshot’ı çalıştırın
# rsnapshot hourly
h)cron job yapılandırma
0 */4 * * * root /usr/bin/rsnapshot hourly 30 3 * * * root /usr/bin/rsnapshot daily 0 3 * * 1 root /usr/bin/rsnapshot weekly 30 2 1 * * root /usr/bin/rsnapshot monthly
i)Dosyaları yedekten nasıl hariç tutabilirim?
Rsnapshot, include ve exclude parametrelerini ayarlamanızı sağlar, etkinleştirilirse, doğrudan rsync’e doğrudan iletilir. Birden fazla içerme / hariç tutma içeriğiniz varsa, bunları ayrı bir satıra koyun.
Örneğin:
exclude_file /etc/rsnapshot.server1.conf
Append dosya listesini /etc/rsnapshot.server1.conf dosyasına ekleyin:
# vi /etc/rsnapshot.server1.conf
İçeriğiniz ile eşleşen dosyaları yedeklemeden hariç tutun:
var/lib/php/session/*
/var/spool/mail/nobody/*
cache/wp-cache-*.????
/var/logs/apache/access.log.*
/var/logs/apache/error.log.*
/linux-kernel/*
/tmp/cache/*
/var/lib/mysql/mysql.sock*
/tmp/php.socket-*
/tmp/*socket*
Kayıtedin ve kapatın.
j)Uzaktaki MySQL veritabanını nasıl yedekleyebilirim?
#!/bin/sh NOW=$(date +"%d-%m-%Y") # set mysql login info MUSER="MySQL-UserNAME" # Username MPASS="MySQL-SERVER-PASSWORD" # Password MHOST="MySQL-SERVER-IP-ADDRESS" # Server Name # guess binary names MYSQL="$(which mysql)" MYSQLDUMP="$(which mysqldump)" GZIP="$(which gzip)" # get all db names DBS="$($MYSQL -u $MUSER -h $MHOST -p$MPASS -Bse 'show databases')" for db in $DBS do FILE=mysql-$db.$NOW-$(date +"%T").gz $MYSQLDUMP -u $MUSER -h $MHOST -p$MPASS $db | $GZIP -9 > $FILE done |
rsync -av *.html user@www-03.example.com:/home/httpd/example/html/ |
# ls -l
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
deb http://httpredir.debian.org/debian jessie main contrib deb http://security.debian.org/ jessie/updates main |
deb http://httpredir.debian.org/debian stretch main contrib deb http://security.debian.org/ stretch/updates main |
Get:1 http://mirrors.kernel.org stretch InRelease [195 kB] Get:2 http://security.debian.org stretch/updates InRelease [62.9 kB] Get:3 http://security.debian.org stretch/updates/main amd64 Packages [1,404 B] Get:4 http://security.debian.org stretch/updates/main Translation-en [1,767 B] Get:5 http://mirrors.kernel.org stretch/contrib Translation-en [45.9 kB] Get:6 http://mirrors.kernel.org stretch/main Translation-en [5,392 kB] Get:7 http://mirrors.kernel.org stretch/main amd64 Packages [7,095 kB] Get:8 http://mirrors.kernel.org stretch/contrib amd64 Packages [50.9 kB] Fetched 12.8 MB in 6s (2,129 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done |
.... sysv-rc sysvinit-utils tar task-english task-ssh-server tasksel tasksel-data tcpd telnet texinfo time traceroute tzdata ucf udev util-linux util-linux-locales vim vim-common vim-runtime vim-tiny w3m wget whiptail whois xauth xdg-user-dirs xkb-data xml-core xz-utils zlib1g 398 upgraded, 139 newly installed, 3 to remove and 0 not upgraded. Need to get 213 MB of archives. After this operation, 335 MB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation. |
Filesystem Size Used Avail Use% Mounted on /dev/sda 21G 1.1G 19G 6% / udev 11M 0 11M 0% /dev tmpfs 210M 4.5M 206M 3% /run tmpfs 525M 0 525M 0% /dev/shm tmpfs 5.3M 0 5.3M 0% /run/lock tmpfs 525M 0 525M 0% /sys/fs/cgroup
Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... The following packages were automatically installed and are no longer required: docutils-common docutils-doc libasprintf0c2 liblcms2-2 libpaper-utils libpaper1 libperl4-corelibs-perl libuuid-perl libwebp5 libwebpdemux1 libwebpmux1 python-docutils python-pil python-pygments python-roman Use 'apt-get autoremove' to remove them. Done The following packages have been kept back: apt apt-listchanges apt-utils aptitude aptitude-common bc bind9-host curl dbus dmsetup dnsutils eject exim4 exim4-base exim4-config exim4-daemon-light file ftp gnupg gnupg-agent gnupg2 ifupdown init init-system-helpers initramfs-tools initscripts iotop iproute2 iptables iputils-ping isc-dhcp-client isc-dhcp-common libarchive-extract-perl libavahi-client3 libc-bin libc6 libcairo2 libclass-c3-xs-perl libcpan-meta-perl libcryptsetup4 libcups2 libcurl3 libcurl3-gnutls libdbus-1-3 libdevmapper1.02.1 libfcgi-perl libfreetype6 libgcc1 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgnutls-openssl27 libgtk2.0-0 libgtk2.0-bin libhtml-parser-perl .... .. The following packages will be upgraded: acl acpi acpi-support-base acpid adduser aptitude-doc-en at base-files base-passwd bash bash-completion bsd-mailx bsdmainutils bsdutils busybox bzip2 ca-certificates console-setup console-setup-linux coreutils cpio cron dash dc debconf debconf-i18n debian-archive-keyring debian-faq debianutils dictionaries-common diffutils discover dmidecode doc-debian docutils-common docutils-doc dpkg e2fslibs e2fsprogs findutils fontconfig fontconfig-config fonts-dejavu-core geoip-database gettext-base gpgv grep groff-base grub-common grub-pc grub-pc-bin grub2-common gzip hicolor-icon-theme host hostname iamerican ibritish ienglish-common info insserv install-info .... .. 283 upgraded, 0 newly installed, 0 to remove and 115 not upgraded. Need to get 69.9 MB of archives. After this operation, 14.8 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://mirrors.kernel.org/debian/ stretch/main base-files amd64 9.9 [67.2 kB] Get:2 http://mirrors.kernel.org/debian/ stretch/main libtinfo5 amd64 6.0+20161126-1 [299 kB] Get:3 http://mirrors.kernel.org/debian/ stretch/main libncurses5 amd64 6.0+20161126-1 [93.4 kB] Get:4 http://mirrors.kernel.org/debian/ stretch/main libncursesw5 amd64 6.0+20161126-1 [115 kB] .... .... .. Get:281 http://mirrors.kernel.org/debian/ stretch/main xdg-user-dirs amd64 0.15-2+b1 [52.2 kB] Get:282 http://mirrors.kernel.org/debian/ stretch/main host all 1:9.10.3.dfsg.P4-12.3 [185 kB] Get:283 http://mirrors.kernel.org/debian/ stretch/main os-prober amd64 1.75 [29.8 kB] Fetched 69.9 MB in 1min 3s (1,104 kB/s) ... ... .. update-alternatives: using /usr/share/docutils/scripts/python2/rst2html4 to provide /usr/bin/rst2html4 (rst2html4) in auto mode update-alternatives: using /usr/share/docutils/scripts/python2/rst2html5 to provide /usr/bin/rst2html5 (rst2html5) in auto mode Setting up tasksel (3.39) ... Setting up task-english (3.39) ... Setting up task-ssh-server (3.39) ... Setting up tasksel-data (3.39) ... Processing triggers for libc-bin (2.19-18+deb8u9) ... Processing triggers for systemd (215-17+deb8u7) ... Processing triggers for ca-certificates (20161130+nmu1) ... Updating certificates in /etc/ssl/certs... 0 added, 0 removed; done. Running hooks in /etc/ca-certificates/update.d... done. Processing triggers for dictionaries-common (1.27.2) ... ispell-autobuildhash: Processing 'american' dict. ispell-autobuildhash: Processing 'british' dict.
Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... The following packages were automatically installed and are no longer required: docutils-common docutils-doc libasprintf0c2 libbind9-90 libdns100 libintl-perl libintl-xs-perl libisc95 libisccc90 libisccfg90 libjasper1 liblcms2-2 liblwres90 .... .. Done The following packages will be REMOVED: libcwidget3 libsigc++-2.0-0c2a perl-modules The following NEW packages will be installed: dh-python dirmngr distro-info-data firmware-linux-free gcc-6-base gnome-icon-theme gnupg-l10n gtk-update-icon-cache initramfs-tools-core irqbalance keyutils libapparmor1 libapt-inst2.0 libapt-pkg5.0 libb-hooks-endofscope-perl libbind9-140 libboost-filesystem1.62.0 libboost-iostreams1.62.0 libboost-system1.62.0 libc-l10n libclass-method-modifiers-perl libclass-xsaccessor-perl libcpan-changes-perl libcroco3 libcwidget3v5 libdata-perl-perl libdevel-caller-perl .... .. The following packages will be upgraded: apt apt-listchanges apt-utils aptitude aptitude-common bc bind9-host curl dbus dmsetup dnsutils eject exim4 exim4-base exim4-config exim4-daemon-light file ftp gnupg gnupg-agent gnupg2 ifupdown init init-system-helpers initramfs-tools initscripts iotop iproute2 iptables iputils-ping isc-dhcp-client isc-dhcp-common libarchive-extract-perl libavahi-client3 libc-bin libc6 libcairo2 libclass-c3-xs-perl libcpan-meta-perl libcryptsetup4 libcups2 libcurl3 libcurl3-gnutls libdbus-1-3 libdevmapper1.02.1 libfcgi-perl libfreetype6 libgcc1 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgnutls-openssl27 libgtk2.0-0 libgtk2.0-bin libhtml-parser-perl libintl-perl libldap-2.4-2 liblocale-gettext-perl libmagic1 libmodule-pluggable-perl libnet-ssleay-perl libparams-util-perl libpod-readme-perl libpython-stdlib libpython2.7-minimal libpython2.7-stdlib librtmp1 libsasl2-2 libsasl2-modules libstdc++6 libsub-name-perl libsystemd0 libtext-charwidth-perl libtext-iconv-perl libtext-soundex-perl libudev1 libuuid-perl libxml-libxml-perl libxml-parser-perl libxml2 linux-image-amd64 locales lsb-release mutt nfs-common openssh-client openssh-server openssh-sftp-server openssl perl perl-base pinentry-gtk2 procps python python-apt python-debianbts python-minimal python-pil python2.7 python2.7-minimal reportbug rsyslog systemd sysv-rc sysvinit-utils telnet texinfo udev util-linux util-linux-locales vim vim-common vim-runtime vim-tiny w3m wget 115 upgraded, 139 newly installed, 3 to remove and 0 not upgraded. Need to get 143 MB of archives. After this operation, 320 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://mirrors.kernel.org/debian/ stretch/main locales all 2.24-11 [3,290 kB] Get:2 http://mirrors.kernel.org/debian/ stretch/main libc-l10n all 2.24-11 [819 kB] Get:3 http://mirrors.kernel.org/debian/ stretch/main libc6 amd64 2.24-11 [2,691 kB] Get:4 http://mirrors.kernel.org/debian/ stretch/main libc-bin amd64 2.24-11 [779 kB] Get:5 http://mirrors.kernel.org/debian/ stretch/main gcc-6-base amd64 6.3.0-18 [180 kB] .... .. ... Get:250 http://mirrors.kernel.org/debian/ stretch/main w3m amd64 0.5.3-34 [1,030 kB] Get:251 http://mirrors.kernel.org/debian/ stretch/main gnupg-l10n all 2.1.18-6 [892 kB] Get:252 http://mirrors.kernel.org/debian/ stretch/main irqbalance amd64 1.1.0-2.3 [40.4 kB] Get:253 http://mirrors.kernel.org/debian/ stretch/main publicsuffix all 20170424.0717-1 [98.2 kB] Get:254 http://mirrors.kernel.org/debian/ stretch/main python-debianbts all 2.6.1 [11.5 kB] Fetched 143 MB in 1min 11s (2,000 kB/s) Reading changelogs... Done apt-listchanges: Mailing root: apt-listchanges: news for localhost Extracting templates from packages: 100% Preconfiguring packages ... Deferring configuration of apt-listchanges until python3 is available (Reading database ... 32357 files and directories currently installed.) Preparing to unpack .../locales_2.24-11_all.deb ... Unpacking locales (2.24-11) over (2.19-18+deb8u9) ... Selecting previously unselected package libc-l10n. Preparing to unpack .../libc-l10n_2.24-11_all.deb ... Unpacking libc-l10n (2.24-11) ... Preparing to unpack .../libc6_2.24-11_amd64.deb ... Checking for services that may need to be restarted... Checking init scripts... Unpacking libc6:amd64 (2.24-11) over (2.19-18+deb8u9) ... Setting up libc6:amd64 (2.24-11) ... Checking for services that may need to be restarted... Checking init scripts...
Linux 4.9.0-3-amd64 x86_64
:No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 9.0 (stretch) Release: 9.0 Codename: stretch