Did you have any snapshots of your server before running these commands?
The reason I'm asking is that you have some errors in your commands, allow me to explain:
sudo chown root: root / swapfile
Notice there's a space between ":" and "root" and also another space between "/" and "swapfile". What this means is that you assigned EVERYTHING under "/" (basically all your filesystem) to the root user with an inexistent group (" root").
sudo chmod 0600 / swapfile
Same as before, the space between "/" and "swapfile" is interpreted as a separator, meaning that you are applying the file permissions 0600 (Read-Write only to the group) to EVERYTHING under "/" and a file called "swapfile" that should be in the current directory, and since no group called " root" (with a space) exists, nothing else has permissions to do anything in your server rendering it unusable.