To disable all x-window-based graphics, edit the file ${}PETSC_DIR/bmake/${}PETSC_ARCH/base and remove the flag -DHAVE_X11 from the CONF variable definition. Then (re)compile the PETSc libraries.