Reinstalling Multisite WordPress

Warning: Draft Only, still work on this !!!

There are 5 level in reinstalling multisite WordPress server:

  1. Overwrite new WordPress files, maintain database and all content.
    This usually required when WordPress failed to upgrade to a new version.
  2. Erase all files and database, then restore last known good full backup.
    This usually required when WordPress installation suddenly broken.
  3. Erase all files and database, install new vanilla Wordpress, then restore per site backup.
    This usually required when some multisite installation is broken or no full backup available.
  4. New server IP, erase all files and database, then restore last known good full backup.
    This usually required upon host migration to a new server.
  5. New server IP, new primary server domain, erase all files and database, install new vanilla Wordpress, then restore per site backup.
    This usually required upon host migration with domain change to reduce downtime, or dealing with attacks.

 

Erasing all files and database and restore last known good backup.

  1. Make Sure Backup Available
    Create Full Server Database and File WordPress Backup, or
    Check the existing backup.
  2. Create SSL Backup
  3. Do Clean-upMake sure the old WordPress folder and database has no important data and could be erased safely.

    Find out old WordPress installation database name and user name.

    egrep -w 'DB_USER|DB_NAME' /var/www/wordpress/wp-config.php

    If you don’t want to change database name and password:

    mysql -u root -p
       show database; // find wpdatabasename
       drop database wpdatabasename; 
       create database wpdatabasename;
       select user,host from mysql.user; // make sure the username exist
       flush privileges; // check privileges exists
       show grants for "notwordpress";
       show grants for "notwordpress"@"localhost";
       exit

    If you want to make new name and password:

    Write down WordPress oldwpdatabasename and oldwpusername.
    Erase that old database and user.

    mysql -u root -p
      show databases; // make sure the database exist
      drop database oldwpdatabasename;
      select user,host from mysql.user; // make sure the username exist
      drop user "notwordpress"@"%";
      drop user "notwordpress"@"localhost";
      show grants; // make sure there is no grant for user notwordpress;

    Create new database and user:

      create database newnotwordpress;
      create user newnotwordpress; 
      set password for newnotwordpress = password("MyNewNotSoSecretWordpressDBKey");
      use database newnotwordpress;
      grant all privileges on newnotwordpress.* to "newnotwordpress"@"localhost" identified by "MyNotSoSecretWordpressDBKey"; 
      flush privileges;
      show grants for "newnotwordpress";
      show grants for "newnotwordpress"@"localhost";
      exit
  4. Erase wordpress installation files
    rm ~/latest.tar.gz 
    sudo rm -r /var/www/wordpress
    

     

  5. Reinstall WordPress
    cd ~
    wget -c http://wordpress.org/latest.tar.gz
    tar -zxvf latest.tar.gz
    sudo mv ~/wordpress /var/www
    touch /var/www/wordpress/nginx.conf
    mkdir /var/www/wordpress/.well-known
    ps -ef | grep "nginx: worker process"
    sudo chown -R www-data:www-data /var/www/wordpress
    sudo chmod -R 755 /var/www/wordpress
    sudo rm -f /var/cache/ngx_pagespeed
  6. Install WordPress

    cat ~/wpsettings/wordpress/wp-config.php | grep
    Select the password from Bitvise console to copy
    Run the WordPress initial browser setup
    sudo cp ~/wpsettings/wordpress/wp-config.php /var/www/wordpress
    Paste the password
    Login to Single-Site WordPress

  7. Setup Multisite

    Enable multi-site, activate lines:
    sudo nano /var/www/wordpress/wp-config.php

  8. Install Multi-domain Feature (sunrise)

    Plugins – Add New: MU Domain Mapping
    Install – Network Activate

    Enable multi-domain, activate lines:
    sudo nano /var/www/wordpress/wp-config.php
    (define SUNRISE, ‘on’);

    sudo cp /var/www/wordpress/wp-content/plugins/MU_Domain_Mapping/sunrise.php /var/www/wordpress/wp-content

  9. Restore WordPress Backup
  10. Restore SSL Backup

 

Advertisements

2 thoughts on “Reinstalling Multisite WordPress”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s