I did this years ago before I started working for the FD (19 years ago). If you do tackle it, I would suggest getting several gallons of acetone. Saturate the current carpet (pour way more than you’d think you’d need). After it eats the old glue away, gently pull up the old carpet. Lay it in the sun to dry a little. Use the old carpet as the template. Lay it on the backing side of the new carpet, trace, then cut with a sharp razor knife. We used to bound it or bind it not sure of the proper term. I did several side jobs where the customer didn’t want it bound. I used a lighter to take care of the frayed ends. Then glue down with a spray contact cement. Be sure to glue both the carpet and the surface.