You can do a couple of things to accomplish using just the middle front chainring: 1) set the front derailleur "Hi" & "Lo" limit adjustment screws so that the side to side travel of the derailleur cage is stopped from moving the chain onto the smallest and largest chainrings (you should still have some lateral cage movement in order to "trim" the front derailleur to avoid cage chain rub. 2) Remove the front derailleur and manually position the chain onto the middle chainring (you can remove the front shifter mechanism and cable if desired; if a grip shifter I would keep it mounted). 3) Remove the large and small chainrings from the crank arm. The derailleur can be removed or left in place, but see option #1 for proper set-up if left in place. You will more than likely have to obtain new chainring hardware to effectively mount the middle chainring due to now having a missing ring(s) that would have taken up the extra space in the mounting hardware.
Because your rear gearing is designed for use with 3 front rings you may find that you do not always get to ride in the most appropriate gear ratio when only having the middle front ring available and riding on varied terrains (hills, soft surfaces)
I highly recommend that you become acquainted with the proper methods for shifting both front and rear derailleurs, and become proficient at utilizing the full range of gears on your bike. After all, I assume that is why you have an 18 speed bike; unless it was given to you and you just want it to function like a basic 6 speed bike.