Finally, after six years, I found an affordable host thats slightly faster than my box I built in 2005 then. goodbye cPanel -- hello vm. I curently have hosting accounts with Dreamhost, Media Temple, Linode, and Rackspace Cloud, though I wont get into that right now. For now lets focus on how to get all those cPanel accounts from my other box into one of my new CentOS vms. For these I will be using no admin panel of any kind, no webmin, VHCS, WHM, or cPanel. I simply dont need it as its just as easy to ssh in and run a command rather than loging into a web interface and clicking something.
What I need to import
Im going to need a few things imported
- Users
- Passwords
- MySQL databases
- MySQL users
- Files
- vhosts
The reason I will not be needing email is I have switched to Google Apps for everything. Its more reliable and faster than anything I have ever set up using a single box. If you haven't tried it yet I highly recommend it.
The import script
You can find my cPanel import script on GitHub
cPanel-import - https://github.com/arzynik/cpanel-import
Running the script
Running the script is easy and has a few options
Usage: cpanel-import.php file [options]
Ex: cpanel-import.php devin.tar.gz --ip=100.100.100.100 --forceuser
- --username - Import as a different username.
- --password - Overwrite the users password.
- --ip - The IP to bind the vhost to.
- --mysql-user - The root or super admin for mysql.
- --mysql-pass - The root or super admin password for mysql.
- --source - Where to find the file.
- --dest - Where to find put the user.
- --ignore - Comma separate list of files to ignore in homedir.
- --httpd - Apache path.
- --debug - Show commands.
- --verbose - Show additional info.
- --forceuser - If the user exists, keep going, and delete their home directory.
This will create the user, database, vhost, and pretty much set up the entire site for you, and restart apache. Easy!