Yes, it is safe. Unless you have lots of allergies to different things, what matters is allergy to that specific class of substances, ie. penicillin in your case. Since the vaccine does not contain penicillin (check the ingredients for the vaccine you are interested in), it is safe for you to take it. In many countries, you are required to stay at the vaccination center for 15-30 minutes, so that if you develop anaphylaxis, they can jab you with epinephrine. Of course you should stay alert for other unexpected effects that may take longer to develop, and see a doctor if necessary.
The information you need can be found in sites such as these (check the sites for more details and check the guidelines in the country you are in):
https://www.cdc.gov/coronavirus/2019-ncov/vaccines/recommendations/specific-groups/allergies.html
"CDC recommends that people get vaccinated even if they have a history of severe allergic reactions not related to vaccines or injectable medications—such as food, pet, venom, environmental, or latex allergies. People with a history of allergies to oral medications or a family history of severe allergic reactions may also get vaccinated."
https://www.sps.nhs.uk/articles/adv...ability-for-covid-19-vaccine-pfizer-biontech/
Individuals due to be vaccinated may have had previous allergies, and may ask their healthcare professional for advice on their suitability for vaccination.
Public Health England’s Immunisation Against Infectious Disease (the Green book) states that:
- those with allergies, including anaphylaxis, to a food, insect sting or most medicines (where the trigger has been identified), can proceed with vaccination as normal according to local guidelines, as long as they are not known to be allergic to any component (excipient) of the vaccine;
- anyone with a family history of allergies, a previous non-systemic reaction to a vaccine, hypersensitivity to non-steroidal anti-inflammatory drugs (e.g. aspirin, ibuprofen) or mastocytosis can proceed with vaccination as normal, according to local guidelines.