Method to check and install packages.