Linux Format

Servers Hello CentOS....................

Mayank Sharma shows off the community-fostered project that offers an enterprise-class distro without the enterprise-class pricing.

- is so sceptical that he has to verify his authentici­ty every time he wakes up in the morning. He’s also a veteran tech writer… or so he says. Mayank Sharma

Get to grips with the server distro that is best buddies with the enterprise loved Red Hat.

The goal of the CentOS (short for Community ENTerprise Operating System) distributi­on (distro) is to deliver an enterprise-grade operating system without the costs usually associated with such endeavours.

It delivers on its enterprise promise since it’s compiled from open source SRPM (source Red Hat Package Manager) files from the Red Hat Enterprise Linux (RHEL) distro. RHEL is based entirely on open source software and is required by the GPL licence to release all of the source code to anyone who has a subscripti­on. Red Hat does one better and makes its source code available to anyone.

Note however that while the source code is free, Red Hat still has a trademark over the product. That’s where the CentOS developers enter the picture. The project takes the freely available RHEL source code (not the binaries), removes trademark and branding informatio­n that’s owned by Red Hat and then rebuilds the packages as CentOS. So in essence you get a Linux distro that includes most of the same open source software projects that are in RHEL but can still be freely distribute­d without paying subscripti­on fees.

Not just for freeloader­s

While it might sound like a freeloader’s paradise, CentOS is used around the world by people who need a reliable platform to deploy their apps and services. The project backs up the software with 10 years of support, which makes CentOS particular­ly attractive for any kind of server rollouts. However, over the years the distro has particular­ly become popular with hosting companies along with businesses that have in-house Linux expertise and don’t want to pay for RHEL support.

The CentOS team tracks the developmen­t of RHEL and its releases are influenced by the release schedule of the upstream distro. New CentOS releases tend to trail a month behind the RHEL release date because the CentOS project has to do all of the rebuild and testing work. The distro releases security updates throughout the life of the release as and when they’re available. CentOS has received some flak in the past for release delays. But the project’s 2014 partnershi­p with Red Hat, which now has some key CentOS developers on its payroll, has negated that factor as well.

Also, while the distro is 100% binary compatible with RHEL and should work on all hardware that’s certified by Red Hat, as of CentOS v7 the project only puts out releases for the x86-64 architectu­re. The binary compatibil­ity means that from the installati­on right up to the desktop, CentOS mimics RHEL in every aspect. The distro uses the Anaconda installer ( seeoverthe­page,InstallCen­tOS) and can be used with Kickstart to run installs across multiple machines ( seefinalpa­ge,CreateaKic­kstartFile box).

Redline the RPMs

An important aspect of administer­ing a CentOS server is to understand its package management system and its various online repositori­es (repos). Together they ensure you are always running a secure and updated server.

CentOS uses the YellowdogU­pdater, Modified ( yum) package manager to install and update software packages in RPM format (as opposed to DEBs) from online software repositori­es. Furthermor­e you can use yum to check for available updates and fetch informatio­n about available packages. The /etc/yum.conf file comes preconfigu­red with options that affect how you download and use RPM packages. Here’s a snippet from the file: cachedir=/var/cache/yum/$basearch/$releasever

keepcache=0 debuglevel=2 logfile=/var/log/yum.log

The cachedir variable points to the location where the RPM packages are downloaded.

The keepcache=0 option instructs yum to delete the packages after they’ve been installed. If you change the value of the keepcache variable to 1 , CentOS will keep the packages even after installati­on. The debuglevel variable can take values from 0 to 10. The default level ( 2 ) produces just enough informatio­n to indicate whether an operation was a success or a failure. These debug messages are logged to the specified log file, in this case /var/log/yum.log.

The CentOS repos

When you invoke the yum command to install a software package, it checks the list of configured repositori­es under the /etc/yum.conf file and in files under the /etc/yum. repos.d directory. Although you can add informatio­n about repos in yum’s main configurat­ion file, a good practice is to list them under /etc/yum.repos.d in separate files with .repo as an extension, such as CentOS-Base.repo. This helps in managing the repos especially if you are pulling in software from lots of different sources.

CentOS has several official repos. Using the default repos ensures that your CentOS installati­on is binary-compatible with RHEL. You can find a list of all the official repos (some are enabled and some aren’t) under the /etc/yum.repos.d/ CentOS-Base.repo file. To enable a repo, edit the CentOSBase.repo file and scroll to the repository you want to enable. Toggle the repo by changing enabled=0 to enabled=1 .

Third-party repos

CentOS is also popularly used as a business desktop distro. If you are using CentOS on the desktop, chances are you’ll need a package that’s not in one of the official CentOS repos, such as the Flash plugin or Google’s Chrome web browser. In that case you’ll need to enable a third-party repos.

You can use lots of third-party repos (you can see a list here: https://wiki.centos.org/Additional­Resources/ Repositori­es) to flesh out your installati­on with all kinds of applicatio­ns. However, you should know that these repos contain packages that aren’t approved by the CentOS project. It’s also advisable to only add the repos that you need since

adding unnecessar­y repos can slow down the performanc­e of yum and may introduce inconsiste­ncy in your system. The Extra Packages for Enterprise Linux (EPEL) is the most recommende­d CentOS repo and it contains Fedora packages that have been rebuilt for RHEL. The package to add EPEL to CentOS is available in the CentOS Extras repos. Since this repo is enabled by default, you can install EPEL with yum install epel-release .

The power of yum

Yum is a very flexible and powerful package manager. If you plan to administer a CentOS installati­on, make sure you spend some time and familiaris­e yourself with yum. We’ve already seen how to use yum to fetch and install a package from the repos. If you have the package on your disk, yum --nogpgcheck localinsta­ll package-name will install the package and automatica­lly check and install dependenci­es from the repos.

Use yum list package-name to search the repos for a particular package. If you don’t know the name of the package, you can search for a string in the name, descriptio­n, and summary of all the packages with yum search keyword . You can also use yum provide filename to search packages that provide a package or a library. If you have configured third-party repos, you can use yum list extras to see a list of packages that were installed from repos outside of the main CentOS repository.

Similarly, updating a CentOS installati­on is also fairly straightfo­rward with yum. Use yum check-update to check for available updates. While a simple yum update will install all available updates, you can update a particular package with yum update package-name .

Run yum clean packages regularly to ensure the packages are cleared out from under the /var/cache/yum directory. If yum throws a tantrum while you’re installing packages, you can refresh the metadata informatio­n about the packages with yum clean metadata or clear the whole cache with yum clean all .

If you need some hand-holding, tap into the expansive CentOS community over forums, mailing lists and IRC. The DIYers among you will definitely appreciate the large amount of documentat­ion hosted on the project’s website and from other third-party sources and books. While the project itself doesn’t have a formal paid support structure, there are a number of companies that support CentOS in a profession­al setting.

 ??  ?? Using third-party repos, you can easily flesh out a CentOS installati­on as a full-fledged desktop, but be aware that they aren’t officially approved.
Using third-party repos, you can easily flesh out a CentOS installati­on as a full-fledged desktop, but be aware that they aren’t officially approved.
 ??  ?? CentOS now uses the FirewallD interface instead of iptables. This new interface uses the concept of zones, each of which house services according to the level of trust.
CentOS now uses the FirewallD interface instead of iptables. This new interface uses the concept of zones, each of which house services according to the level of trust.
 ??  ?? The ClearOS box marketplac­e includes several free (and some paid) applicatio­ns and services to give wings to the barebones install. ( seePointan­dClickServ­ersbox,right.)
The ClearOS box marketplac­e includes several free (and some paid) applicatio­ns and services to give wings to the barebones install. ( seePointan­dClickServ­ersbox,right.)
 ??  ??

Newspapers in English

Newspapers from Australia