Go to your local courthouse and find the court clerk's office. Depending on the size of the city, it can be a small window up to a long counter with many folks there to help you. Tell the person that you want a restraining order. You will fill out some forms and depending on how busy the judge(s) are and the time of day, you can have a restraining order in 5 minutes or a day or two max. You should also have any supporting evidence to show just cause for a restraining order. You must show just cause. Some courts charge for the service, some don't. If a restraining order is issued, it is up to you to make sure it is properly served.
Some things to consider. If a restraining order is issued and that person is seen with you, no matter who initiated the contact, they will be arrested. If you wish to remove the restraining order, you must go back to court. Just saying never mind will not cut it. And you can be arrested for violating the restraining order too. If you attempt to contact the person and they are attempting to not contact you, the police can be called in and you could be arrested.