You have two options, and ideally use both.
Snapshots capture the whole server at a moment in time. Check your VPS control panel in your client area for a Snapshot or Backup option; create one before any risky change so you can roll back quickly. Availability and retention depend on your plan.
Manual backups protect specific data:
- Files:
tar -czf backup.tar.gz /var/www, then copy off-server withrsyncorscp. - Databases:
mysqldump -u root -p dbname > db.sql.
Always store at least one copy off the server. On unmanaged plans, backups are your responsibility; for managed backup options, open a ticket to ask what's included.