"Safely" is the problem.
The only way to correctly earth it would be to run a wire literally to ground somewhere - actual earth, using a large metal spike into the bare ground, to an established bonded earth, or to already grounded piping [do not do this if you are even slightly uncertain as to whether your building's piping is all correctly bonded to earth already.]
That is really not a DIY task.
If you live in a country that doesn't have compulsory earthing, you need a professional to install correct earthing. I would seriously never recommend this as a DIY project. If no-one bothered to earth the sockets [because code doesn't insist you must] then you have no guarantee that anything in the building is correctly earthed.