one of my friends used a 3M product on his carpet, worked great. I'm not sure which one it is, but I think they have good descriptions of the products on their website.
At your local hardware store get a can of spray on adhesive, They all work. The trick is spray a light coat on both surfaces and let it dry, then spray them again and when they get tacky stick them together. For your carpet get some indoor outdoor carpet glue ( i like henry's 640 ). Apply it in a thin coat with a notched trawl, let it get tacky and apply the carpet.