A locking apparatus for mounting a photovoltaic module on a rack, the locking apparatus includes a pressing member, a blot having a head and a threaded portion, and a mounting member fixed to the rack. The pressing member includes a bottom portion, two side portions extending up from opposite sides of the bottom portion, and two pressing pieces extending outward from tops of the side portions respectively. A through hole is defined in a center of the bottom portion. Two ribs extend inward from inner surfaces of side portions respectively. A distance between the ribs is less than a diameter of the head. The head is retained in the pressing member between the ribs and the bottom portion. The threaded portion extends through the through hole to be screwed into the mounting member.