Build a Linux PC
Assembling a PC is straightforward, but choosing the components is less so. Neil Bothwick looks at the options
There is a document that has been floating around the internet for at least fifteen years, called ‘What if operating systems were airlines’. The entry for Linux Airlines states: “When you board the plane, you are given a seat, four bolts, a wrench and a copy of the seat-HOWTO.html”. It’s an old joke but as Linux users we are still more accustomed to sometimes having to do things for ourselves than users of other operating systems.
Table of Contents
Not that this is necessarily a bad thing, as it means we understand our computers better. Still, at least when you want a new PC you can just go out (or online) and buy one. So why do people build their own? Over the next few pages we will try to answer this question, as well as the more complex questions that arise when you try to do it, such as: how hard is it to do? What are the risks? What about warranties? Will it save me money? Can I build a computer with no Windows? And many more. There are several reasons why you may want to build your own, not least of which is the satisfaction of understanding your computer that little bit more, but this information is not only useful if you want to build a new system from scratch. Much of what we cover here will also be of benefit if you are looking to upgrade an existing computer. We will been concentrating on desktop systems, which are generally very easy to work on – I find LEGO more taxing. Laptops are another matter, but many of the points about choosing suitable Linux compatible components still apply and we will end with a look at picking a laptop, or any other type of sealed box, such as one of the popular nettop systems.
Why build your own computer? You may be able to save money by sourcing the components yourself, but don’t bank on this. What you do get to do is pick the exact specification you want – no throwing away parts to upgrade to what you really wanted. You also get to choose the quality of components you use. A pre-built PC may say it has a 2TB hard drive, but that tells you very little. Most hard drive manufacturers produce several drives of that size, with varying speeds, power consumption and intended usage. You will learn a lot more about components doing it yourself, and while putting together a desktop PC is not difficult, doing so will give you the confidence to dive back inside it when you want to upgrade. You can also upgrade incrementally – once you have a computer you understand, you can increase its hard disk or memory capacity now, then add a faster processor and motherboard next year.
What do you need?
There are several standard building blocks needed to build a computer. As a minimum, you will need: processor, motherboard, memory, storage drive, graphics card, case and power supply. You may also need a monitor, keyboard and mouse; but you could be building a media centre that uses a remote control and plugs into a TV, or a headless server such as a NAS box.
Over the next few pages we will look more closely at each of these, explaining the choices to be made. The idea is not to tell you which components to choose but to give you the information to make that decision for yourself based on your particular needs. When you have built your computer, you will then need to install an operating system and software. Naturally, we assume you will install Linux but you may also need to install Windows for gaming or some other particular software needs, so we will look at how to install the two OSes in perfect (well, almost) harmony.
Choosing the components
When it comes to choosing your components, you need to take into account what you will use the computer for now and what other uses are likely. The usage can dramatically alter the choices you make, eg a gaming system needs fast storage but not a lot of it for the OS and current games you are playing, so an SSD is ideal. A NAS is the opposite, lots of space needed but speed is not critical, so a slower spinning hard drive would be better. Linux users have another aspect to consider: compatibility. While the situation is far better than at any time in the past, there are still components that are better supported than others. Let’s work through the main components you will need and look at your options.
The first decision to be made is which processor to use, as this affects your choice of motherboard and then just about everything else. The choice may seem obvious: get the fastest you can afford, but things are never that simple. The fastest processors are also the most expensive, often by a substantial margin. There’s a value for money sweet spot that’s usually a couple of steps down from the ultimate. Processor speed is not everything, as memory can have a greater effect on your computer’s performance. Going down a step in processor speed and spending the savings on more memory, or an SSD, will usually result in a faster computer. Try leaving a system monitor like top running while you use your computer and see how often you use all of your current processor’s performance. Unless you are a gamer, or spend your spare time compiling custom kernels, you will be surprised at how rarely your processor usage becomes a limitation.
The other choice to be made is between Intel or AMD hardware. You could try a web search on which is best but be prepared to spend some time searching for real facts among the religious fervour. The truth is that processors are so fast nowadays that for a home system, you would be happy with either. Processor choice affects the choice of motherboard, so it may be that, depending on your needs and budget, you end up choosing a CPU to go with the motherboard you want.
If the processor is the heart of your computer, the motherboard is the central nervous system. Everything plugs into this board. In the past, that was all a motherboard did: connected everything together. Now they contain a lot of previously separate components built in, such as network interfaces and sound cards. As Intel and AMD use different CPU sockets, choosing your processor immediately reduces the number of motherboards you have to choose from. Now there are some questions you need to ask, such as do I need more than one network interface? How much memory will I want to fit – now and in the future? How many SATA connectors will I need – don’t forget to allow for one for your optical drive and possibly an external eSATA connector too. Also, how fast are the SATA interfaces? This is especially import if you are using an SSD. How many USB ports do I need, and what type? While USB 2.0 is fine for a keyboard and mouse, you will want USB 3.0 connectors for storage devices, and possibly a USB-C connector.
Consider the built-in devices of a motherboard you are interested in, such as network interfaces and sound ‘cards’. While the motherboards themselves will work with Linux, will the peripheral devices? Sound cards aren’t much of an issue these days as most support the Intel HD Audio standard but check anyway as the codecs in use can vary. Wired network devices are also generally well supported, but you may have problems with a very new motherboard that uses a device not yet supported by the current kernel of your chosen distro. As usual, a quick search of your favourite search engine, using the name of the board and the Linux distribution should turn up and potential problems and solutions. Support for onboard devices may not be a critical issue if you have enough PCI slots you can install alternatives and then disable the built in hardware.
Size can be important. If you are building a system in a large tower case, a full-sized ATX motherboard is easier to work with, but for a media centre you may want a smaller form factor that will fit in an attractive case that can go under your TV.
Memory is one of the simplest ways to boost the performance of a modern computer. It enables more tasks and data to be handled at once and any memory that’s left over is used by the Linux kernel to cache disk data which, incidentally, is why your computer shows almost no memory free after it has been running for a while. There are three things to consider when buying memory, the physical layout, the size and the speed. The current memory standard is DDR3 and DDR4. Don’t try to fit the older DDR or DDR2 sticks into these slots, they are incompatible. Size is obvious, and it is worth getting the most your budget allows. Check your motherboard’s manual for the maximum size for each slot because, although the spec allows for up to 16GB per DIMM, most Intel systems are limited to 8GB per unit. Motherboards usually use a dual-channel architecture for memory, so fit sticks in pairs and check the manual to see which slots go together. This is unnecessary if you are filling all four slots, but unless you are using the maximum size stick, it is better to use two larger sticks. If you want to fit 16GB of RAM, two 8GB sticks give you the option of adding more later, four 4GB sticks does not.
It used to be that the only question to ask about a hard drive was: How big? Now we have to add: How many? And what type? The choice of type is mainly between traditional hard drives with spinning platters and solid state drives (SSDs). (Although there are also hybrid drives that use a spinning disk with an SSD as a cache.) SSDs are much faster than hard drives but cost a lot more per gigabyte, a 256GB SSD costs about the same as a 3TB drive. So an SSD gives much faster booting and program loading but a hard drive holds much more. An SSD also uses less power and is more robust, making it the obvious choice for a laptop. With a desktop, you have the luxury of being able to use more than one drive, so the optimum is an SSD for the operating system and programs and a hard drive for your data. You could put the operating system on the SSD and /home on the HD, or you could leave /home on the SSD, which means you’ll get the benefit of the extra speed for things like your web browser and mail caches. Then you can mount the storage hogs, such as your media collections, on the hard drive. Either way, you will not need a particularly large SSD, 128GB should be more than enough, which should mean you can make sure you get a good one. There is quite a variance in the performance of SSDs, so make sure you get one with decent read and write speeds, in the region of 500Mb/s is good. Apart from that, setting up an SSD is pretty much the same as a hard disk.
Another option to consider is using multiple drives in a RAID array. This gives you redundancy, if one drive in the array fails your data is still on the other. This isn’t a replacement for taking regular backups but it does protect you against a drive failure. With RAID 1, the simplest configuration, two drives are mirrored. All data is written to both drives but read from one (which can give improved read performance as the data comes from whichever drive seeks to it first). Most distro installers will handle installing to a RAID array, but with RAID 1 you can also install to a single drive and add the second to create the array. RAID is handled by the Linux kernel, do not enable any RAID settings on your motherboard. These are so-called fakeRAID and require Windows drivers to work. Just let the installer see that you have two drives and the kernel take care of them.
Most motherboards have reasonable onboard graphics these days, so you may not need a separate card. If you want one, the choice is between Nvidia and AMD, and this is another topic likely to provoke religious flamewars.
Nvidia graphics cards will work as far as booting the computer into a graphical display, but the in-kernel nv drivers are limited.
You have a couple of options. The newer open source nouveau drivers work well now – we use them ourselves – and give reasonable performance. If you want the best performance from your graphics card though you will need to install Nvidia’s own drivers. As these are closed source they are often not enabled by default so you need to enable the option for restricted or third-party drivers in your distro. You can also download and install the drivers directly from www.nvidia.com, but this is not recommended as then your distro’s package manager cannot track and update them. The situation with AMD graphic cards is similar, the potential hassles of running a binary driver versus the lower performance of the open source drivers. The choice between AMD and Nvidia is almost as religious as the Intel vs AMD CPU choice. Unless you need top notch 3D performance, either will work well for you, and if you need that performance you will have to use the binary drivers whichever way you choose. Currently, Nvidia’s proprietary drivers are considered better more reliable, but that could easily change.
The computer’s case is often left as an afterthought, but a larger, well made case makes life so much easier. A Cheap case will make cable routing harder and will often have sharp edges that will mean bleeding knuckles and blood stains on your nice new motherboard (you can probably sense the first-hand experience in that statement).
A larger case also provides better airflow for improved cooling. If you are building a media centre that goes in the living room, a high WAF is a major consideration, but pay attention to noise levels. What initially seemed like a whisper can become annoying while watching TV. If you choose to go for a case with a window in the side, bear in mind that you will have to be extra careful when routing cables. A rat’s nest of cables is never a good idea, but it’s even worse when it is on show.
One of the most overlooked components is the power supply (PSU). Avoid the cheap PSUs that are included with cases (in fact, avoid cases that are cheap enough to include a PSU). A PSU must be reliable and good quality. That may seem an obvious statement that applies to all components, but when a PSU fails it can do so in a way that takes out other components. Having a £100 motherboard or hard drive, or both components, wrecked by a £15 PSU is not a good way of saving money.
Other aspects to consider when choosing a PSU are: that it must supply sufficient power for your needs, now and in the future, that it is efficient (any PSU worth its salt is rated 80 Plus, but look for Gold, Platinum and Titanium models) and that it’s quiet (particularly for a living room computer). There are several websites where you can list the components you are using and get a recommendation of the power supply you need, for example http://support.asus.com/PowerSupply.aspx?SLanguage=en. Check that the PSU you choose has connectors you need, most motherboards take a 24+4-pin ATX connector and a separate CPU power lead. Also ensure you have enough drive power connectors of the right type, some PSUs still come with more of the old Molex connectors than the useful SATA power plugs. If you are using a large case with a bottom mounted PSU, check that the leads are long enough to reach the drives at the top, although you can buy SATA power extender leads cheaply enough that deal with the last two points. You’ll be pleased to know there are no special considerations to be taken regarding Linux compatibility!
So far we have looked mainly at a general purpose desktop system, but there are some specialist users to consider, such as a home server or a high-performance gaming systems. If you want to build a home server, your requirements will be very different from a desktop or gaming system.
As all data is transferred over the network, a fast SSD is pointless. You could use one for the operating system, but servers are rarely rebooted, so you wouldn’t even benefit from the fast boot speed they offer, and they only run a limited number of programs, so loading time is not that important either. Servers generally run headless, so a fancy graphics card isn’t needed either, you only need a monitor for the installation process and the onboard graphics of most motherboards are more than suitable for that job. What you do need is a decent amount of memory and plenty of storage space. If you are building a file or media server, pick a motherboard with plenty of SATA ports and a case with a similar number of drive bays. However, much storage you add, at some time you will want more. If you are building a web or mail server, storage space is not such an issue, unless you want to serve media files over an internet connection, but plenty of memory helps, especially with Apache.
Another type of home server is a media server. This could simply be a repository for your video files or you could be doing the recording on the server too, using MythTV’s backend server software or something like Tvheadend. Either way, you will need plenty of space. If you have a server that transcodes video too, maybe something like Plex that reformats video to suit the device playing it and the speed of its connection to the server, you will need a decent amount of RAM and a reasonably fast CPU – not a gaming monster but something that’s not budget.
As everything works over the network, it goes without saying that it should have a fast network interface, especially if more than one client will be using it at the same time, so make sure it has a gigabit interface, or budget for a decent PCI-e network card.
Gaming, and we mean the graphically intense kind and not gambling, places specific requirements on a computer. Performance is the obvious factor, but not just the performance of the CPU. The GPU on the graphics card plays a more important role than the CPU with some games. Clearly you want a fast CPU and graphics card. Many of the higher performance graphics cards take up the space of two PCI-e slots so you need to make sure both your computer’s case and motherboard have room for it and that your PSU is capable of powering it in terms of raw power and physical connectors it can offer. Memory is also important, you want plenty of it and the fastest available. Disk storage space is less important than speed, so an SSD is the preferred choice for storage. Gamers always want more performance and one of the ways of getting it is by overclocking their systems. This is where you run your processor and memory at higher than its rated speed. For general purpose use, opinions on overclocking are divided; it does give better performance but at the cost of possibly shortened component life and unreliability if you push it too far, plus more heat to get rid of. Some CPUs are locked at a particular speed, so you need to make sure the processor you choose is able to be overclocked. You also need a suitable motherboard. They all offer some control over frequencies and voltages, but some motherboards are intended for overclockers and offer far more control – you’ll need to do your research carefully.
To deal with the extra heat, you need a good sized case to maintain plenty of airflow, combined with a decent CPU cooler (the stock cooler supplied with the CPU isn’t intended for overclocking) and plenty of fans. A motherboard intended for overclocking may have more fan connectors and some speed control for them. When choosing cooling fans, go for the largest you can fit. A larger fan shifts more air while rotating more slowly, it’s fast spinning fans that create more noise.
If noise is an issue, or you want to push clock speeds as high as possible, consider water cooling. Overclocking used to be a specialist field that required you to buy and assemble various components then spend ages bleeding the system and performing leak tests (it may surprise you, but water and electronic do not mix well). Nowadays pre-built units are available where you bolt the radiator assembly to a suitable point on the case and clip the heat sink in place of the CPU fan. Some kits also include GPU coolers; as mentioned, gaming works them hard too. Water cooling is not only for gamers and overclockers, it can be use on a standard desktop system to reduce the noise. The loudest noise from such a setup comes from the hard drive stepper motors.
Assembling a desktop or server computer is a fairly straightforward task, creating your own laptop isn’t. While it’s possible to buy laptops piecemeal, it’s not the usual way of doing things. Still, much of what we have covered in this feature still applies. It is just as important to choose suitable components for a laptop; even more so really because you cannot simply swap them out if you don’t like them. So it is a matter of finding a pre-built laptop within your budget that meets your requirements and then checking that everything will do what you want it to. The same applies if you are looking for a nettop to act as a media player.
The same rules apply for choosing a suitable processor, graphic card, sound card and so on (although the use of the word ‘card’ here is not strictly correct, almost everything is on the motherboard). There are a couple of important differences: laptop hard drives tend to be slower than their desktop counterparts, making the speed advantage of an SSD even greater. Memory upgrade options are limited, so choose a device with plenty to start with and make sure that it has at least one free slot for expansion. Some laptops have only one slot so upgrading memory means throwing away what you have rather than adding to it.
If you have the option, try booting the laptop from a recent live CD, such as the LXFDVD. Try System Rescue CD with the Alt kernel option gives a very recent kernel with the most up to date hardware support. Run $ ifconfig -a to see that both wired and wireless interfaces show up and use $ aplay to make sure the sound system works all the way from the given file to the speakers. Wireless interfaces can still be a problem with some laptops, but most have a mini-PCI slot these days, in which case you can drop in another card.
While the Intel vs AMD CPU war and the Nvidia vs AMD graphics war will continue to rage on, Intel provides excellent support for its components. If your laptop has both Intel graphics and wireless cards, it won’t go far wrong and everything should just work with no need to install extra drivers. Now grab your favourite distro and enjoy the speed and freedom of Linux running on new hardware, selected and built by your own hand, wonderful!
Building a PC isn’t difficult, but some care is needed when working with electronic components. Prepare a large working area, clear of any clutter and with a non-conductive surface. Static electricity can kill electronic components, and it can build up on your body without you noticing, until you pick up a component and zap it. You can avoid this by earthing yourself to discharge and static build up. The simplest way to do this is to touch a grounded object, such as a central heating radiator or the kitchen sink before touching a component. You can also buy anti-static wrist straps that connect to a grounded point by flexible cable to keep you static free during your build.
The computer you build will not have a warranty, but the individual components will. As long as the fault wasn’t caused by damage while fitting them, any reputable vendor will replace them.
Installing an operating system
Once you have built your computer, you will need to install an operating system. We will not look at that here, the distro installers are well enough documented, but there are a couple of points to consider. New motherboards will use UEFI rather than the older BIOS. They may also have Secure Boot enabled. You will almost certainly need to turn this off in the firmware. Press the relevant key at boot to configure the firmware, the motherboard’s manual will tell you which it is (one of the joys of building your own computer is that you get a manual for your motherboard).
You should be able to use UEFI to boot the computer, most distros now work with it, and it’s nicer to work with than the old MBR system. If you need to use MBR booting, there will be an option for this in the firmware menu. Some have a UEFI boot option that you can turn off, others have the cryptically named CSM (Compatibility Support Module) that has to be enabled for MBR booting. If you are building a Linux-only system, you can just boot from your favourite DVD and install. If you want to dual boot with Windows, you should install Windows first and then Linux. The Linux installer will pick up the Windows installation and set up a dual-boot menu, whereas the Windows installer would just trample over the Linux bootloader if you did things the other way round.