## Resources

- [debian filewave](https://go.filewave.com/debian)
- [filewave server on centos](https://kb.filewave.com/books/end-of-life-statements/page/filewave-server-on-centos-eol)
- [ migrate to debian from centos](https://kb.filewave.com/books/filewave-server/page/migrating-your-on-premise-filewave-server-to-new-hardware)
- [backup script](https://kb.filewave.com/books/filewave-server/page/filewave-server-backup-and-restore)

## Notes

- CentOS is end of life
- What is the current state of the filewave setup? See FAQs

## FAQ Answers

**My FileWave Server is:**
- Managed by on CentOS: Have to follow the [migration documentation](https://kb.filewave.com/books/filewave-server/page/migrating-your-on-premise-filewave-server-to-new-hardware)

**I have Boosters:** 
- Running on CentOS: I suppose?!

**I have FileWave IVS:**
- Running on CentOS: I suppose?!

## Migration

> "_Your existing FileWave Server must be version 13.3.1 or higher before you can upgrade to FileWave 14.7.2 and then from 14.7.2 you can upgrade to 15.2.1.  The minimum memory requirement for FileWave 14+ is 8GB and ensure you give at least the same amount of disk space to the new Server. Larger Servers can benefit from more RAM, CPU, and SSD storage._"

### 1. Lock Desktop Clients

We **must** Lock all Desktop clients before migrating. To lock all clients, highlight all Desktop devices -> right click on all -> select "Lock" and **then perform a Model Update so that the server database is one model ahead of clients.**

### 2. Backup my FileWave server for the migration
[backup script](https://kb.filewave.com/attachments/188)

- For the backup script there is probably a cronjob active
- place backup script on same position as existing one

> "_Note: If you move the Data Folder to another network share, please make sure to update the path as well in the Backup Script._"

"Cooking recipe":
1. check where backup script is located: 
`sudo crontab -l | awk { 'print $6' }`
2. Check the version number of the script (prior to 2024 there was no `version` variable in the script!!)
`awk '/version/' </path/to/backup_server_osx_linux.sh>`
3. If newer version available download the newest version(change the path names appropriately):
```sh
wget https://kb.filewave.com/attachments/188 -O backup_server_osx_linux.sh.zip
unzip ./backup_server_osx_linux.sh.zip
# Remember the next 2 lines need to reflect where the script is going...
mv ./backup_server_osx_linux.sh /root/scripts/backup_server_osx_linux.sh
chmod a+x /root/scripts/backup_server_osx_linux.sh
```
4. Check that there is enough space on the machine and then make a fresh backup folder with all config files and data:
`sudo ./backup_server_osx_linux.sh run /tmp manual`
5. Stop the FileWave server in the next step

#### 2.1 Stop the FileWave Server

`sudo fwcontrol server stop`

### 3. Migrating to the Server

- Specs:
	- 8 GB RAM
	- 4 CPU

#### 3.1 Download FileWave Server for new hardware or VM

> **Important** _You need to migrate the server to the same version of FileWave that you are currently running. For example, if you are running FileWave 12.1 you must migrate to a FileWave 12.1 server. If you try to migrate from a FileWave 12.1 server to FileWave 12.3 the migration will fail._

"Cooking recipe":
1. Install clean Debian instance
2. login to the new server via ssh or other method
3. OS upgrade: `sudo apt update -y && sudo apt upgrade -y`
4. Download and install
```sh
wget https://fwdl.filewave.com/15.2.1/fwxserver_15.2.1_amd64.deb
sudo dpkg -i ./fwxserver_15.2.1_amd64.deb
```
5. If dependencies are not met then the next command will install them `sudo apt-get install -f` and then run again `sudo dpkg -i ./fwxserver_15.2.1_amd64.deb`
6. Reboot: `sudo reboot`

> **Notes:** `Webmin` is _not_ installed via this method. Check if it is needed!!... Not really. Useful for convenience but in reality just a risk.

#### 3.2 Setup of the new Server

Setup the new FileWave server via this [guide](https://kb.filewave.com/books/evaluation-guide/page/filewave-server-setup).

> "Note that the FQDN selected must be resolvable on all network segments you plan to manage the client devices from. If you want to manage devices both on and off your network then the same FQDN must be resolvable both on and off your network. Inside your LAN this FQDN will resolve to the internal IP address of your FileWave server. Externally that same FQDN will resolve to the public IP address of the internet router in front of the FileWave Server. With mobile devices like iPhones and iPads that have a high possibility of leaving your LAN, it is essential that they be able to access the FileWave Server at all times, especially when they are off-network."

1. Think about which temporary IP address the new server should get
2. Identify the network interface we wish to configure. E.g. `networkctl list`
3. Configure Network Settings:
`systemd-networkd` uses individual `.network` files for each network interface, located in `/etc/systemd/network/`. Create or edit the network configuration file for our interface, named like `10-eth0.network` (replace `eth0')
```sh
sudo vim /etc/systemd/network/10-eth0.network
```
4. Configure IP Address:
In this file, add or modify the following sections:
```toml
[Match]
Name=eth0

[Network]
Address=192.168.1.100/24
Gateway=192.168.1.1
DNS=8.8.8.8
DNS=8.8.4.4
LinkLocalAddressing=no
IPv6AcceptRA=no
```
Replace `eth0`. Modify `Address`. Set the `Gateway` and `DNS`.

Additionally, edit the file `/etc/network/interfaces` and set
```
# The primary network interface
#allow-hotplug ens192
#iface ens192 inet dhcp
```
5. Reload and REstart systemd-networkd:
```sh
sudo systemctl enable systemd-networkd
sudo systemctl daemon-reload
sudo systemctl restart systemd-networkd
```

6. Verification:
Check the status of the network interface: `networkctl status eth0`.

-  set hostname
- change root password
- package update
- harden ssh (should not be exposed to the internet)

> **Important:** [Default TCP and UDP Port](https://kb.filewave.com/books/filewave-general-info/page/default-tcp-and-udp-port-usage) usage for Firewall rules 

> **Warning:** Don't do an `apt udpate/upgrade` before the migration process is finished. It will clear out the `/tmp` folder in which the backup files reside (in this guide).

#### 3.3 Linux Server --> Linux Server
!! ORIGINAL AND NEW SERVER MUST HAVE THE SAME FILEWAVE VERSION !!
How to upgrade old server: <https://kb.filewave.com/books/filewave-server/page/upgrading-your-on-premise-filewave-server>

In short:
- a bunch of commands to move backups
- rsync backup from old to new server
- manually move all backup files to its correct destination
- manually move database
- migrate server (via command)
- use their script to repair permissions
- start fw

1. Connect to server (via ssh) as root user
2. Stop the currently running FileSave server `fwcontrol server stop`
3. Copy backup file from old server to new server
```sh 
scp -r  root@<IP-old-server>:/tmp /tmp/fw-backups 
```
4. Compare Data Folders:
Old server: `du -hsx /usr/local/filewave/fwxserver/Data\ Folder/`
New Server: `du -hsx /tmp/fw-backups/Data\ Folder/`
5. Unzip backup files:
```sh
cd /tmp/fw-backups/
tar -xf *.tar.gz
```
6. Moving all plain files to its location on new FileWave server. 
```
```


### 4. Launch FileWave Central to confirm the Migration

>_If you change the IP address or DNS reservation first before confirming the migration was successful you run the chance of your devices losing Filesets and un-enrolling themselves. Do not hesitate to contact our Support Team quickly if you think there may be an issue so that we can help get you back up and running quickly._

#### 4.1 Clear the Keys

#### 4.2 Login to FileWave Central

### 5. Changing the IP / DNS to match that of the old FileWave Server 

#### 5.1. Changing the IP address

##### 5.1.4 Debian Linux