I’m using the Mongodb “community” version. And i’m using Ubuntu 18.04 (in Linux)
Attempted to upgrade from version 4.0.28 to version 6.0.
I found out late that I had to upgrade from 4.0 to 4.2
After the update, of course, there was an error, and mongod does not run. (When I restart, failed appears)
So I’m going to install 4.0 again.
Can I install 4.2 right away?
And what is the difference between how to update using mongod command and downloading list files?
The upgrade steps are well documented. The supported upgrade method is stepwise through each major version.
For you, as of today, that will be 4.0.28 → 4.2.24 → 4.4.26 → 5.0.23 → 6.0.12
You should ensure the current version 4.0.28 shut down successfully before upgrading to 4.2
Not sure what the question is here but there are two methods for installation using the package manager or using a tarball install. I would recommend using the package manager to complete install and upgrades.
One is the upgrade instructions, the other is for a new install.
Follow the upgrade instructions for 4.2, the upgrade instructions will direct you to the install instruction, but it will list any important pre-upgrade steap and other prerequisites.