Changes

From SME Server
Jump to navigationJump to search
10,076 bytes added ,  19:09, 27 June 2021
Created page with "{{Languages|Migratehelper}} <!-- here we define the contrib name variable --> <!-- we get the page title, remove suffix for translated version; if needed you can define there..."
{{Languages|Migratehelper}}

<!-- here we define the contrib name variable -->
<!-- we get the page title, remove suffix for translated version; if needed you can define there with the value you want-->
{{#vardefine:contribname| {{lc: {{#titleparts: {{BASEPAGENAME}} |1}} }} }}
{{#vardefine:smecontribname| smeserver-{{lc: {{#titleparts: {{BASEPAGENAME}} |1}} }} }}
<!-- we define the language -->
{{#vardefine:lang| {{lc: {{#titleparts: {{PAGENAME}} | | -1}} }} |en }}
{{Infobox contribs
|name={{#var:contribname}}
|image={{#var:contribname}}.jpg
|description_image= {{#var:contribname}} logo
|maintainer= [[User:Unnilennium|Jean-Philippe Pialasse]]
|licence= GPL
|url= https://wiki.contribs.org
|category= Category you want
|tags=backup, restore, contribs
}}

===Maintainer===
<!-- here you need to file your username and name -->
[[User:Unnilennium|Jean-Philippe Pialasse]]

=== Version ===
<!-- keep this first element as is, you can add some if needed -->
{{#smeversion: {{#var:smecontribname}} }}

=== Description ===
Il s'agit d'une suite de scripts destinée à faciliter la sauvegarde et la restauration lors de la migration vers une autre machine avec la même version de Koozali SME ou plus récente.

Elle créera une archive similaire à la sauvegarde USB de la console, permettant ainsi la restauration de la console au démarrage directement après l'installation.

Il sauvegardera tous les emplacements déjà connus par les scripts pour chaque contribution installée.

Il sauvegardera également un espace utilisateur connu pour contenir des fichiers potentiellement ajoutés manuellement.

Il créera une liste des rpm actuellement installés et les décomposera pour faciliter l'installation plus tard.

Un WIP consistera à télécharger les rpms depuis les repos pour permettre une réinstallation rapide. Un script sera utilisé ultérieurement pour permettre le téléchargement à partir d'une version plus récente.

Il existe également une liste d'exclusion. Par défaut, /home/e-smith/files se trouve dans cette liste d'exclusion. Vous pouvez donc avoir une sauvegarde du serveur et une restauration plus rapide. Cela suppose que vous sauvegardez ces fichiers séparément et que vous les restaurez manuellement plus tard (ou les avoir sur un point de montage séparé, vous pouvez facilement remonter ce dernier), car le serveur peut démarrer sans eux lors de l'installation.


=== Installation ===

<tabs container><tab name="For SME 10">
yum --enablerepo=smecontribs install {{#var:smecontribname}}
</tab>
<tab name="For SME 9">
wget https://viewvc.koozali.org/smecontribs/rpms/smeserver-migratehelper/contribs10/migratehelper.sh -O /usr/bin/migratehelper.sh
</tab>
</tabs>

=== Usage and behaviour ===
You must first create the mount point and mount your external disk already formatted and with sufficient place to receive the archive:<syntaxhighlight lang="bash">
mkdir /mnt/backup
mount /dev/mydisk /mnt/backup
</syntaxhighlight>

You can then edit the script and Add you directories or files to include in the '''dir.list''' section, your exclusion in '''exclude.list''' section. Then check all your contribs are listed, and the associated destination are correct.<syntaxhighlight lang="bash">
vim /usr/bin/migratehelper.sh
</syntaxhighlight>

Then run the script
{{Warning box|When starting this script :
it will create the list of files to backup, then it will stop services that could modify your backup
*qmail.service
*qpsmtpd.service
*sqpsmtpd.service
*ejabberd.service
*smb.service
*smbd.service
*nmbd.service
*httpd-e-smith.service

Do a pre-backup event and
then create the tar file in /mnt/backup/smeserver.tgz
}}
<syntaxhighlight lang="bash">
/usr/bin/migratehelper.sh
</syntaxhighlight>

It will then process all the files to backup and display the progress on screen. After creating the definitive list depending on installed rpms, it will then Create a list of rpm installed and breakdown them in two easy to restore lists :
{| class="wikitable"
!files
!description
|-
|/root/newrpms
|output of /sbin/e-smith/auditiools/newrpms
|-
|/root/contribs
|previous output filtered for smeserver-* rpms
|-
|/root/rpmsextra
|all other non base distro rpms.
|}

==== Default backup list ====
'''note : we are excluding /home/e-smith/{files,shares} and /home/e-smith/db/mysql*/{daily,hourly}'''
<syntaxhighlight lang="bash">
/etc/e-smith/templates-custom
/etc/e-smith/templates-user-custom
/etc/group
/etc/gshadow
/etc/passwd
/etc/samba/secrets.tdb
/etc/samba/smbpasswd
/etc/shadow
/etc/smbpasswd
/etc/ssh
/etc/sudoers
/root
/home/e-smith/Maildir
/home/e-smith/home
/home/e-smith/ssl.crt
/home/e-smith/ssl.key
/home/e-smith/dkim_keys
/home/e-smith/db
/var/lib/dhcpd/dhcpd.leases
/var/log/qpsmtpd
/var/log/sqpsmtpd
/var/log/qmail
/var/log/httpd/
/var/log/dovecot/
/var/log/squid
/var/log/iptables/
/var/spool/mail/
/var/spool/spamd/
/var/log/samba/samba_audit
/var/service/qpsmtpd/config/dkimkeys/
</syntaxhighlight>


also we add any non rpm owned files in
/usr/local/bin/
/etc/cron.*
/etc/udev/rules.d/

==== Default exclusions ====
{{Warning box|When starting this script :
'''/home/e-smith/files
/home/e-smith/shares'''
are '''EXCLUDED''' by default, because we expect a huge amount of user data that you could rsync later after having your new server up and running, and kept the old one up.
This will allow you to be up and running faster than waiting to gzip gigabyte of data, transfer them and ungzip them.
}}
<syntaxhighlight lang="bash">
/home/e-smith/db/mysql/daily
/home/e-smith/db/mysql/hourly
/home/e-smith/db/mysql55/daily
/home/e-smith/db/mysql55/hourly
/home/e-smith/db/mysql57/daily
/home/e-smith/db/mysql57/hourly
/home/e-smith/files
/home/e-smith/shares
/etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/20LoadModule80PHP
/etc/e-smith/templates-custom/etc/hosts.allow/sshd
/etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/35SSL00Listen443
/etc/e-smith/templates-custom/etc/dhcpd.conf/25DomainNameServers
/etc/e-smith/templates-custom/etc/dhcpd.conf/25LeaseTimeDefault
/etc/e-smith/templates-custom/etc/dhcpd.conf/25LeaseTimeMax
/etc/e-smith/templates-custom/etc/dhcpd.conf/25Routers
</syntaxhighlight>

==== Supported contribs ====
this is a list of currently configured and known contribs to save in the process. Please be aware that it is not exhaustive. Check if your is in there, and '''check that all the needed files are indeed included'''.
<syntaxhighlight lang="bash">
smeserver-awstats
smeserver-BackupPC4
smeserver-BackupPC
smeserver-bandwidthd
smeserver-clamav-unofficial-sigs
smeserver-dansguardian
smeserver-dansguardian
smeserver-dansguardian-panel
smeserver-denyhosts
smeserver-dl
dokuwiki
smeserver-durep
smeserver-ezmlm-web
smeserver-freepbx
smeserver-fail2ban
smeserver-grr
ipasserelle-im
smeserver-isoqlog
smeserver-jappix
smeserver-lemonldap-ng
smeserver-letsencrypt
smeserver-limesurvey
ipasserelle-listes
smeserver-madsonic
smeserver-mailman
smeserver-nextcloud
smeserver-ntop
smeserver-openvpn-bridge
smeserver-openvpn-routed
smeserver-openvpn-s2s
phpki
phpki-ng
smeserver-phpki
smeserver-phpki-ng
pydio
smeserver-sarg
smeserver-sme8admin
smeserver-sme9admin
smeserver-sysmon
smeserver-tftp-server
smeserver-transmission
smeserver-unifi
smeserver-xt_geoip
smeserver-webfilter
smeserver-webshares
smeserver-zabbix-agent
smeserver-zabbix-proxy
smeserver-zabbix-server
smeserver-zoneminder
</syntaxhighlight>


Contribs known that does not need any file backup
#smeserver-bridge-interface
#smeserver-ddclient
#smeserver-email-management
#smeserver-geoip
#smeserver-kronolith
#smeserver-lazy_admin_tools
#smeserver-learn
#smeserver-mailsorting
#smeserver-mailstats
#smeserver-mediatomb
#smeserver-mod_dav
#smeserver-nag
#smeserver-php-fpm
#smeserver-php-scl
#smeserver-phpldapadmin.
#smeserver-phpsysinfo
#smeserver-qmHandle
#smeserver-remoteuseraccess
#smeserver-sane
#smeserver-usbdisksmanager
#smeserver-userpanel
#smeserver-userpanels
#smeserver-vacation
#smeserver-wbl
#smeserver-webapps-common
#smeserver-webhosting

=== Restore ===
First step will be to simply use the console restore with the obtained smeserver.tgz. We expect you handle the transfer either using a USB disk, or by having used sshfs and already mounted one extra partition of your new server to your old to create you archive on.

Second use the configuration console to fixe any changes needed on network card or IP, domain name...

Third you can use the saved list of rpm to try to install your contribs and other missing things

yum install --enablerepo=smecontribs `cat /root/contribs`
yum install --enablerepo=smecontribs `cat /root/rpmsextra`
You can also enable the needed repo depending on what you would have : epel, fws, ....

Fourth, you can start a rsync for the missing bits
rsync -arv root@oldsme:/home/e-smith/files/ibays/ /home/e-smith/files/ibays
rsync -arv root@oldsme:/home/e-smith/files/shares/ /home/e-smith/files/shares
rsync -arv root@oldsme:/home/e-smith/files/users/ /home/e-smith/files/users
rsync -arv root@oldsme:/home/e-smith/files/nextcloud home/e-smith/files/nextcloud
or simply
rsync -arv root@oldsme:/home/e-smith/files/ /home/e-smith/files
Some might enjoy to get back their old log too

then you should be good to enjoy your new server....

=== Uninstall ===
yum remove {{#var:smecontribname}}

=== Bugs ===
Please raise bugs under the SME-Contribs section in [http://bugs.contribs.org/enter_bug.cgi bugzilla]
and select the {{#var:smecontribname}} component or use {{BugzillaFileBug|product=SME%20Contribs|component={{#var:smecontribname}}|title=this link}}

Below is an overview of the current issues for this contrib:{{#bugzilla:columns=id,product,version,status,summary|sort=id|order=desc|component={{#var:smecontribname}} |noresultsmessage=No open bugs found.}}

===Changelog===
Only released version in smecontrib are listed here.

{{#smechangelog: {{#var:smecontribname}} }}


<!-- list of category you want to see this page in -->
[[Category: Contrib]]
<!-- Please keep there the template revision number as is -->
3,054

edits

Navigation menu