MagicWP Docs

Manual Installation

Complete manual migration guide for advanced users

Manual Installation

For users who require complete control over every aspect of the migration process, this guide provides detailed instructions for manually migrating your WordPress site to MagicWP.

When to Use Manual Migration

Manual migration is recommended when:

  • Full Control Needed: You need complete control over every migration step
  • Complex Configurations: Your site has complex custom configurations
  • Large Scale: Migrating multiple sites or very large sites
  • Custom Requirements: Specific migration requirements not met by automated tools
  • Learning Purposes: Understanding the migration process in detail

Prerequisites

Technical Requirements

  • SSH Access: Command-line access to both source and destination servers
  • Database Access: Direct database access with sufficient privileges
  • File System Access: Ability to read/write files on both servers
  • Development Tools: Familiarity with command-line tools

Source Server Requirements

  • WordPress: Version 4.0 or higher
  • PHP: Version 7.0 or higher with required extensions
  • MySQL: Version 5.6 or higher
  • Shell Access: SSH or similar command-line access

MagicWP Requirements

  • Hosting Account: Active MagicWP hosting account
  • SSH Access: SSH access to MagicWP server
  • Database: MySQL database created in MagicWP
  • Domain: Domain configured for MagicWP hosting

Pre-Migration Preparation

Step 1: Source Site Analysis

  1. Site Inventory

    # Get WordPress version
    wp core version
    
    # List all plugins
    wp plugin list
    
    # List all themes
    wp theme list
    
    # Get site information
    wp site list
  2. Database Analysis

    # Get database size
    wp db size
    
    # List all tables
    wp db tables
    
    # Check for custom tables
    wp db query "SHOW TABLES LIKE 'wp_custom_%'"
  3. File System Analysis

    # Get site size
    du -sh /path/to/wordpress
    
    # Find large files
    find /path/to/wordpress -type f -size +100M
    
    # Check file permissions
    ls -la /path/to/wordpress

Step 2: MagicWP Environment Setup

  1. Create Hosting Environment

    • Set up new site in MagicWP dashboard
    • Configure domain settings
    • Create MySQL database
  2. Configure SSH Access

    # Generate SSH key pair (if not already done)
    ssh-keygen -t rsa -b 4096
    
    # Add public key to MagicWP server
    ssh-copy-id user@magicwp-server.com
  3. Test Connections

    # Test SSH connection
    ssh user@magicwp-server.com
    
    # Test database connection
    mysql -h database-host -u username -p database_name

Migration Process

Phase 1: Database Migration

# Create database backup
mysqldump -h source-db-host -u source-db-user -p source-database > migration_backup.sql

# Compress backup for transfer
gzip migration_backup.sql

# Transfer to MagicWP server
scp migration_backup.sql.gz user@magicwp-server.com:~/

# Decompress on destination
ssh user@magicwp-server.com "gunzip migration_backup.sql.gz"

Method 2: WP-CLI Database Export

# Export database using WP-CLI
wp db export migration_backup.sql --path=/path/to/source/wordpress

# Transfer file
scp migration_backup.sql user@magicwp-server.com:~/

Import Database to MagicWP

# Connect to MagicWP server
ssh user@magicwp-server.com

# Import database
mysql -h magicwp-db-host -u magicwp-db-user -p magicwp-database < migration_backup.sql

Update Database URLs

# Update site URLs
wp option update siteurl 'https://your-new-domain.com' --path=/path/to/wordpress
wp option update home 'https://your-new-domain.com' --path=/to/wordpress

# Update database URLs (alternative method)
wp search-replace 'https://old-domain.com' 'https://new-domain.com' --path=/path/to/wordpress

Phase 2: File System Migration

# Sync WordPress files (exclude cache and temp files)
rsync -avz --exclude='wp-content/cache/*' \
           --exclude='wp-content/uploads/cache/*' \
           --exclude='*.log' \
           --exclude='wp-content/debug.log' \
           /path/to/source/wordpress/ \
           user@magicwp-server.com:/path/to/magicwp/wordpress/

Method 2: tar Archive

# Create compressed archive
tar -czf wordpress_migration.tar.gz -C /path/to/source wordpress

# Transfer archive
scp wordpress_migration.tar.gz user@magicwp-server.com:~/

# Extract on destination
ssh user@magicwp-server.com "tar -xzf wordpress_migration.tar.gz -C /path/to/magicwp"

Method 3: FTP/SFTP Transfer

# Using lftp for automated transfer
lftp -c "open sftp://user@magicwp-server.com; \
         mirror -R /path/to/source/wordpress /path/to/magicwp/wordpress; \
         quit"

Phase 3: Configuration Updates

Update wp-config.php

// Database configuration
define('DB_NAME', 'magicwp_database');
define('DB_USER', 'magicwp_db_user');
define('DB_PASSWORD', 'magicwp_db_password');
define('DB_HOST', 'magicwp_db_host');

// Site URLs
define('WP_HOME', 'https://your-new-domain.com');
define('WP_SITEURL', 'https://your-new-domain.com');

// Security keys (generate new ones)
define('AUTH_KEY', 'new-auth-key');
define('SECURE_AUTH_KEY', 'new-secure-auth-key');
define('LOGGED_IN_KEY', 'new-logged-in-key');
define('NONCE_KEY', 'new-nonce-key');

Update .htaccess (if using Apache)

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

# MagicWP specific configurations
# Add any custom server configurations here

Update nginx.conf (if using Nginx)

server {
    listen 80;
    server_name your-new-domain.com;
    root /path/to/magicwp/wordpress;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

Advanced Migration Techniques

Handling Large Sites

Database Optimization

# Export specific tables
mysqldump -h source-db -u user -p database wp_posts wp_postmeta > posts_backup.sql

# Compress during transfer
mysqldump -h source-db -u user -p database | gzip | ssh user@destination 'gunzip | mysql -u user -p database'

File System Optimization

# Exclude unnecessary files
rsync -avz --exclude='wp-content/cache/' \
           --exclude='wp-content/backup/' \
           --exclude='*.log' \
           --exclude='wp-content/uploads/backup/' \
           /source/ /destination/

Handling Custom Configurations

Plugin Configurations

# Export plugin settings
wp option get plugin_settings --format=json > plugin_settings.json

# Import on destination
wp option update plugin_settings --format=json < plugin_settings.json

Theme Customizations

# Backup theme customizations
cp -r wp-content/themes/your-theme/custom/ /backup/location/

# Restore on destination
cp -r /backup/location/custom/ wp-content/themes/your-theme/

Domain and SSL Migration

DNS Updates

  1. Update A Records: Point domain to MagicWP IP
  2. Update CNAME Records: Configure subdomains
  3. Update MX Records: Email routing (if applicable)

SSL Certificate Migration

# Export SSL certificate from source
scp /etc/ssl/certs/your-cert.pem user@magicwp-server.com:~/

# Import to MagicWP
sudo cp your-cert.pem /etc/ssl/certs/
sudo chown root:root /etc/ssl/certs/your-cert.pem

Testing and Validation

Automated Testing

# Test WordPress installation
wp core verify-checksums

# Test database integrity
wp db check

# Test plugin functionality
wp plugin verify-checksums --all

Manual Testing Checklist

  • Homepage loads correctly
  • Admin dashboard accessible
  • All pages and posts display properly
  • Contact forms functional
  • E-commerce functionality (if applicable)
  • User registration/login works
  • Media files display correctly
  • SSL certificate valid

Performance Validation

# Test loading times
curl -o /dev/null -s -w "%{time_total}\n" https://your-new-domain.com

# Check for broken links
wp cli command "broken-link-checker check"

# Validate images
wp media regenerate --yes

Troubleshooting

Common Issues and Solutions

Database Connection Issues

# Test database connection
mysql -h host -u user -p -e "SELECT 1"

# Check database user privileges
mysql -h host -u user -p -e "SHOW GRANTS FOR CURRENT_USER"

File Permission Issues

# Set correct permissions
find /path/to/wordpress -type f -exec chmod 644 {} \;
find /path/to/wordpress -type d -exec chmod 755 {} \;

# Set ownership
chown -R www-data:www-data /path/to/wordpress

URL Update Problems

# Find remaining old URLs
wp search-replace 'old-domain.com' 'new-domain.com' --dry-run

# Update in specific tables
wp search-replace 'old-domain.com' 'new-domain.com' wp_options wp_posts wp_postmeta

Plugin Compatibility Issues

# Deactivate problematic plugins
wp plugin deactivate plugin-name

# Check plugin compatibility
wp plugin list --format=json | jq '.[] | select(.status != "active")'

Recovery Strategies

Rollback Plan

# Create pre-migration backup
wp db export pre_migration_backup.sql
tar -czf pre_migration_files.tar.gz /path/to/wordpress

# Rollback commands
wp db import pre_migration_backup.sql
tar -xzf pre_migration_files.tar.gz -C /path/to/wordpress

Incremental Migration

# Migrate in phases
wp db export phase1_backup.sql --tables=wp_posts,wp_users
wp db export phase2_backup.sql --tables=wp_comments,wp_links

Security Considerations

Pre-Migration Security

# Security audit
wp security-check

# Update all components
wp core update
wp plugin update --all
wp theme update --all

Post-Migration Security

# Security hardening
wp config set DISALLOW_FILE_EDIT true
wp config set WP_DEBUG false

# Install security plugins
wp plugin install wordfence --activate
wp plugin install limit-login-attempts-reloaded --activate

Performance Optimization

Server Configuration

# Nginx optimization
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
    expires 1y;
    add_header Cache-Control "public, immutable";
}

# Enable compression
gzip on;
gzip_types text/css text/javascript application/javascript;

WordPress Optimization

# Enable caching
wp plugin install wp-super-cache --activate

# Image optimization
wp plugin install smush --activate

# Database optimization
wp db optimize

Support and Resources

Documentation

  • WordPress Codex: Official WordPress documentation
  • WP-CLI Handbook: Command-line tool documentation
  • Server Administration: Hosting server management guides

Tools and Scripts

  • Migration Scripts: Custom migration automation scripts
  • Monitoring Tools: Site monitoring and alerting tools
  • Backup Solutions: Advanced backup and recovery tools

Professional Services

  • Migration Consultants: Expert migration assistance
  • Technical Support: 24/7 technical support
  • Custom Development: Tailored migration solutions

Manual migration requires technical expertise. If you encounter difficulties, consider using our automated migration tools or contact our support team for assistance.

On this page