How did I fix «elasticsearch.service: Failed with result 'oom-kill'» / «A process of this unit has been killed by the OOM killer»?

How do I setup a swap file in Linux?