Petri nets are used to design deadlock control strategies for flexible manufacturing systems (FMS), which typically involve the addition of monitors and the associated arcs to the FMS. The addition of several monitors and associated arcs to first constructed Petri net model significantly complicates the Petri net controller. This paper develops a two-step method for preventing deadlocks based on a colored Petri net and a structurally minimal approach that significantly reduces the number of monitors. In the first step, a vector covering technique is applied to generate a minimal covered sets of first-met bad markings (FBMs) and legal markings that are respectively smaller than the sets of FBMs and legal markings. At one iteration, place invariants (PIs) corresponding to monitors are constructed by solving an integer linear programming problem (ILPP) to prohibit the maximum number of FBMs, while allowing all legal markings in the minimal covering set. The purpose of the ILPP is to maximize the number of FBMs forbidden by the PIs. Then, based on a colored Petri net, all generated monitors are combined into a global control place. Therefore, a supervisor with minimal structural complexity can be constructed. The obtained net model is controlled after the addition of the designed supervisor. Two instances from the literature are considered to illustrate the proposed approach.INDEX TERMS Colored Petri nets, integer linear programming, flexible manufacturing system, deadlock prevention.