Migrate Confluence from Linux to Windows
Asked by Ray:

Any instructions to move Confluence 5.4.2 from linux to windows?


Answers:
author: Mike Rathwell
body: Ray,

There are no "official" cookbook instructions to move Confluence from Linux to Windows but I've done it (both directions) successfully a few times. Assuming you are using the same database on Windows as you were on Linux, here is the list of steps I take to make the move:

1. Shutdown the Linux Wiki
2. Dump all DBs from Linux Wiki
3. Copy \<conf-install\> and \<conf-data\> trees and the DB dumps from Linux box to a temporary staging area on the Windows server
4. Install Confluence Windows as a service (run as administrator)
   1. Do a Custom Install -- Leave the Application directory as default and set the data directory where you want it
   2. Set port to 80 (Windows Thing.... I was running tomcat on 8090 and 8443 forwarded from 80 and 443 respectively but there is no concept of port forwarding in Windows Server)
   3. Do NOT start Confluence
   4. Configure the Confluence Windows service with the java opts used on Linux instance
5. Start restore of Confluence DB from the Linux server SQL dump -- you can do next setup steps while restoring is going on to save some time.
6. Copy Confluence data dir into location chosen in the installation step above
   1. Edit confluence.cfg.xml to change "/" to "\\" for filesystem locations of attachments, temp, and index
7. Rename C:\\Program Files\\Atlassian\\Confluence to C:\\Program Files\\Atlassian\\Confluence.temp
8. Copy the Confluence application directory from production Linux instance to C:\\Program Files\\Atlassian\\Confluence
9. Delete bin and jre directories from the just copied Linux install
10. Copy bin and jre directories from Windows install (now in the Confluence.temp directory) to new application directory tree
11. Edit \<conf-install\>\\conf\\server.xml with
    1. Ports 80 and 443 (changed from 8090 and 8443 on Linux install) for both tomcat and secure section in file
    2. Change filesystem location from Linux location to Windows location for the keystore
12. Edit \<conf-install\>\\confluence\\WEB-INF\\classes\\confluence-init.properties with
    1. Change filesystem location from location in Linux instance to new location on new Windows instance
13. Delete all the stale log files from the data and app dirs.
14. After DB is restored, start Confluence. Comes up looking exactly like when the snapshot/backup from Linux was taken including all configs, plugins, history, etc.

Good luck. This works each and every time (trialed it a few times to iron out the kinks and make sure it was rigorous before I committed the "official" move of the production system). I did this WITH an upgrade baked into it as well (more steps if one is doing that).

mike

comments: author: eric halsey
body: Great instuctions [@Mike Rathwell](/t5/user/viewprofilepage/user-id/853367). Everything appears to be OK but when I browse to the new site it's asking me to "Choose a Database Configuration". The db has already been configured in my case and I updated the db connection in confluence.cfg.xml. Have you seen this before?


author: Mike Rathwell
body: Hi [@eric halsey](/t5/user/viewprofilepage/user-id/2196951) ,

Since you (I assume) ran across this one in a migration scenario and you're pointing at a known Confluence ready DB in the DB config file, it *feels* like it can't connect and perhaps for a variety of reasons. I'd suggest looking at the logs as Confluence is starting to see if it complains about anything and also try to connect to the DB from the new host using the same username/password as you have in the config file.

Also, when I did this, it was onto Windows Server 2012 and I am not sure if newer variants block the DB port which could also be styming you.


author: Ray
body: Thank you Mike

comments: author: Mike Rathwell
body: Very glad I could help


author: Ray
body: MIke,

I guess there're not a lot of people moving from Linux to Windows as the information available is very limited. Thanks for the details steps and it's very helpful to plan/test the migration.

Is it possible to include the upgrade into the process? If you don't mind, can you please provide more details.

Thanks  
Ray

comments: author: Mike Rathwell
body: Here you go. I had a variety of reasons to move from Windows to Linux (some of them good ones) so I made the leap. I still prefer Linux BUT it solved some other "living in the IT environment here" issues I was having.The assumptions on this one are that I am running PostgreSQL 9.3 and have found the PgSQL 9.3 driver to be quicker than the bundled 9.2 driver. Also, I use a PKCS12 cert for SSL (and force SSL connections) and keep it in an added directory under the Confluence directory tree. These steps catch the last elements of config file changes not done by the installer and make the update go smoothly. I went from Confluence 5.5 to 5.7 (and since have updated to 5.7.3 which closed a lot of issues I saw in 5.7)15. Re-index content just for form's sake.16. Stop Confluence and set service to Manual (if not already)17. Do upgrade install of 5.7 but don't start it18. Copy \<conf-install\>\\keystore from 5.5 backup to 5.719. Copy \<conf-install\>\\conf\\server.xml from 5.5 backup to 5.720. Copy \<conf-install\>\\confluence\\WEB-INF\\classes\\mine.types from 5.5 to 5.721. Replace \<conf-install\>\\confluence\\WEB-INF\\lib\\postgresql-9.2-1002.jdbc4.jar with postgresql-9.3-1101.jdbc41.jar from 5.522. Start Confluence and wait until finishes all DB changes23. Restart Confluence from cold to make sure it's happy.BTW, if this was helpful, mark my original response as an answer. That way it will show up as viable for others in our same plight.mike


author: Mike Rathwell
body: Forgot to mention, your upgrade from 5.4.2 to (now) 5.7.4 SHOULD be same same as my going from 5.5


author: rrudnicki
body: Hi Ray,

If your environment is not huge, you can do this:

1 Export a xml backup from your production server

2 Install a fresh Confluence with the same version on Linux

3 After this new Confluence is running fine, import the xml backup on this.

In case you are running Confluence in a huge environment, you will have issues related to the xml backup due its size. So, try these steps:

1 Make a backup of your production database

2 Install a fresh Confluence with the same version on Linux

3 Copy the home-directory from your Confluence of production to Linux and change the confluence.home variable on \<confluence-install\>/confluence/WEB-INF/classes/confluence-init.properties to point to this new folder

4 Import the database dump to a new database

5 Point Confluence to use the new database. You can do this editing \<confluence-home\>/confluence.cfg.xml file

If you get error messages related to path of folders, it may be related to "\\" and "/" on \<confluence-home\>/confluence.cfg.xml file.

Also, on this documentation you can get more information:

<https://confluence.atlassian.com/display/DOC/Migrating+Confluence+Between+Servers>

<br />

Regards,

Renato Rudnicki