I have a server running ESXI 7, which has a public ip address. Can I build a DHCP service on it, so that all VMS hosted on it can get an IP address? Since I don't have more public IP addresses for them. If I can how to do it? If I can't, is there any other way to solve this situation to make all VMs on this server can visit the Internet?
The same as you would on any other system/network, build a VM to run an OS which offers a DHCP service.
Using a public address on an ESXi host isn't the hottest idea ever, hopefully it's protected by some form of security system/device...