You can use double-sided tape or a heat gun to secure the carpet edges to melt carpet fibers together. Start working under the carpet edge by placing a roll of carpet tape. Then gently peel off the tape and press the carpet edge into the tape. Be sure to make sure the edges of the carpet are straight. Another option is to use a special adhesive specifically designed to attach carpets to floors. Or, you can use staples or tacks to fasten the carpet to the floor.