Why do most Web Servers run on Linux or Unix based systems?
In this discussion, developers say that they use Windows, Mac and Linux for different purposes - from coding to gaming. My question is, when it comes to running servers why Linux is the most preferred OS? Why not Mac OS or Windows?
- Linux server distributions are meek operating systems, just running and doing exactly what you want them to do. They are configurable down to the Kernel. You can update them from a single source and they do not need a reboot most of the time - even then you have all the freedom to decide when to reboot the machine.
- Since you can customize them to an extreme extend, Linux is easy to secure against attacks (but it's also easy to get the config wrong)
- Linux is very resource friendly and you can remove everything you don't need (or not even install it in the first place. No one needs a desktop on a server. Servers are "headless" most of the time. It runs on the smallest VMs. I've seen <1€/month Linux servers which are ideal for your personal site and applications.
- Many file systems are only available for *NIX, for example the brilliant ZFS. Most of the time, NTFS is not enough for enterprise servers, when you want special things, like snapshots, distributed computing,...
- I've seen webservers having sever problems with Windows services (for example there was a version of MariaDB which would kill the system log process because it used an "unknown" event ID. The Microsoft support blamed MariaDB instead of working on a bugfix which would prevent the whole service from crashing just because of an unknown integer value in the first place)
As for macOS and Windows:
- macOS is not a server OS. Apple once tried to make a server OS, but they failed and afaik abandoned the project. Desktop OSs are missing many administrator options which are important to set up specialized software and custom behaviours.
- Actually Windows Server is a very nice server system for people who can't use the commandline. There are quite a lot of people who need a GUI or they cannot use the system at all, so enterprises use Windows servers in favor of *NIX (where I work we have less than 10% *NIX systems and I had to decide against RHEL because of my coworkers). Windows has one big disadvantage: It costs quite a sum, so people who can use the commandline and know Linux will prefer the free Linux option (why pay for it when I can have it for free :) )
Personally, I use Gentoo, KaOS and Windows as desktop systems (and planning to get some macOS device for iOS development), but my NAS uses OmniOS and both, my home-server and private dedicated server, use Debian (I experimented with FreeBSD, but went back to Debian for its simplicity and stability). Ah, yeah, my Raspberries (also with webservers) use Raspbian, but I want to give Stali a try :) No Windows Core for me!
it's an installable "app" via the App Store
An app is not a server OS. macOS is just a user OS, even when you intall a file server. Or would you run a Windows 7 on a server because it's cheaper? There's more to a server OS than a software bundle ;) But I agree that it is useful for certain non-corporate use cases.
Companies that run Windows Server do not do so because their admins can't use the command line.
Well, at least the companies I know do so (also it's not only the admins (I am not an admin) who have to use the servers, but also the people who are responsible for the applications running on them). As I wrote, we also have Linux (and Unix for that matter) operating systems available if someone chooses to use them, but the majority of servers run Windows because that's what people can use.
organizations that use IIS, MS SQL, C# as their development environments
Yes, there are edge cases, like MSSQL databases. But compared to all the other servers which would not necessarily have to be Windows, that's nothing! And for those edge cases I would apply the principle "choose the best tool for the job". You wouldn't try to run a MSSQL db on Wine, would you :)
Did you know that you can run about anything mentioned on Linux, too? I just remembered that MSSQL will run on Linux soon (Microsoft made an announcement). .NET Core is opensource, so you can use Mono for C# easily. Heck, even PowerShell is available for Linux (there is an official GitHub repo)! And as for AD there is Samba as domain controller. Some schools and Universities only run Unix servers, because their admins are good with Unix and no one else has to touch the servers.
[RHEL] comes with a GUI
Yes, there is a GUI, but there is not a whole lot of config menus. Ubuntu also comes with a GUI, but introducing it to users is very hard, and the most pain comes from those things which cannot be configured in a GUI. It's Linux and Linux is configured via config files and scripts. You need to have at least some knowledge and experience with Linux to know which knobs to turn in order to achieve what you wanted. First having to train your employees is expensive and not productive, so companies go with what their employees know. It's the same for Windows, btw: You have to know in which menu to configure what. But people tend to grow up with Windows, so they already have the necessary experience.
if you want support
Yes, as a big company you always want support. No support means you need someone who knows the system in such a depth that they can handle any problem which comes up. As a big company, you would need big teams of that kind of people. Specialist teams are very expensive compared to a support contract.
not only does it "cost quite a sum", windows server edition is plain out much slower than linux too. years ago, i did a benchmark of Apache running on a 1GHz single-core Pentium 3, with 300MB ram... for serving a simple hello world index.html, Windows Server Edition 2003 got unstable at around 1000 concurrent connections (connection timeout/drops), Debian 3.1, on the same computer, same apache setup, ran well over 10,000 concurrent connections without problems...
because opensource is cheaper. thats the origin i will ignore windows and IIS because it's unfair to hit someone with no hands.
iis + ntfs is just sad. the cost is high and the value is low.
mac on the other hand you have to remember that apple, before the ipod was kinda dead as well as the motorolla chip architecture was different than intel and amd. (risc vs cisc,....)
so the only software where you could scale as an aspiring company with a low budget was linux.
which brings us to the logical consequence if a majority of startups use an operation system they started to develop services on it and services tend to be written in a low level language which leads to more services which brings in the open source ecosystem and all of the sudden the other companies can not keep up....
i purposly leave the networking out :) maybe someone else wants to explain that
that's what I watched happening so basically it was money and now many services and applications are running on linux. because years of opensource evolution laid a foundation of services which are free to combine to create your application :)
@hipkiss91 well g IIS is using not even a worker pool engine so we don't want to get into the the 10k connection problem, so one might call it slow ;D ... and using ntfs as a file system ... it is known to suck handling lots of small files :D ...
The virtual registers on the other hand are to me a very smart solution and other parts of windows are in theory really nice :D .... but still .... it's a handicapped system for web-projects :) So i don't want to say windows sucks for me it's still a rather impressive product. And that you can upgrade from window 3.11 to windows 10 in theory is very impressive as well as the movement to 1 unified core all those things are great ;D ... but well .... as a server ... i think we can call it special for a reason ;D ....
I think cost is the #1 thing. Remember, Apache can run on Windows. Not that I'd advise it, but it is possible, thus the WAMP stack. But... why?
That said, where I work is a Windows shop and we run several sites on IIS. Yeah, there are a few gotchas (URL rewriting is the worst), and no we're not high volume, so it meets our needs. I'm not complaining. I have more experience with IIS than with Apache. I think I'd get lost with Apache these days since I haven't messed around with it much in the last decade.