Following are some of my random observations, tips and lessons learned from my move to an ISPConfig "Perfect Setup" server.
I recently moved to a new dedicated server and thought I would try to capture some of the things that made my move as easy as possible. This was a pretty big deal for me because I had to take down an existing production server and move to a new one with minimal downtime. Time IS money!
1) Shop around for your hardware but don't buy on price alone. Don't just settle for a fast cheap box if your business depends on high availability and a BIG FAST pipe to the internet. Those NOC's with redundant everything cost more than a box in a basement. After you have settled on the hardware you want, don’t forget, price is usually negotiable.
2) Build a test server to experiment and finalize on the software you will use. It doesn't have to be a "real" server...just a computer that will run the OS and applications you will use. I had an old P4 sitting around the house that was looking for something to do. Most of the Linux distributions are free to download and try so why not do it. I must have loaded and wiped the OS off the drive 2 or 3 times before I settled on how I liked it. Once I got what I wanted I imaged the drive so I could easily start over in just a few minutes.
3) Document everything you do so you don't have to remember every miracle solution you came up with at 3am after drinking 4 pots of coffee. I created a “New Server” folder on my desktop PC with subfolders for each application I planned to install. In these folders I had shortcuts to relevant websites and text files explaining how to download, compile, install and configure each individual application.
4) Don’t put off anything until the last minute. Find out what you don’t know and get the answers before you need them. It’s easier to figure out the solution when you’re not under too much time pressure.
5) Setup your nameservers early so you can minimize the dns propagation delay. If you are using NS1.NAMESERVER.TLD and NS2.NAMESERVER.TLD for your old server then go to your domain registrar (Network Solutions, GoDaddy, etc) and create NS3 and NS4 nameservers pointing to your new server’s IP addresses. Don’t transfer your domain to NS3 & NS4 yet. All you want to do is create them for later.
6) The easiest way I have found to move data from the old server to the new server is by using a little utility called scp. Most all of the popular Linux distributions include it. It’s secure, fast and easy to use because it uses SSH.
For these examples assume the following:
Old server IP – 10.0.0.1
You old server username – joe
Folder on old server - /home/httpd/web/
Folder on new server - /var/www/web2/web
To move a single file from your old server to the new one. Login to your NEW server via SSH terminal and use this command:
-p preserve dates, times and file permissions
scp -p -C firstname.lastname@example.org:/home/httpd/web/filename /var/www/web2/web
-C forces scp to use compression which speeds transfer
If you want to move an entire folder including subfolders then use the use the –r flag
scp -p –r -C email@example.com:/home/httpd/web/folder /var/www/web2/web
7) If you have very large files to move then don’t use zip because it is limited to 2GB max. Use gzip instead. I had several very large MySQL databases to move and zip refused to compress them. Gzip is simple to use just type gzip filename and you get a compressed file (filename.gz)
To unzip just use the –d flag:
8) MySQL databases can be dumped and reloaded easily for transfer. (assuming your MySQL username is joe and your database name is db_name)
gzip –d filename.gz
To dump your database into a file :
Now you can use gzip to compress db_name.sql and scp it over to the new server.
mysqldump --opt --quick --quote-names -u joe -p db_name > /home/httpd/web/db_name.sql
On your new server use phpmyadmin to create a new database and user. Yes, you can do it at the command prompt but phpmyadmin is easier and faster…at least for me. If you’re using ISPConfig then it’s a piece of cake to install phpmyadmin and begin using it.
Once you have your database and user created and you have db_name.sql uncompressed using gzip then do this to load it:
9) Access to websites created by ISPConfig is NOT available directly by IP address. You can get around this by modifying the “hosts” file on your Windows or Linux desktop computer to include the domain and IP address of your new website. Your PC will look to the hosts file first before going out to dns servers when trying to resolve your domain name.
mysql -u joe –p db_name < /var/www/web2/web/db_name.sql
In my case this was a problem because I still needed to access my old domain so here’s what I did... I took an old Pentium-III computer I had with Windows 2000 on it. I changed the hosts file on that computer as described above. Next I downloaded TightVNC and installed it on the old computer and my primary Windows XP desktop. VNC works with Windows or Linux to create a remote desktop. I setup the old Win2k PC as a VNC server and the WinXP PC as a client. Now I could control and view the old and new websites from a single keyboard and monitor. http://www.tightvnc.com/
10) Your desktop PC caches dns information. This can cause problems accessing your new server AFTER you have made the transfer to your new nameservers (NS3 & NS4 as discussed earlier). I was unable to access my new server’s Dovecot POP3 email from my WinXP PC using Outlook until I flushed the dns cache and then rebooted. Here’s the command to flush the cache on a Windows box:
That’s it! I spent about 3 weeks preparing for this server move so the actual move took less than 2 days including time to get all of my applications configured and install several security programs. The actual downtime was only a few hours.