You need to have OS 3.1 installed with a CD-filesystem for your CD-ROM (available at aminet). When that's done you just insert the CD and click install. It is best to do this over a clean 3.1-install but it should work anyway.
You should also create an emergancy-disk after the install. It allows you to boot the CD if you should need to install AOS 3.9 again. It'll let you skip the install of AOS 3.1 from disks.