Make sure your current system is up to date:

sudo dnf upgrade --refresh

Reboot:

reboot

Install dnf plugin which updates OS:

sudo dnf install dnf-plugin-system-upgrade

Download and prepare packages for upgrade:

sudo dnf system-upgrade download --releasever=40

Reboot and start upgrade process

sudo dnf system-upgrade reboot