To apply for a PhD. position, should I first contact the professor I like to work with or publish a couple of papers and then make attempts? I plan to apply for a PhD position, but I don't know where should I exactly start that process. I know that I should have an SOP and a proposal for that. But should I first contact the professor I like to work with, the postgraduate studies section of the universities, or publish a couple of papers before making all such attempts?
I am considering a PhD as well so I am right there with you.  I think the answer to your question depends on many factors though.
1. Did you get a masters or are you just going straight for a PhD from a bachelors? 
1b.  If you received your masters, does the institution you got it from have a doctorate program and would it make sense to go there for your PhD to save on time?
2. How long have you been out of school and how relevant has your work experience been?  Is publishing a few papers first a realistic goal for you or will doing so push off your timeline of when you plan to start school too much?

In general, I think it's fine to talk with the professor you like to work with even if you end up applying right away, as it will give you a better indication of what you need to do and if the school is even a right fit for you.  And I think it would be good to talk to the postgraduate studies section as well.  I don't think you need to do any particular step before the other, there's nothing wrong with doing them all at once.  However, if publishing a few papers first is going to be a very long endeavor, then I would talk to both the professor and the postgraduate studies section first, see how many people tend to apply, how likely you are to receive the funding you need as you are now, and what steps you can take to give yourself that competitive edge before you spend your time trying to get published.  That's not to say you should put publications aside for now either, but if it turns out your resumé is pretty sufficient as is, then you can start the process earlier.

PLUS!  This way you will know when that specific professor is going to have the funds for you. It might turn out they only have the funds for this coming year and if you wait, you won't be able to work with them for a while.  Or it might turn out they won't have the funds for a year or two, and then you can discuss the ways in which you should pad your resumé to increase your chances when the time comes.  And if it turns out that for whatever reason you should wait to apply, you've already started a dialog with that professor and you will be able to strengthen a relationship so that when the time to apply does come, you won't be some random applicant to them.  

Good luck,
Hope this helps!