QMT Wiki and Migrate: Difference between pages

From QmailToaster
(Difference between pages)
Jump to navigation Jump to search
No edit summary
 
No edit summary
 
Line 1: Line 1:
  '''On old machine'''
  '''On destination host'''
  '''''Backup old QMT Wiki'''''
  Install Rocky [[Rocky,_Alma,_Springdale_8_QT_Install|8]] or [[Rocky,_Alma,_Springdale_9_QT_Install|9]]
  # /usr/bin/mysqldump -uqmtwikiuser -pqmtwikipass -hlocalhost qmtwiki --single-transaction  > qmtwiki.sql
  qmailctl stop && systemctl stop dovecot


  '''On new machine'''
  '''On source host'''
  '''''If Apache, MySQL, PHP are not installed'''''
dhost=192.168.1.3 <span style="color:red">(change to suit)</span>
  # yum -y update
ssh-keygen
# yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
ssh-copy-id $dhost
  # yum -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
ssh $dhost<br>
  # yum-config-manager --disable 'remi-php*'
  '''''The first rsync migrates the bulk of the email database except those queued during sync'''''
  # yum-config-manager --enable remi-php81
  rsync --progress -zv -are ssh /home/vpopmail/domains/ root@$dhost:/home/vpopmail/domains
  # yum -y install php php-{mysql,pdo,gd,intl,cli,fpm,mysqlnd,zip,devel,gd,mbstring,curl,xml,pear,bcmath,json,opcache,redis,memcache}\
 
                texlive
qmailctl stop && systemctl stop dovecot
  # yum -y install mysql mysql-server httpd
 
# systemctl enable --now mysqld httpd
mysqldump -u root -p vpopmail > vpopmail.sql
# mysql_secure_installation
  scp vpopmail.sql root@$dhost:/root
# tee /root/sql.cnf<<EOF
 
[client]
  # The second rsync, services stopped, migrates the balance of the email database
user=root
  # and control files
password='mypass'
rsync --progress -zv -are ssh /home/vpopmail/domains/ root@$dhost:/home/vpopmail/domains
host=localhost
  rsync --progress -zv -are ssh /var/qmail/control/ root@$dhost:/var/qmail/control
EOF<br>
  rsync --progress -zv -are ssh /var/qmail/users/ root@$dhost:/var/qmail/users
'''''Download latest MediaWiki'''''
  rsync --progress -zv -are ssh /etc/tcprules.d/ root@$dhost:/etc/tcprules.d
# cd /var/www
  rsync --progress -zv -are ssh /etc/dovecot/toaster.conf root@$dhost:/etc/dovecot
  # wget https://releases.wikimedia.org/mediawiki/1.41/mediawiki-1.41.0.tar.gz
  rsync --progress -zv -are ssh /etc/dovecot/local.conf root@$dhost:/etc/dovecot
  # tar zxvf mediawiki-1.41.0.tar.gz
 
# chown apache:apache mediawiki-1.41.0
  # Not necessary to the migration
# ln -s mediawiki-1.41.0 wiki.qmailtoaster.org
  rsync --progress -zv -are ssh /usr/share/toaster/include/admin.pass root@$dhost:/usr/share/toaster/include
# cd wiki.qmailtoaster.org/extensions
  rsync --progress -zv -are ssh /usr/share/toaster/include/admin.htpasswd  root@$dhost:/usr/share/toaster/include
# git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Tabs
  rsync --progress -zv -are ssh /usr/share/squirrelmail/plugins/ root@$dhost:/usr/share/squirrelmail/plugins
  # git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/HeaderTabs
  rsync --progress -zv -are ssh /etc/spamassassin/.spamassassin/  root@$dhost:/etc/spamassassin/.spamassassin
  # chown apache:apache Tabs HeaderTabs<br>
  rsync --progress -zv -are ssh /etc/spamassassin/local.cf root@$dhost:/etc/spamassassin
  '''''Create MySQL DB, restore old database (last step) if upgrading...skip restore if this is a new wiki'''''<br>
rsync --progress -zv -are ssh /var/lib/squirrelmail/prefs/ root@$dhost:/var/lib/squirrelmail/prefs
  # credfile=/root/sql.cnf
 
  # mysqladmin --defaults-extra-file=$credfile create qmtwiki
On destination host
  # mysql --defaults-extra-file=$credfile -e "CREATE USER qmtwikiuser@localhost IDENTIFIED BY 'qmtwikipass'"
mysql -u root -p vpopmail < vpopmail.sql
  # mysql --defaults-extra-file=$credfile -e "GRANT ALL PRIVILEGES ON qmtwiki.* TO qmtwikiuser@localhost"
  qmailctl cdb && qmailctl start && sleep 2s && systemctl start dovecot && toaststat
  # mysql -u root -p qmtwiki < qmtwiki.sql (Provide by Eric)<br>
 
'''''Configure Apache'''''<br>
 
# tee /etc/httpd/sites-available/wiki.mydomain.com.conf<<EOF
  Questions, comments, suggestions, corrections...contact Eric on the QMT list
  <VirtualHost *:80>
    ServerName wiki.qmailtoaster.org
    DocumentRoot /var/www/wiki.qmailtoaster.org
    <IfModule dir_module>
        DirectoryIndex index.php
    </IfModule>
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    ErrorLog /var/log/httpd/wiki.qmailtoaster.org-error.log
    LogLevel debug
    CustomLog /var/log/httpd/wiki.qmailtoaster.org-access.log combined
  </VirtualHost>
EOF<br>
  '''''Configure new, or upgrade old, wiki, and use db parameters specified above when prompted'''''<br>
# cd /var/www/wiki.qmailtoaster.org
# wget LocalSettings.php (Provide by Eric)<br>
Redirect DNS to point to your server
# http://wiki.qmailtoaster.org/

Revision as of 19:22, 29 March 2024

On destination host
Install Rocky 8 or 9
qmailctl stop && systemctl stop dovecot
On source host
dhost=192.168.1.3 (change to suit)
ssh-keygen
ssh-copy-id $dhost
ssh $dhost
The first rsync migrates the bulk of the email database except those queued during sync rsync --progress -zv -are ssh /home/vpopmail/domains/ root@$dhost:/home/vpopmail/domains
qmailctl stop && systemctl stop dovecot
mysqldump -u root -p vpopmail > vpopmail.sql
scp vpopmail.sql root@$dhost:/root
# The second rsync, services stopped, migrates the balance of the email database 
# and control files
rsync --progress -zv -are ssh /home/vpopmail/domains/ root@$dhost:/home/vpopmail/domains
rsync --progress -zv -are ssh /var/qmail/control/ root@$dhost:/var/qmail/control
rsync --progress -zv -are ssh /var/qmail/users/ root@$dhost:/var/qmail/users
rsync --progress -zv -are ssh /etc/tcprules.d/ root@$dhost:/etc/tcprules.d
rsync --progress -zv -are ssh /etc/dovecot/toaster.conf root@$dhost:/etc/dovecot
rsync --progress -zv -are ssh /etc/dovecot/local.conf root@$dhost:/etc/dovecot
# Not necessary to the migration
rsync --progress -zv -are ssh /usr/share/toaster/include/admin.pass  root@$dhost:/usr/share/toaster/include
rsync --progress -zv -are ssh /usr/share/toaster/include/admin.htpasswd  root@$dhost:/usr/share/toaster/include
rsync --progress -zv -are ssh /usr/share/squirrelmail/plugins/ root@$dhost:/usr/share/squirrelmail/plugins
rsync --progress -zv -are ssh /etc/spamassassin/.spamassassin/  root@$dhost:/etc/spamassassin/.spamassassin
rsync --progress -zv -are ssh /etc/spamassassin/local.cf  root@$dhost:/etc/spamassassin
rsync --progress -zv -are ssh /var/lib/squirrelmail/prefs/  root@$dhost:/var/lib/squirrelmail/prefs
On destination host
mysql -u root -p vpopmail < vpopmail.sql
qmailctl cdb && qmailctl start && sleep 2s && systemctl start dovecot && toaststat


Questions, comments, suggestions, corrections...contact Eric on the QMT list