You can install them where you like. Most people put joomla in the root and moodle in a subdirectory. I suggest you spend some time over at moodle.org to understand moodle better. Do you know if moodle is something you even need? I ask this because you appear to be new to moodle. If this is so, it is worth spending some time learning moodle before you even attempt to integrate both joomla and moodle.