The first thing is to make sure that your gun is not loaded, there have been many cases all over the world where people have died after shooting themselves while cleaning the barrel of their gun.
Once the gun has been emptied, you need to inspect the barrel. You then have to clean the debris and for that you will have to plunge the ramrod down the barrel. Remember it needs to be plunged from the muzzle end and the breach end. If there is residue of carbon and powder in the barrel then it can easily be pushed through.
Grab a specially designed steel brush and use it for scraping the bore which will enable you to remove residue particles which are very fine. It is recommended that you run the brush up and down several times in order to thoroughly clean the barrel.
Now you have to take a lead shot and load it into the chamber. You might need to apply lubrication to help the shot slide in.
Now fire the rifle with which the lead shot will be expelled through the barrel. This will repair the imperfections as the heavy metal will slide through the grooves.
You need to clean the barrel once more, but this time use a dry patch and run it through the barrel in order to remove any powder residue that might still be inside. You can also use patches with powder solvent on them in order to give your barrel a perfect clean.
Now in order to protect your barrel from rust you need to run a patch damped in oil through the barrel.
Apply a dry patch once more to finish off.