# New Server Preparation Checklist

## Server Details
- **Server**: vps2.scala4.com
- **User**: root
- **Password**: Sun-Morning-Wind-2026

## Pre-Flight Checklist

### Before Starting
- [ ] Have SSH access to new server
- [ ] Have root password ready
- [ ] Have access to old server for copying scripts

## Preparation Steps

### 1. Connect to New Server
```bash
ssh root@vps2.scala4.com
# Enter password: Sun-Morning-Wind-2026
```

### 2. Copy Preparation Script
**From old server:**
```bash
scp /var/www/html/wordpress6/wordpress/EP/migration/prepare-new-server.sh root@vps2.scala4.com:/root/
```

### 3. Run Preparation Script
**On new server:**
```bash
chmod +x /root/prepare-new-server.sh
/root/prepare-new-server.sh
```

**During script execution:**
- [ ] Script completes without errors
- [ ] MySQL admin password prompt appears (optional, can skip)
- [ ] All phases complete successfully

### 4. Verify Installation

#### Apache
- [ ] `systemctl status apache2` shows "active (running)"
- [ ] `curl http://localhost` returns HTML

#### PHP
- [ ] `php8.1 -v` shows PHP 8.1 installed
- [ ] `php7.4 -v` shows PHP 7.4 installed
- [ ] `php8.1 -m | grep ioncube` shows ionCube loaded
- [ ] `php7.4 -m | grep ioncube` shows ionCube loaded

#### MySQL/MariaDB
- [ ] `systemctl status mariadb` shows "active (running)"
- [ ] `mysql -e "SELECT VERSION();"` returns version number

#### Test PHP Info Page
- [ ] Visit `http://[SERVER_IP]/info.php` in browser
- [ ] PHP 8.1 information displays
- [ ] ionCube Loader shows as loaded
- [ ] **REMOVE info.php after testing**: `rm /var/www/html/info.php`

### 5. Security Hardening (Recommended)

#### SSH Key Setup
- [ ] Generate SSH key pair on local machine (if not exists)
- [ ] Copy public key to server: `ssh-copy-id root@vps2.scala4.com`
- [ ] Test SSH key login works
- [ ] (Optional) Disable password authentication in `/etc/ssh/sshd_config`

#### Firewall
- [ ] `ufw status` shows firewall active
- [ ] Ports 22, 80, 443 are allowed

#### Change Root Password
- [ ] Change root password: `passwd root`
- [ ] Document new password securely

### 6. Create MySQL Admin User (if not done during script)
```bash
mysql
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'your-secure-password';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;
```
- [ ] MySQL admin user created
- [ ] Password documented securely

### 7. Copy Migration Tools
**From old server:**
```bash
rsync -avz /var/www/html/wordpress6/wordpress/EP/migration/ root@vps2.scala4.com:/root/migration/
```
- [ ] Migration directory copied to new server
- [ ] All scripts are executable

### 8. Final Verification
- [ ] All services running: Apache, MySQL, Fail2Ban
- [ ] PHP info page removed
- [ ] Directory structure created: `/var/www/html`, `/backup`
- [ ] Git installed: `git --version`
- [ ] Node.js installed: `node --version` (if needed)

## Ready for Migration?

Once all items above are checked:
- ✅ Server is ready to receive applications
- ✅ Proceed to run inventory scripts on OLD server
- ✅ Start migrating Priority 1 applications

## Troubleshooting

If any step fails:
1. Check script output for error messages
2. Review system logs: `journalctl -xe`
3. Check service status: `systemctl status [service-name]`
4. See `NEW_SERVER_PREPARATION.md` for detailed troubleshooting

## Next Steps

After preparation is complete:
1. Run inventory scripts on OLD server
2. Review `SERVER_MIGRATION_PLAN.md`
3. Start with Priority 1 applications (WHMCS, Event Registration, Main WordPress)
4. Test each application before DNS cutover

