Oct 29, 2013
The Easy Way to Build a Serious Linux Server
Written by Katie Gomez
If you’re just testing stuff… if you’re just running at home for fun… even if you’re trying to test software that will eventually run in the server room… you get a lot of flexibility. It’s easy to set up a Linux server for yourself. There are so many options to get started. And you can download any tools that look interesting and try them out.
When you need something serious, then you pay more attention to the installation process. When you need something powerful and reliable to run in your server room, you need to think about two things. You want minimal and consistent software on your server.
Over the years I’ve spent a lot of time perfecting the basic setup. It’s surprisingly easy, now that I know what I’m doing. A big part of it comes from the notes below. Get past the standard stuff quickly so you can install the software you really need.
yum is the most important tool for easily and precisely installing software. There are other options, but this is the one I’ve learned to love. It’s all command line driven, so you can easily monitor, control and repeat what’s going on. But it takes care of the dependancies for you, so you’re not starting from scratch.
Start from the Fedora network install disk. The link keeps moving, but try starting here and search for “network”. You almost certainly want the 64 bit version. (Sometimes they push you to something that works in more places, even if it’s old and not the most powerful option.) The network install disk will download very quickly and it will fit on a CD, rather than a DVD. There’s no point in grabbing a “full” install disk. That will include a lot of files that you won’t need. And that will include files that are already obsolete, so you’ll have to go back to the network anyway to grab the latest. Why not grab only what you need and grab the latest the first time?
When you run the install, select the minimal options. When it asks about repositories, check the checkbox labeled “updates,” so you get the latest the first time. The GUI that comes with the installer is nice because it has a lot of documentation and recommendations. But when I try selecting packages from that I always end up with far more than I need on my system. (Why did it always install the printer daemon? I don’t have a printer in the server room!) And I could never get two machines to be the same. I would literally have two machines right next to one other, going through the steps at the same time, being as careful as I could, but they’d still end up with different numbers of packages.
Now you have the minimum installed to run Linux. Next, use yum to install the bulk of the software that you need.
I’ve created a list below with some helpful packages. This is just the standard stuff. Eventually you’ll have to install the software that does the real job of the server. This is a list of convenient packages that I’ve accumulated over time. These are all of the things that help me set up, maintain, and monitor the server. The main focus of this list is things that are often useful to me, and don’t hurt anything. (I.e. they use very little disk space, and they don’t automatically run. They don’t use any memory or CPU until I explicitly call them from the command line.)
This list is based on what I typically need. No doubt you’ll want to customize this for your own needs. Keep your own list, so you don’t have to Google what you’re looking for every time.
|libuuid-devel||C libraries for making unique ids (guids).|
|php-mbstring||Another development library that I’ve found useful sometimes. PHP uses Latin-1 by default, and sometimes we need UTF-8.|
|More development libraries.|
|emacs||You want to be good at a non-graphical text editor, even if that’s not your only tool. I used to be a master of all the fancy things you can do with emacs. Now I use it mostly because I remember all the keyboard shortcuts. That’s important when you don’t have a GUI!|
|tcsh||Again, a matter of taste and what you’re used to. I can handle /bin/sh if I have to, but I can do more with this off the top of my head.|
|numactl||Memory has gotten surprisingly complicated. Check out MySQL Swap Insanity, for a good example.|
|Various network client software packages. These are perfect examples of things that are often useful, you always want them available, and they don’t use any resources until you need them.|
|gcc-c++||C++ compiler. Sometimes you have to compile 3rd party software. For my own software, I typically compile it on the machine where it will run. That helps a lot if you ever have to run the debugger. And it’s easier than creating an install package.|
|cvs||Version control. Esential when building my own stuff. Also useful to manage config files and the like. And I sometimes use it to back up other things, like the database structure and various crontabs. A script will automatically put the latest version of these files into CVS. So I get an automatic and easy to read history of what are traditionally system administration tasks.|
|Miscellaneous software that you might expect to be standard.|
|mailx||The standard mail client. The one that you normally get when you type “mail”. There are a lot of fancier alternatives out there. Google likes to point to those, but I wanted something simple.|
|ntp||Time synchronization. Various programs like this have come in and out of vogue over the years. But Linux is good about letting me continue to use something that works for me, even if it’s not the default. That’s one of the reasons I like Unix/Linux better than Microsoft Windows: I don’t have to start from scratch all the time! I have to learn new things sometimes, but the old stuff I know (often very old stuff) keeps building up and is still useful.|
|It’s good to have a lot of options available for backups, setting up new machines, etc. I don’t trust these enough for critical tasks, but they’re great for when I’m sitting in front of the terminal. Even if an automated backup fails, that’s okay, as long as the computer emails me a warning message.|
|screen||I don’t even know where to start. I could write a book on all the good things screen has done for me. Like so many tools, it made so much sense back before GUIs were common, and it’s still incredibly helpful on a dedicated server machine. If you don’t know this one, look it up!|
|gdb||Command line debugger. You don’t want this to be your first line of defense, but sometimes you need it. You’ve see The Matrix. Sometimes you need to talk with the machine in its own language.|
|sendmail-cf||This is a good place to start if you you need your web server to send messages to the general public.|
|You need these to make the spell checker work in emacs. This is another example where the solution is simple, but you don’t always know what to punch into Google. This is why you take notes.|
|tmpwatch||Clean out your /tmp directory. This is an exception to my rule. This does run automatically. But it’s so useful and takes so few resources, I make it standard.|
|These are not part of the standard install. I use these often, but it really depends on what type of server I’m building today.|
|I used to have TCL as part of my standard install. I stopped because now I often prefer a customized version of TCL rather than the standard package.|
I hope I didn’t scare anyone away with that long list. You can ignore most of the notes above. Until just now, very little of this was in writing. My notes looked more like this:
yum install libuuid-devel emacs tcsh numactl telnet openssh-clients gcc-c++ man mysql-devel ntp cvs rsync usermode krb5-appl-clients nfs-utils yum-utils gdb tmpwatch less traceroute zip unzip tar php screen mailx sendmail-cf aspell aspell-en make man-pages php-mbstring php-mcrypt ftp mysqltcl
Just copy and paste that one line from your notes onto the system you’re building. Remember to keep the notes up to date, adding new packages when you find them useful.
- A serious Linux server should have nothing on it but the bare essentials.
- By taking good notes and using the yum program, you can easily and precisely specify exactly what you want on the server.
- Use my list as a starting point, but create your own list and keep it handy.
I hope you find this helpful. Feel free to share some of your favorite additions to this list.