Joe, You can get outdoor carpet cement at Home Depot or a hardware store. It even comes in a latex which dries waterproof. Spread it with a notched trowel. If you find the carpet does not stick well to the verticle parts of the boat, use contact cement on these areas.
The glue has the notch dimentions on the can. Get the cheap plastic 1 when your at the Hardware store. The reason is if you use a larger than recommended notch then glue can and will squeeze though the carpet.