Difference between revisions of "Migrate FOG"
(→Step 2 - Migrating images & database) |
(→Step 2 - Migrating images & database) |
||
Line 9: | Line 9: | ||
= Step 2 - Migrating images & database = | = Step 2 - Migrating images & database = | ||
− | Related | + | Related articles: |
+ | |||
+ | * [[Migrate images manually]] | ||
+ | |||
+ | * [[Troubleshoot_MySQL#Manually_export_.2F_import_Fog_database]] | ||
== Using NFS == | == Using NFS == |
Revision as of 02:40, 13 January 2017
Contents
Overview
This article explains how to move FOG Settings & images from an old box to a new box. This is more safe and sure than attempting an OS upgrade, which is risky and might leave you with a broken server. It's more safe and more sure because we know exactly what to move over and how to do it. But if you upgrade your OS and it doesn't work, we have no idea what broke or how to fix it without days of exhaustive troubleshooting that may or may not lead to a solution.
Step 1 - Building the new server
The first step in this process is building a new FOG server using the latest version of your chosen Linux distribution. I would recommend CentOS or Debian. Go through the normal steps of setting up the OS. do not create a user called fog - it will cause you nothing but pain later on. If you're installing Debian or Ubuntu, name the user "tech" or "Administrator" or whatever your first name is, like "Bob". If you're using CentOS or Fedora or RHEL, no extra user is necessary, just set a good root password. Name the server fog-server if possible, and set a static IP or create a DHCP reservation for the server. After an IP is set, use your DNS server and create an 'A' record for the server's name and IP. To install FOG, follow an appropriate installation manual or the Upgrade to trunk article.
Step 2 - Migrating images & database
Related articles:
Using NFS
Because the new FOG Server provides an NFS share, this is the easiest approach. This method is also uniform across the different distributions. This approach also works whether the old FOG Server's web interface is functional or not.
Mounting
Via Terminal or SSH on the old FOG server, mount the new fog server's /images/dev directory to a local directory on the old server called /new. Where x.x.x.x is the new fog server's IP address.
mkdir /new mount /new x.x.x.x:/images/dev
Export DB
We will export the database and move the export to the new server. This is performed on the old FOG Server. There are a few different examples of how to do this below, depending on if you're using a password or not, and how MySQL is configured. One of them will work for you.
#No password. mysqldump -D fog > /new/fogdb.sql #Password with root user. mysqldump -D fog -u root -p > /new/fogdb.sql #No password, localhost. mysqldump -D fog -h localhost > /new/fogdb.sql #No password, local loopback. mysqldump -D fog -h 127.0.0.1 > /new/fogdb.sql #Password with localhost. mysqldump -D fog -h localhost -u root -p > /new/fogdb.sql #Password with local loopback. mysqldump -D fog -h 127.0.0.1 -u root -p > /new/fogdb.sql
Export Images
Now to move over the images. Again, this is performed on the old FOG server. The more images you have, the longer the below command will take to execute.
copy -r /images/* /new
Importing DB
Via Terminal or SSH on the new FOG server, we now need to import the database. Assuming you followed the above steps for exporting exactly, one of the below methods will work for you. It's important to note that this step will make the new server's web interface credentials the same as whatever the old server's was.
#No password. mysql -D fog < /images/dev/fogdb.sql #Password with root user. mysql -D fog -u root -p < /images/dev/fogdb.sql #No password, localhost. mysql -D fog -h localhost < /images/dev/fogdb.sql #No password, local loopback. mysql -D fog -h 127.0.0.1 < /images/dev/fogdb.sql #Password with localhost. mysql -D fog -h localhost -u root -p < /images/dev/fogdb.sql #Password with local loopback. mysql -D fog -h 127.0.0.1 -u root -p < /images/dev/fogdb.sql
After the database is successfully imported, you should delete the old file or move it. This is done on the new server. Here's the command to delete it:
rm -f /images/dev/fogdb.sql
Arranging Images
This step is performed on the new FOG server. In this step we're simply moving the images to where they are supposed to be and setting the correct permissions. This step assumes that your new server's images directory is in the default location and you followed the above steps for moving them over exactly.
mv /images/dev/* /images chown -R fog:root /images chmod -R 777 /images
Step 3 - Only for FOG 1.3.0+ to 1.3.0+
Because of the security model of FOG 1.3.0+ and the new FOG Client, without the proper CA and ssl certificates present on the new fog server, any currently deployed hosts with the new FOG Client installed will ignore the new server and not accept commands from it. This is by design.
In order to maintain control of existing hosts that have existing new FOG Clients installed or existing images that have the new FOG Client built into them, you must copy this directory from the old server to the new server:
- /opt/fog/snapins/ssl
Using NFS
If you followed the NFS instructions in Step 2 and have not shutdown or rebooted your old fog server since then, you can use the mount that should still be there. The below steps are performed on the old FOG server.
Copy the directory to a temporary location first. I would suggest /root
cp -R /opt/fog/snapins/ssl /new
On the new FOG Server, delete the existing ssl directory and then move the old ssl directory to the proper location, and then set permissions.
rm -rf /opt/fog/snapins/ssl mv /images/dev/ssl /opt/fog/snapins #Fedora, CentOS, and RHEL users should use this command to set permissions: chown -R fog:apache /opt/fog/snapins/ssl #Debian, Ubuntu, and Ubuntu variants should use this command to set permissions: chown -R fog:www-data /opt/fog/snapins/ssl
To complete the ssl migration, on the new FOG Server, re-run the fog installer that you used in Step 1.