Install LR 5.
Since it is a major upgrade, LR 5 will exist side-by-side with LR 4.
Start LR 5.
Open your LR 4 catalog.
LR 5 will prompt you for converting it to LR 5 format to a new location.
After you confirm that LR 5 is up and running successfully, you can uninstall LR 4.