1, 7805 will be very hot, 24 to 5V, there is a 19V pressure difference on the 7805, even if there is no load itself power consumption will be great.
2, now there are many DC-DC modules on the market, ready-made, you can consider;
3, then there is the DC-DC step-down chip, such as XL4001,XL6002, etc., but such a circuit is not cheap.
If your system requirements are not high, reliability requirements are not high, just play, with 7805 plus a good heat sink can be; If your system reliability is high, long-term operation, it is recommended that the second solution, the key is to save trouble and cheap, bulk purchase directly bought.