is it necessary to install diode in solar panel? can't s.panel work without installing diode?

It will "work", but if its feeding a battery, and the battery volts exceeds the panel volts, the panel will short the battery. At low voltages, the diode is a significant voltage drop, so use a relay or synchronous rectifier instead,