To create a swap partition after installation, create an empty partition that should have no holes. You can then format this partition with:
sudo mkswap /dev/sdX
/dex/sdX with your partition. Mount this partition as swap with
sudo swapon -U UUID
where UUID is that of your
/dev/sdX as read from this:
Bind your new swap in
/etc/fstab by adding this line:
UUID=xxx none swap sw 0 0
If you want to use your swap for hibernating then you need to update the UUID in
/etc/initramfs-tools/conf.d/resume with this content
RESUME=UUID=xxx. Don't forget to
$ sudo update-initramfs -u.
To complete things: it would also be possible to create a swap file in case we do not have a spare partition. This answer gives you an idea on how to create such a file and enable it on boot.