Enabling NFSv2 on Ubuntu 22.04

I had issues mounting an NFS export on a Ubuntu 22.04 server on some older OSes like HP-UX and Tru64. I had to enable NFSv2 to allow these systems to mount the NFS export.

In /etc/default/nfs-kernel-server, change RPCNFSDOPTS to include version 2, like this:

RPCNFSDOPTS="--nfs-version 2,3,4 --debug --syslog"
Then, in /etc/nfs.conf, in [nfsd], add vers2=y
Then restart nfs: sudo systemctl restart nfs-kernel-server
 
I have my directory exported like this:
 
/nfs 10.35.0.0/24(rw,no_root_squash,insecure)