Use Raspberry Pi Imager on your computer. Choose your Pi model, Raspberry Pi OS (Lite if you don't need a desktop), and your SD card. In the settings, set a username, your Wi-Fi and enable SSH before writing the card.
# After the first boot, find the Pi on your network and log in: ping raspberrypi.local ssh yourname@raspberrypi.local # Then update everything: sudo apt update && sudo apt full-upgrade -y