This article describes how I use an early 2009 27″ iMac as an external monitor. There are many articles which describe the process when using Windows 10 but since I don’t use that operating system, I will document the steps on Linux.
My daily (Linux) driver is OpenSUSE Tumbleweed and sometimes, I use my old 2009 iMac as an external monitor for my MSI laptop. My laptop has a mini displayport output so all I needed was the right cable which Amazon delivered for CAN $10.49 plus tax.
This is the specific cable I bought but keep in mind that my laptop has a mini DP output. Depending on your laptop brand, your configuration is most likely different which means that you need to find the correct cable.

How to configure a laptop running Linux with an iMac es external monitor
After I plugged in the displayport cable, I booted the iMac and logged in. Then I booted the laptop and noticed that the iMac screen went dark for a few seconds. I then booted the laptop and without pressing any keyboard shortcuts, the screen instantly mirrored on the iMac.
After a while, I rebooted and the second time this did not happen automatically so I temporarily unplugged the displayport cable from the laptop and upon re-inserting it, the iMac instantly picked up the signal and gave me a pop-up where I could select from four options. Basically, there are four ways to use the external screen. I could mirror the laptop or use the external monitor in dual-screen mode which is what I did.