Tune Your Linux Server

By Blane Warrene
We teamed up with SiteGround
To bring you the latest from the web and tried-and-true hosting, recommended for designers and developers. SitePoint Readers Get Up To 65% OFF Now

Tuning your Linux server can mean many things to many people. A portion of tuning is about security, insuring the configurations of the ftp, mail, ssh and web servers are properly setup to enable access and interaction with your server while tightening the belt for those who may be browsing through for potential back doors.

However, an important part of tuning is also making sure only the necessary services are running on your server to maximize the memory, processor and disk space you have available.

In an upcoming column I discuss Webmin (http://www.webmin.com), which is the premier open source graphical user interface for Linux server administration (and Solaris and numerous Unix-flavors). It is also an excellent tool for tuning Linux servers as it provides root access to bootup and shutdown configuration scripts as well as all of the critical web environment servers used.

For example, if you manage a dedicated server for your web hosting customers, a look via Webmin at the Bootup items (those that are slated for startup on each boot of the system) may reveal several unecessary services running. You can disable CUPS (for *nix printing), NFS and Samba, as well as any application servers you are not using.

On one of my servers, we found Interbase, PostgreSQL and MySQL all starting at boot, however, we only needed MySQL for this machine. By disabling those and additional services (ldap, named and snmpd), we saw an increase in available RAM at 15%. That can vastly improve performance when loads from database processing are a key part of your sites.

As noted earlier, security is also important in tuning, and Webmin provides easy access to INETD or XINETD for tightening which internet services and protocols are running (such as echo, finger, rlogin, rsync, telnet and so on). The protocols for ftp and pop are here as well, so disabling the daemon all together does not work.

We teamed up with SiteGround
To bring you the latest from the web and tried-and-true hosting, recommended for designers and developers. SitePoint Readers Get Up To 65% OFF Now
  • Hinkey

    Is this some kind of sick joke? Someone running/admining there own linux server should have enough common sense to dissable unneeded application server and on that note should have the common sense to not install multiple SQL servers for no reason.

  • The last 100 or so dedicated servers I have seen deployed from hosting firms have been pre-built with multiple database servers (minimum of MySQL and PostgreSQL) installed and a vast array of services loaded that may be unnecessary to many administrators.

    This column seeks to cover open source for those of all experience levels – and from my experience in the sitepoint.com forums, there are many newcomers investigating Linux solutions who may find introductory information useful. Everyone starts somewhere, and at one time at the beginning of my open source career I knew little of tuning a *nix server and had to be taught.

    Additionally, while in our case, we acquire and software-build (*nix os and apps) a majority of our servers from scratch, numerous web developers lease pre-built hardware from hosting firms and they may need modified to meet your performance and security standards. If a server is inherited it also may need tuned.

  • A couple of useful commands for figuring out what’s running on your box:

    ps -auxww | more

    This lists all running processes along with the command line that launched them.

    netstat -l

    This shows all ports that the server is currently listening for connections on.

    If you are running Red Hat, a useful command for telling what services are running is this:

    chkconfig –list | grep :on