Here's the trick I learned from an excellent violin maker many years ago.
If you are not comfortable changing strings, take your instrument to a violin shop and ask them to show you. They won't charge you and you'll save yourself the trouble of breaking stuff. If the pegs are too small for the holes, take it to the shop and get new pegs. There's an art to making them work right. (As a side note, some student-level pegs have a screw inside the peg that adjusts the tension. These instructions are NOT for that situation. If you see a screw in the peg and the pegs don't work right, go to the violin shop.)
If you are comfortable changing the strings: Take the string off the peg, take the peg out of the peg box. Use a regular graphite pencil (#2 or otherwise) and color the part that contacts the peg box. You should have a stripe around the peg close to the skinny end and one close to the wider side, but do not color the area where the string winds. Without putting the string back on, put the peg in its spot and turn it a few times. Use more graphite if it doesn't turn well. Ideally, a little firm pressure should move it smoothly and it should stay stuck when you let go. (If the peg falls out and you can't get it to stay with its own friction, take it to the violin shop and ask for help!) When it turns smoothly and stays put, you are ready to put the string back on and make some nice music!
I do this every time I change strings, or whenever the seasons change and the pegs get sticky or slippy. It works way better than peg dope. It got me through conservatory, a master's degree, and I've been a professional violinist for a long time.