We're not Apple - just other users here.
Always have a backup before attempting updates, upgrades or security updates.
In fact, always have an up-to-date backup, full stop.
All G5s can run up to Leopard 10.5.8. Getting it however…
You'll need a Leopard retail install disk.
This info is provided by TexasMacMan, with updates from me;
Mac OS X 10.5 Leopard installation system requirements
http://support.apple.com/kb/TA24950
Leopard is no longer available at the Apple Store but may be available by calling Apple Phone Sales @ 1-800-MY-APPLE (1-800-692-7753). {Note - this is now very unlikely, but no harm in asking}.
If you can't obtain a retail install DVD from Apple, look on Amazon MP, eBay or Google the installer part numbers to possibly find at an on-line store. Here's what to look for:
MB427Z/A Leopard 10.5.1 install DVD
MB576Z/A Leopard 10.5.4 install DVD
MB021Z/A , MC094Z/A Leopard 10.5.6 install DVD (single user)
MB022Z/A , MC095Z/A Leopard 10.5.6 install DVD (5-user family pack)
{the bold order numbers are the later ones}
Installing Mac OS X 10.5 Leopard
http://support.apple.com/kb/HT1544
Mac OS X 10.5 Leopard Installation and Setup Guide
http://manuals.info.apple.com/en/leopard_install-setup.pdf
After you install the base 10.5, download & install the 10.5.8 combo update at http://support.apple.com/downloads/Mac_OS_X_10_5_8_Combo_Update
{This is still available on Support Downloads}