Tasman Hayes – Page 3 – Smart Web Developer

Skip to the content
Categories
Linux

## What’s the Best Linux Distro according to Google?

- Post author
  By Tasman Hayes
- Post date
  August 4, 2010
- 1 Comment on What’s the Best Linux Distro according to Google?

What’s the best Linux distribution? Here are the top Linux distros according to global search volumes in Google.

### Best Linux Distro by Number of Google Searches

One way to find the most popular Linux version is to look at the number of Google searches.

Here’s the most popular Linux distributions by number of general searches:

[table id=1]

(Source: Google Keyword Tool, last updated 3 August 2010)

These search volumes can be interpreted as the level of interest and activity for a particular Linux distro. You could argue a Linux distro gets more searches because it has more problems!

It’s mostly the usual suspects at the top of the table: Ubuntu, Debian, Fedora, Red Hat, Suse, CentOS, Gentoo, Mandriva (formerly Mandrake) & Knoppix. The KDE version of Ubuntu, Kubuntu, pops into the top ten with the same number of searches as Mandriva. Linux Mint, a distro derived from Ubuntu, focussing on usability, is ranked twelfth.

Ubuntu is the gorilla in the room, with 56% of searches. Wow. I knew Ubuntu was popular, but I had no idea that it is seven times more popular than any other distro.

A surprise for me was to find gOS, a Linux version I hasn’t heard of, in the top ten. gOS or Good OS is an Ubuntu derivative focussed on web-based applications (like Google Docs). It looks like the gOS distribution hasn’t been updated since 3 January 2009. For an eighteen month old distro to have this much popularity, gOS must have something special. The screen shots look really good, showing a sexy interface, that’s at once Mac-like, but also unique.

### Notes on General Search Volumes

Note 1: These search numbers are from the Google Keyword Tool for phrase matches, which means any search containing the keyword is included in the search volume. For example, the searches “ubuntu”, “install ubuntu”, “ubuntu iso”, “download ubuntu” would all be included in the search volume numbers for Ubuntu above.

Note 2: These two major Suse distros, openSUSE (open source) and Suse Linux Enterprise (commercial), can’t be meaningfully separated at the level of searches. Their search numbers are combined above.

Note 3: Puppy Linux, Arch Linux and other Linux distros where I’ve added “linux” to their keywords may be disadvantaged in the measure. Since they don’t have a unique brand name, I’ve had to add “linux” on the end. (C’mon, I can’t count all the searches for “puppy” towards Puppy Linux!)

### Popular Linux Distros By Number of Download Searches

The number of general searches for a Linux distro names indicates the current popularity of a distro. The search volumes above include queries like “update mysql on centos”. What the numbers of general searches doesn’t show, is what distros people are searching to install.

For that reason, I’ve compiled most popular Linux distributions by number of download searches:

[table id=2]

(Source: Google Keyword Tool, last updated 3 August 2010)

These search volumes can be interpreted as what versions of Linux people are actually installing.

There are some big differences in the number of download searches compared to the number of general searches. Fedora and Red Hat take positions two and three for download searches, ahead of Debian. Gentoo, popular in general searches, falls to position 14 for download searches. Downloading gOS seems less popular than just searching about it, with gOS ranking 17th in download searches, while being 10th for general searches.

Just because an operating system is a popular download, it doesn’t mean it’s actually getting used a lot. It’s more than common for Linux distros to just be downloaded for people to take a look.

Puppy Linux (from general search rank 15 to download rank 8), Arch Linux (from rank 16 to 14), Sabayon (from rank 28 to 18) and Linux Mint (from rank 12 to 10) are disadvantaged in the general search numbers due to the lack of a unique brand keyword.

### Notes of Linux Download Search Volumes

Note 1: These search numbers are from the Google Keyword Tool for phrase matches, so, for example, searches for “download ubuntu” and “download ubuntu 8.04” “download ubuntu hardy heron” will be counted towards the searches for “download ubuntu”. Other download phrases that don’t include the words “download ubuntu” in that order are not included, e.g. “ubuntu download” or “get ubuntu”. These search volumes for these keywords could have been included, but these numbers are meant as an indicator of popularity only.

Note 2: Linux variants that were disadvantaged in the general search numbers above by having “linux” appended to their name (e.g. “puppy linux” instead of “puppy”) are probably more fairly represented in table of download search volumes. While we needed the phrase “puppy linux” for general searches, the phrase “download puppy” is probably specific enough, rather than needing “download puppy linux”. (Or perhaps there are children out there right now, hoping to download a puppy…)

### What Version of Linux does Google use?

Almost half of Google’s employee use Google’s custom version of Ubuntu, called Goobuntu. Note that Goobuntu is not available outside Google.

So there’s a big vote for Ubuntu.

I don’t know if Goobuntu is also used on Google’s servers. Mark Shuttleworth suggests Google probably uses a variety of Linux variants.

### Best Linux Desktop Distro

There is no best Linux desktop distro. The distros are different. They suit different people.

For example, some distros are simple, using the maxim “just one application for each job”, while other distros are feature rich. There are distros that focus on work well out of the box, providing accelerated graphics drivers, Flash and common video formats at install time, while other distros focus on power users or using only pure open source. Some distros provide powerful graphical environments like Gnome or KDE, while others use a lightweight graphical environment like Xcfe, or a bleeding edge graphical environment like Enlightenment.

With the intelligence and passion that has gone into Linux’s software engineering, there are many excellent Linux desktop distros. You’re probably best off trying a LiveCD, USB key or VM version to see which one works best for you.

If you’re looking for a good starting point, go for Ubuntu.

### Best Linux Distro on a USB Key

My suspicion is that Puppy Linux would take the crown on this one. Why? It’s small. It’s very fast – it runs entirely from the computer’s RAM. It’s compatible with Ubuntu packages, so there’s access so an incredibly large software base.

If you are using your USB key Linux for specific tasks, such as system recovery or disk partitioning, you might select another more specific distro, like SystemRescueCd or Parted Magic.

### Best Linux Server Distro

Are you looking for the best Linux server distro to run your web server or database on?

The requirements for a Linux server are quite different to a Linux desktop. Reliability, scaleability & security are more important for a server, as a server is shared by many users. Slow service, no service or being hacked has a bigger impact on a server.

Here I would tend to steer towards the Linux distros which have existing massive deployments, as their widespread use will tend to have flushed out most scaleability, reliability & security issues. Widespread deployment also typically means there is a wider community for support.

The Linux distros with massive server deployments are CentOS, Debian, Red Hat, Ubuntu, Fedora, Suse, Gentoo, Mandriva, and for Japan, Turbolinux. All of these Linux variants are probably are good choice for production use.

Here is each distribution’s marketshare of webservers, as measured by w3techs.com:

[table id=3]

(Source: Historical trends in the usage of Linux versions for websites,
last updated 3 August 2010)

If you look at the stats or graph on the source webpage, you’ll see the proportion of webservers using CentOS & Ubuntu is climbing, and for all other major Linux variants, it’s falling. It’s worth noting that the use of the Linux variants whose proportion is falling is probably still increasing, as the number of webservers in the world is increasing.

There is also a decision to be made between commercial offerings and free software. The commercial offerings have paid support, which could be invaluable if there are problems. Note I have seen several posters on the web, running both small and large Red Hat deployments, saying their experience of Red Hat’s support has not been good.

If you are running Oracle, consider running Oracle Enterprise Linux, which is based on RHEL. Oracle have been enhancing Linux for their database for many years now.

### CentOS

CentOS is a free clone of Red Hat Enterprise Linux (RHEL), built from Red Hat’s source code. You can take almost everything good I say about CentOS and apply it to RHEL. Red Hat has a reputation from being conservative with the features it puts into RHEL, so it is stable and well tested. Apparently Red Hat puts the more bleeding edge features into Fedora first.

### Personal Experience of CentOS, Debian & Ubuntu for Server Use

I’ve got a fair bit of driving time on CentOS for production web & database servers. At first I found CentOS very primitive, with fairly low-brow terminal defaults (e.g. no use of color). Over time, I come to appreciate the strength and scaleability of CentOS. It works very well with 16GB of memory and 16 cores.

I’ve found CentOS to be rock solid. I have never had a server crash for the four thousand websites we’ve had running on it. Despite having some very large MySQL and PostgreSQL databases, I have had one only data corruption in 2008. This was in a forty five million row MyISAM table, and the issue could have been MySQL code or the disk controller hardware rather than CentOS.

Adding software in CentOS, for example PHP extensions, to CentOS has been a snap. Everything has been a single line install, and has worked first time.

If had a production Debian server for awhile. I found Debian’s directory layout and terminal defaults helped me be more effective. As well as web and database duties, the server also served HD broadcast-quality video downloads. Debian performed flawlessly, though the server was never seriously loaded. We did have small issues with the default PHP extensions (e.g. the gd graphics library, which needed to be recompiled for our purposes).

I’ve only used Ubuntu as a server in a development VM. It worked perfectly, operating very similarly to Debian. (Ubuntu is in fact based on Debian.)

### Best Linux Server Distro Conclusions

Any of the Linux distributions in massive deployment should work well for you.

If I personally had a large, mission critical system I would use RHEL or it’s free clone CentOS. Half of the world’s webservers are running Red Hat or CentOS, and I know from experience they are reliable & scaleable. If I had a non-critical system, I would love to try out Ubuntu to see if it works as well as a server as it does for desktop.

### Can I Use the Desktop Version of a Distro as a Server?

Many distros have a server version and a desktop version. You can use the desktop version as a server – Apache and MySQL are usually only a few clicks or commands away from being installed & activated. Using the desktop version of a Linux distro is fine for development.

For production servers, always use the server version of a distro. The server versions configured & tuned for server tasks. For example, there are several disk IO schedulers for Linux. The default disk IO scheduler for the desktop version of a distro might perform badly for a database server.

### Should I Use the 32-bit or 64-bit Version of my Distro?

Linux Server distros usually come in a 32-bit or 64-bit version. Which should you use?

32-bit is used by the majority of servers out there, and hence has had most issues fixed. The downside is you’re limited to 4GB of RAM.

We used to have frequent issues with 64-bit. The kernel was fine, but the 64-bit versions of the software frequently had bugs or interoperability issues. 64-bit is now common enough that most of the issues have been worked out, and I haven’t had and 64-bit issues for the last year.

64-bit software is usually a bit faster and uses more RAM.

We have frequently had circumstances where we wanted to add RAM to a server to increase capacity, e.g. for the Linux file cache, memcached, database cache or full text search cache, but the server was running a 32-bit distro and RAM was already at the 4GB limit. I recommend to run the 64-bit version of your distro, so you have the flexibility to add over 4GB of RAM to your servers. You might even get a bit of a performance boost!

### Conclusions for Choosing Your Linux Distro

The short answer is for many people, the best linux distro for servers is CentOS, and the best Linux distro for desktops is Ubuntu.

Comments, corrections, feedback and “you forgot this obvious important Linux distro” messages welcome!

- Tags
  CentOS, Linux, Ubuntu

Categories
Apache

## The Six Most Common Htaccess Problems and How to Fix Them

- Post author
  By Tasman Hayes
- Post date
  August 3, 2010
- 15 Comments on The Six Most Common Htaccess Problems and How to Fix Them

Is your Apache htaccess not working? Here are the top reasons why an htaccess file may not work, and how get your htaccess working.

### Htaccess Problem #1: No Dot Before the Filename

The .htaccess file’s filename must start with a dot, like so:

    .htaccess

Files and directory names starting with a dot are treated as hidden files by Unix, Linux & Mac. The htaccess file is hidden so it doesn’t distract from normal web content like HTML files. See hidden files for more information.

Without the dot at the beginning, Apache will ignore the htaccess file.

### Htaccess Problem #2: Filename Not All Lowercase

If an htaccess file’s name contains uppercase letters, it generally will not work on Linux or Unix. This is because filenames on Linux and Unix are usually case sensitive. If an htaccess file has any uppercase letters, e.g. `.HTACCESS` or `.HTaccess`, Apache won’t find the htaccess file. The htaccess is ignored.

An htaccess file containing uppercase letters generall will work on Windows and Mac. This is because filenames on these platforms are generally case insensitive. I’d recommend sticking with lowercase, so your websites are portable to Linux servers. The use of uppercase letters could also circumvent Apache directives designed to prevent the contents of .htaccess files read from the web.

### Htaccess Problem #3: Filename Misspelt

Common misspellings of the htaccess file’s name are `htacess` and `htacess`. Check the filename has two c’s and two s’s.

### Htaccess Problem #4: Htaccess Disabled by AllowOverride Setting

On some servers, Apache is configured to ignore some or all directives in .htaccess files. This is for security reasons. The `AllowOverride` directive controls which features will be allowed in .htaccess files. For example `AllowOverride` `None` can turn off htaccess files for a folder and its subfolders.

Check your Apache configuration file for which `AllowOverride` directive is applied to the directory containing your problem htaccess file.

If you’re not sure which configuration file to look in, start with the main Apache configuration file `httpd.conf` or `apache2.conf`. If your website is configured in a file included by httpd.conf (e.g. a virtual hosts configuration file), you will need to look in that file. See Location of httpd.conf on CentOS, Ubuntu, Mac and others to locate your httpd.conf.

To enable using a .htaccess file, change `AllowOverride` `None` to `AllowOverride` `All`.

For example, for a CentOS 5.3 server, I needed to change the `AllowOverride` setting in the file `/etc/httpd/conf.d/virtualhosts.conf`.

`httpd.conf` before:

    Options FollowSymLinks
    AllowOverride None

`httpd.conf` after:

    Options FollowSymLinks
    AllowOverride All

Be aware that enabling htaccess files has security implications, as htaccess files override your Apache configuration. For example, if your site provides uploads, a hacker could potentially upload a .htaccess file to your server and use it to gain access to your server. There are options to `AllowOverride` that restrict the directives that will be used from a .htaccess file. See the documentation for AllowOverride.

### Htaccess Problem #5: Incorrect Syntax

If Apache can’t understand a line in your htaccess, it will usually cause an error from Apache. The error may show in the web browser when a webpage causes Apache to read the .htaccess file.

To demonstrate this, I added a bad line to the Smart Web Developer .htaccess file. See if you can spot the bad line. 🙂

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    utter rubbish config line here

This causes the following error in the browser:

> Internal Server Error

> The server encountered an internal error or misconfiguration and was unable to complete your request.

> Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

> More information about this error may be available in the server error log.

The reason for the error is logged to an Apache error log:

    [Sat Feb 26 18:21:09 2011] [alert] [client 127.0.0.1] /Users/taz/Sites/smartwebdeveloper/.htaccess: Invalid command 'utter', perhaps misspelled or defined by a module not included in the server configuration, referer: http://smartwebdeveloper.com/

Another option to debug Apache syntax is to put the the .htaccess contents into the main Apache configuration file under a <Directory> directive. Apache has an option to parse and check its configuration files. To run an Apache syntax check, run: `httpd` `-S`.

### Htaccess Problem #6: Htaccess Settings Overridden by Another Htaccess File

Multiple .htaccess files may be read and applied if a web request is made to a file in nested directories. Typically all .htaccess files in the path between the website’s root directory and the requested file’s directory will be read and applied in order. As a result, an htaccess file in a more deeply nested directory can override the settings made by an htaccess in a higher directory.

Is there another .htaccess file in another directory in the path to your webpage? That htaccess file the may be overriding the settings in the htaccess you’re looking at.

On Mac, Linux & Unix, you can find all .htaccess files on your website in the terminal:

    find /path/to/website/root -iname .htaccess -print

### Conclusion

Hope this article helped you! If it did, write me a comment and let me know.

- Tags
  .htaccess, Apache

Categories
Linux

## How to Find a Yum Package

- Post author
  By Tasman Hayes
- Post date
  June 9, 2010

Yum (Yellowdog Updater Modified) is a utility for finding, installing, updating and removing software on Linux. It runs on rpm-compatible Linux distributions, e.g. RedHat, Fedora, SUSE, CentOS, Mandriva.

### Get the Yum Package Name by Just Using the Software’s Name

When you want to install some software, sometimes you’re lucky and can use the software’s name. For example, installing the GNU screen terminal utility is as simple as:

    sudo yum install screen

Guessing the package name doesn’t always work. For example, try installing vim (an improved vi text editor with syntax highlighting) with just the package name vim:

    [root@sayonara ~]# yum install vim
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * rpmforge: ftp-stud.fht-esslingen.de
     * base: centos.aol.com
     * updates: mirror.nexcess.net
     * addons: centos.aol.com
     * extras: centos.mirror.seiri.com
    Setting up Install Process
    Parsing package install arguments
    No package vim available.
    Nothing to do

In this case yum reports: `No package vim available`.

Similarly, trying to install the MySQL database with just `mysql` as the package name, will probably result in the same error `No package mysql available`:

    sudo yum install mysql

Are vim and MySQL really not available for installation with yum?

### Find a Yum Package Using Yum Search

The following yum command searches for different pacakages mentioning `vim`:

    [root@sayonara ~]# yum search vim
    Loaded plugins: fastestmirror, priorities
    Loading mirror speeds from cached hostfile
    * rpmforge: ftp-stud.fht-esslingen.de
    ================================================================================= Matched: vim =================================================================================
    vim-X11.i386 : The VIM version of the vi editor for the X Window System.
    vim-common.i386 : The common files needed by any version of the VIM editor.
    vim-enhanced.i386 : A version of the VIM editor which includes recent enhancements.
    vim-minimal.i386 : A minimal version of the VIM editor.

Then just pick the package you want to install, for example:

    sudo yum install vim-minimal.i386

Another example is looking for the package to install MySQL:

    [root@sayonara ~]# yum search mysql
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * rpmforge: ftp-stud.fht-esslingen.de
     * base: mirror.rackspace.com
     * updates: mirror.cs.vt.edu
     * addons: yum.singlehop.com
     * extras: mirror.cs.vt.edu
    =================================================================== Matched: mysql ====================================================================
    mod_auth_mysql.i386 : Basic authentication for the Apache web server using a MySQL database.
    qt-MySQL.i386 : MySQL drivers for Qt's SQL classes.
    MySQL-python.i386 : An interface to MySQL
    aimsniff.i386 : Monitor and archive AOL Instant Messenger messages
    apr-util-mysql.i386 : APR utility library MySQL DBD driver
    bytefx-data-mysql.i386 : Database connectivity for Mono
    cacti.noarch : Complete network graphing solution designed on top of RRDTool
    cacti-docs.noarch : Documentation for the cacti network graphing solution
    freeradius-mysql.i386 : MySQL bindings for freeradius
    freeradius2-mysql.i386 : MySQL support for freeradius
    gtksql.i386 : Graphical database query tool for MySQL and PostgreSQL
    krecipes.i386 : Recipe manager
    libdbi-dbd-mysql.i386 : MySQL plugin for libdbi
    lighttpd-mod_mysql_vhost.i386 : Virtual host module for lighttpd that uses a MySQL database
    motion.i386 : Video-surveilance system
    mtop.noarch : Tool to monitor a MySQL database
    mysql.i386 : MySQL client programs and shared libraries.
    mysql-bench.i386 : MySQL benchmark scripts and data
    mysql-connector-odbc.i386 : ODBC driver for MySQL
    mysql-devel.i386 : Files for development of MySQL applications
    mysql-server.i386 : The MySQL server and related files.
    mysql-test.i386 : The test suite distributed with MySQL
    mytop.noarch : Top clone for MySQL
    nagios-plugins.i386 : Host/service/network monitoring program plugins for Nagios
    ndoutils.i386 : Nagios plugin to store Nagios data in a relational database
    pdns-backend-mysql.i386 : MySQL backend for pdns
    perl-Acme-BeyondPerl-ToSQL.noarch : Perl module to have RDBMS calculate instead of Perl
    perl-Class-DBI-mysql.noarch : Perl module that extends Class::DBI for MySQL
    perl-DBD-MySQL.i386 : A MySQL interface for perl
    perl-DBD-SQLite.i386 : Small fast embedded SQL database engine
    perl-DBD-mysql.i386 : Perl module that implements a MySQL driver for DBI
    perl-DBIx-TableHash.noarch : Tie a hash to a mysql table + SQL utils
    perl-DBIx-TextIndex.i386 : full-text searching in SQL databases
    perl-DNS-BL.noarch : Manage DNS black lists
    perl-DateTime-Format-MySQL.noarch : Perl module to parse and format MySQL dates and times
    perl-MySQL-Config.noarch : Perl module to parse and utilize MySQL's /etc/my.cnf and ~/.my.cnf files
    perl-Qmail-Mysql.noarch : Perl module for mysql database used by qmail-mysql
    perl-Time-Piece-MySQL.noarch : Perl module adds MySQL-specific methods to Time::Piece
    php-adodb.noarch : Portable Database Library for PHP
    php-mysql.i386 : A module for PHP applications that use MySQL databases.
    php-pdo.i386 : A database access abstraction module for PHP applications
    php-pear-MDB2-Driver-mysql.noarch : MySQL MDB2 driver
    php-pecl-session_mysql.i386 : PECL package to save sessions to a MySQL database
    phpmyadmin.noarch : Web application to manage MySQL
    proftpd-mysql.i386 : Module to add MySQL support to the ProFTPD FTP server
    pure-ftpd.i386 : Lightweight, fast and secure FTP server
    python-sqlalchemy.noarch : SQL toolkit and object relational mapper for Python
    qt4-mysql.i386 : MySQL drivers for Qt's SQL classes
    rsyslog.i386 : Enhanced system logging and kernel message trapping daemons
    rsyslog-mysql.i386 : MySQL support for rsyslog
    sphinx.i386 : Free open-source SQL full-text search engine
    synbak.noarch : Universal backup system
    sysbench.i386 : System performance benchmark
    unixODBC.i386 : A complete ODBC driver manager for Linux.

Looking over the available packages, the package for installing the MySQL database would be `mysql-server.i386`.

More information is available at the yum homepage.

- Tags
  CentOS, Linux

Categories
Apache

## How to Redirect a Domain Using an Apache .htaccess File

- Post author
  By Tasman Hayes
- Post date
  March 9, 2010
- 1 Comment on How to Redirect a Domain Using an Apache .htaccess File

### Why Redirect From Your www Domain to Your www-less Domain

For example, why would you redirect from www.smartwebdeveloper.com to smartwebdeveloper.com.

To search engines these are two different domains with identical content.

Your incoming links may get spread between the two domains – some links to pages in the www-prefixed domain and some links to the www-less domain.

Your SEO link juice gets spread between two sites. You could end up with two sites with two different page ranks, instead of a single site with a higher page rank than both.

### Forward www to www-less Domain Using .htaccess

A good solution is to forward all pages at the www domain to the non-www domain. An HTTP response code of 301 – Moved Permanently – is the best response, because it says “this page isn’t here, this is it’s permanent URL”, because Google will still count any links to the www-prefixed domain towards your sites rankings.

To do this, in the root HTML directory for the www-prefixed domain, create a .htaccess file like the following:

    #
    # [taz] Redirect requests for www.smartwebdeveloper.com to
    # smartwebdeveloper.com using Apache's rewrite engine.
    #
    RewriteEngine on

    # [taz] Redirect requests for www.smartwebdeveloper.com,
    # with an optional terminating '.' (DNS domains can be terminated with '.'),
    # and optionally ending with :port (e.g. ':443' for SSL).
    RewriteCond %{HTTP_HOST} ^www\.smartwebdeveloper\.com\.?(:[0-9]*)?$ [NC]

    # [taz] Do a HTTP 301 redirect (i.e. page permanently moved)
    # to the same URI at smartwebdeveloper.com.
    RewriteRule ^(.*)$ http://smartwebdeveloper.com/$1 [R=301,L]

If you have troubles getting the .htaccess to work, try this .htaccess troubleshooting article.

Tested on CentOS 5.3.

- Tags
  .htaccess, Apache

Categories
CentOS

## Install the PHP DOM Extension on CentOS – the Easiest Way

- Post author
  By Tasman Hayes
- Post date
  March 9, 2010
- 28 Comments on Install the PHP DOM Extension on CentOS – the Easiest Way

Here we cover the fastest, most effective way to get the PHP DOM extension installed on CentOS. If you’ve just found out you need to install this extension, but don’t really know what it is, we’ve included some background first.

### What is DOM?

> “The Document Object Model (DOM) is a cross-platform and language-independent convention for representing and interacting with objects in HTML, XHTML and XML documents.” (Source: DOM in Wikipedia.)

### What is PHP DOM extension?

> “The DOM extension allows you to operate on XML documents through the DOM API with PHP 5.” (Source: Introduction to the PHP DOM Extension on php.net.)

### How to install the PHP DOM Extension on CentOS

You will need superuser privileges. Run the following command:

    sudo yum install php-xml

Don’t forget to restart Apache so PHP picks up the new extension:

    sudo service httpd restart

### How to Check PHP DOM is Installed

You can see PHP DOM is installed by creating a simple web page that calls the phpinfo() function:

    <?php phpinfo(); ?>

When you go to this webpage in a browser, you should see this output for the dom extension if it’s installed:

> ## dom

> DOM/XML | enabled
> DOM/XML API Version | 20031129
> libxml Version | 2.6.26
> HTML Support | enabled
> XPath Support | enabled
> XPointer Support | enabled
> Schema Support | enabled
> RelaxNG Support | enabled

Tested on CentOS 5.3.

- Tags
  CentOS, PHP

Categories
CentOS

## How to Install Vim on CentOS

- Post author
  By Tasman Hayes
- Post date
  March 8, 2010
- 2 Comments on How to Install Vim on CentOS

To install vim, run the following command from a CentOS shell:

    sudo yum install vim-enhanced.i386

Tested on CentOS 5.3 (32 bit).

### How to Find the Yum Package for Vim

To find the command, run:

    yum search vim

The gives you the different packages mentioning vim:

    Loaded plugins: fastestmirror, priorities
    Loading mirror speeds from cached hostfile
    * rpmforge: ftp-stud.fht-esslingen.de
    ================================================================================= Matched: vim =================================================================================
    vim-X11.i386 : The VIM version of the vi editor for the X Window System.
    vim-common.i386 : The common files needed by any version of the VIM editor.
    vim-enhanced.i386 : A version of the VIM editor which includes recent enhancements.
    vim-minimal.i386 : A minimal version of the VIM editor.

- Tags
  CentOS

Categories
CentOS

## How to Find Your CentOS Version

- Post author
  By Tasman Hayes
- Post date
  March 5, 2010

Someone’s given you a CentOS server to do some work on, perhaps putting up a website. “What version of CentOS is it running?”, you ask. “I don’t know” is a pretty common answer, or “version 5, I think”.

The CentOS version tends to indicate the rough age of the software (e.g. Linux kernel, PHP, MySQL) you’ll be using.

Here’s how you can check the CentOS version directly.

### Find the CentOS Version

If you want to know what version of CentOS its running.

To check, `cat` the `/etc/issue` file:

    [root@bijango ~]# cat /etc/issue
    CentOS release 5.3 (Final)
    Kernel \r on an \m

Note the contents of `/etc/issue` is displayed when someone creates a terminal session on the server,
so the system administrator may have edited this file to put in a different message, and potentially deleted the CentOS version information.

This was of checking the Linux distro version was tested on CentOS 5.2, CentOS 5.3, Ubuntu 8.10 and Ubuntu 10.10.

This way of checking the OS version would probably work on Red Hat Enterprise Linux and Debian as well. This is because CentOS is a clone of Red Hat, and Ubuntu is derived from Ubuntu.

- Tags
  CentOS

Categories
Ubuntu

## How to Find Your Ubuntu Version

- Post author
  By Tasman Hayes
- Post date
  March 5, 2010

To get your version of Ubuntu, run either of these commands from a terminal session.

To start a terminal session in Ubuntu’s graphical desktop go to the Applications menu and choose the Terminal item).

There are at least two ways to get the Ubuntu version.

### Find the Ubuntu Version from the /etc/issue File

List the contents of the `/etc/issue` file to see the Ubuntu version.

    taz@tasman-desktop:~$ cat /etc/issue
    Ubuntu 8.10 \n \l

Note that the contents of the `/etc/issue` file is displayed for local terminal logins to Ubuntu. If you don’t see Ubuntu version information like that above, then the system administrator may have edited this file. You can try the next method.

### Check the Ubuntu Version from the /etc/lsb-release File

Displaying the contents of the `/etc/lsb-release` file will tell you the version of Ubuntu you’re running.

    taz@tasman-desktop:~$ cat /etc/lsb-release
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=8.10
    DISTRIB_CODENAME=intrepid
    DISTRIB_DESCRIPTION="Ubuntu 8.10"

These methods were tested on Ubuntu 8.10.

- Tags
  Ubuntu

Categories
Apache

## Httpd.conf’s Location on CentOS, Ubuntu, Red Hat, Mac and Others

- Post author
  By Tasman Hayes
- Post date
  March 4, 2010
- 1 Comment on Httpd.conf’s Location on CentOS, Ubuntu, Red Hat, Mac and Others

Here’s where to find the Apache 2 web server configuration file `httpd.conf` The httpd.conf directory differs across Linux & Unix variants like CentOS, Mac OS X, Red Hat, Ubuntu and XAMPP Mac.

This table lists the httpd.conf location for each operating system:

Operating System / Linux Distro | httpd.conf Location
--- | ---
CentOS 5.2 | /etc/httpd/conf/httpd.conf
CentOS 5.3 | /etc/httpd/conf/httpd.conf
Mac OSX 10.6 Snow Leopard | /etc/apache2/httpd.conf
Mac OSX 10.7 Lion | /etc/apache2/httpd.conf
Red Hat Enterprise Linux Server 5.6 Tikanga (RHEL) | /etc/httpd/conf/httpd.conf
Ubuntu 7.04 Feisty Fawn | /etc/apache2/httpd.conf
Ubuntu 8.10 Intrepid Ibex | /etc/apache2/httpd.conf
Ubuntu 10.10 Maverick Meerkat | /etc/apache2/httpd.conf
XAMPP on Mac | /Applications/XAMPP/etc/httpd.conf

For more specific information on Ubuntu, see httpd.conf location on Ubuntu.

The location for Fedora will likely be the same as CentOS (same distro family).

The location for Debian will likely be the same as Ubuntu (same distro family).

If your operating system or Apache package isn’t mentioned here, you can use the find command on Linux, Unix or Mac to find httpd.conf, e.g.:

    find / -name httpd.conf 2>/dev/null

On Windows, you can use the search facility of Windows Explorer to find httpd.conf.

Additions & refinements welcome!

- Tags
  Apache, CentOS, httpd.conf, Mac, Mac OS X 10.7 Lion, Ubuntu