/, Tools and Tips/Using Open Source Tools for Linux on POWER

Using Open Source Tools for Linux on POWER

What is open source?

Open source software is a valuable resource for the modern computing environment. Essentially, open source software makes the source code available to anyone who uses it; nothing is hidden from the end user. Open source software is not necessarily free, though much of it is. License agreements govern its use; the most popular license is the GNU Public License (GPL).

Open source software is developed by many different sources, including projects done by technical enthusiasts who choose to share their work with others. Commercial companies, such as IBM, contribute to open source to keep good technology in the community and to make sure their proprietary hardware and software is supported by open tools. Anyone who can program, write documentation, or perform some other task associated with software development can help to create open source software — and they do!

Why use open source tools?

Many people choose open source software because it is inexpensive. (Open source software is often free, which is very inexpensive.) Open source software also tends to be very reliable. Because anyone with a technical interest can view the source code, potentially thousands of quality control agents are evaluating the code. Programmers have direct, unfiltered access to users, so problems and bugs are generally common knowledge and get corrected quickly. Also, because nothing is hidden, better technology tends to rise to the top.

For the security-conscious, open source software can bring peace of mind. If you have any doubts about hidden back doors in an application, you can obtain the source code and examine it yourself or have it examined by someone you trust. You can then compile the code yourself to ensure that it is exactly what you expected. When security-related deficiencies are found, the community immediately takes action and suggests patches usually within hours. The official project solution might take a little longer, but it is usually on the order of hours or days. Open source software enables you to take action with your resources if necessary.

Open source software also helps to ensure that technologies don’t get overlooked. Because development is open to anyone interested, you can often find drivers that have been written for obscure hardware. Additionally, you can find support for uncommon protocols by the small community that makes use of them. The fact that Linux is available across the spectrum of IBM hardware is precisely because of this open approach. This helps keep your hardware alive, and helps protect you from losing access to software support for a key technology. If official support for a project goes away, you always have the option to take that support on yourself!

Obtaining open source tools

Obtaining open source software is easy; the Linux kernel itself is open source. When you installed Linux, you started using open source. In addition to the kernel, many other open source packages are included in a Linux distribution such as development tools, libraries, and applications. With all the packages, the source code is available for you, and you can compile any package to optimize or customize it for your use.

In addition to the packages included in your distribution, other open source software is available on the Internet. Some are specialized projects or new technologies that are being developed for the first time, while others are competing approaches to packages included with common Linux distributions. It’s a free market of ideas. The successful ones usually end up being accepted into distributions as contributed or common packages. Some projects even become accepted as part of the Linux kernel, at which point the individual project is usually dissolved and development continues as part of normal kernel maintenance.

SourceForge

SourceForge.net (see Resources) is a popular repository for open source projects. It organizes projects via an easy-to-use Web interface with search capabilities to help you find the projects. Each SourceForge project has version histories, bug lists, discussion groups, documentation, and, of course, source code. If you have an open source project of your own, you can also make use of SourceForge.

RPMs vs. source code

Whenever possible, a pre-compiled binary RPM is the simplest way to use open source software in a Linux POWER environment. All of the software is already in its binary form and simply needs to be installed. This usually takes seconds to accomplish, and the software is immediately available for use.

Because of the way that RPM works, your system is automatically checked for dependencies and compatibility, and you are advised of things that are missing before the software will install. Also, updating, managing, and removing RPM packages is simple. RPMs are desirable whenever possible.

A good repository for RPMs is Rpmfind.net (see Resources). It has a searchable index from many distributions and is a mirror for most major distributions and updates. Any package listed for PPC should be compatible with a POWER system. You can search for either a package name or an individual file contained in a package. You receive results across a spectrum of Linux distributions, including some very obscure ones. Each package listed generally points to the project’s home page as well, so rpmfind might help if you are having problems finding a project resource. For the POWER architecture, any of the RPMs listed as PPC packages will probably work. Be diligent when installing new packages. RPM will help protect you from completely destroying your system accidentally, but using normal precautions such as having a backup and trying it on a non-production system for testing are strongly encouraged.

Working with source code

Because Linux on the POWER architecture is fairly new, not all open source project owners have even thought of it. An RPM package might not be available for those packages. In this case, you must compile the source code yourself. This is generally not difficult for a mature project such as Samba, but might require more work for a more obscure project. You should be cautious about compiling from source on a production system as it might cause problems or void your support for commercial software that you are using on the system.

Linux is essentially the same across architectures; therefore, source code for many projects will work with simply a fresh compile. Source code is generally available as a compressed tar file. Gzip is the most common way to compress, but bzip2 is becoming more popular because it creates somewhat smaller files.

First, you must expand the package. Let’s take use Gimp as an example. Gimp is a photo-editing package that handles a variety of image formats and includes functions found in expensive commercial products.

Figure 1. Gimp in action

To download the Gimp source code, see the link to the Gimp Web site in Resources later in this article. To expand the source code, use the tar -xvjf gimp-1.2.4.tar.bz2 command.

The file is expanded into my current directory. The standard approach is for the source code to be contained in a directory that matches the product name. In this case, it’s in a directory called gimp-1.2.4.

Switch to that directory and you’ll find the source code, some documentation, configure scripts, and README files. Most source packages have a file called INSTALL and one called README. You should read these before you compile the software. By reading these, you can save yourself some trouble by identifying problems before you have them and getting the correct procedures for compiling and installation. Most problems I get when compiling from the source code arise simply because I didn’t follow the directions.

The most common next step is to run the configure script. Configure is part of the autoconf package, which is included with the development tools of your Linux distribution. Quoting Autoconf’s package description:

“GNU’s Autoconf is a tool for configuring source code and Makefiles. Using Autoconf, programmers can create portable and configurable packages, since the person building the package is allowed to specify various configuration options.”

The configure script runs a series of tests on the system to determine the best way to compile the package for your distribution and architecture. It then creates a custom Makefile for your system. If there are problems with compiling on your system, configure tells you. Configure usually lets you customize the features to be included in the compile or lets you provide parameters about locations of libraries or other needed files so that the package can be compiled successfully. To execute the configure script with no additional parameters, use this command:


./configure

Several tests run on the system and end successfully. To build the program, use this command:


make

If the compile has errors, you need to determine the problems and fix them. These errors might not be trivial and might require a good deal of knowledge about your environment and programming in general. If all goes well, we typically install the software with this command:


make install

The files are copied into the correct areas of the system, file permissions are updated, configuration files are copied, and documentation is added to the manual pages.

There are many possible variations for this scenario. These include using switches on the configure script to adjust the features that are compiled into the program, using different commands from the Makefile to adjust how the compile is done, and others.

If a program doesn’t work after you’ve installed it, most Makefiles include an uninstall parameter to remove the software:


make uninstall

Keep in mind that working with raw source code does not enter anything into the RPM database. Software installed this way is unmanaged, so it should be done with care.

Creating custom RPMs

If you intend to work with a lot of pure source code, you should learn more about creating your own RPMs. Creating RPMs is not terribly difficult, though it is beyond the scope of this article. It’s much easier to create an RPM from code that you own rather than code written by a stranger. A good RPM package requires good knowledge of all of the components in a piece of software. Essentially, you create a configuration file, called a SPEC file, which identifies all of the information required for the RPM database. Information about dependencies, the steps to building the file, and post-installation actions are included along with a list of all of the files in the package. RPM uses this SPEC file to compile the code and create a binary package. Check through your source package to see if a sample SPEC file has already been created. Including a SPEC file is becoming a common practice and might allow you to create a custom RPM with little or no work on your part.

Source RPMs

When an RPM is created, there is an artifact called a Source RPM (SRPM). This is a SPEC file combined with source code, designed to build on one or more architectures. This is the best of both worlds! With a source RPM you can custom compile the software on your system, but the finished product will be an installable RPM rather than just the raw binaries. Most packages that are available as pre-compiled RPMs are also available as SRPMs. This can be a simple way to move software across platforms in Linux. When you have success recompiling onto a different platform, consider sharing your finished RPMs with the community.

Useful open source tools

There are many open source tools available. The Linux kernel is actually an open source project. Therefore, it stands to reason that the services that run on top of Linux are also open source projects. For example, DNS, DHCP, FTP, NFS, and many other functions that are taken for granted and included in all common distributions, are open source projects. Here is a list of other open source projects, familiar and unfamiliar, that are available for POWER.

IP Tables

IP Tables is the firewall for the modern Linux kernel. IP Tables is a powerful firewalling subsystem that provides stateful, port-based packet filtering. Stateful packet filtering differs from stateless packet filtering in that the condition of the packet is considered along with its source and destination. For example, it is possible to set up a filter that will drop all ICPM (ping) packets except for those for established connections or connections that are related to established connections. This makes it possible to have a filter that allows replies to outgoing ping requests, but ignores incoming ping requests from stranger systems. IP Tables is included with all common distributions. See Resources for a link to the project home page for iptables.

GCC

The Gnu C Compiler is the foundation for Linux. This open source compiler has been ported to many platforms, with the Linux kernel generally following quickly behind. While not optimized to the degree of commercial compilers like the IBM VisualAge C Compiler (see Resources), it is very effective and usable for real work. A “best practice” for writing portable code in Linux is to ensure that the source compiles with GCC, the cross-platform Linux standard, before anything else. GCC continues to evolve and is available in 32- and 64-bit for POWER. GCC is included with all major Linux distributions. See Resources for the link to the Gnu C Compiler project home.

Apache HTTP Server

Apache was the first real “killer-app” for Linux. Many Web administrators use this excellent open source tool to provide HTTP services. Apache is fast, extensible, and reliable. The IBM HTTP Server uses Apache as a base, adding modules for security and management. Apache is included with all common distributions. See Resources for a link to the Apache project.

OpenSSH

Open SSH is a tool for encrypting information for secure point-to-point networking. With OpenSSH, communications such as telnet, ftp, rpc, and many others can be done safely. OpenSSH uses Public Key Cryptography to secure and authenticate access. When making an ssh (secured-shell) connection to a server, an encrypted tunnel is formed between the two machines with security sufficient to perform administrative functions. SFTP (secured-ftp) provides the functionality of a typical FTP service but without exposing passwords and data. Remote procedure calls executed using OpenSSH can be handled safely and with good assurance that the calling system is authorized. I use OpenSSH every day. OpenSSH is included with all major Linux distributions. See Resources for a link to the OpenSSH project.

MySQL and PostGreSQL

MySQL and PostGreSQL are both mature open source relational database projects. Both are feature-rich, including transactions, wide data type support, and connectivity through ODBC, JDBC, C, C++, and a variety of other languages. Both are ANSI SQL compliant. MySQL is released under the Gnu Public License (GPL). A professional license is also available for use in non-GPL projects. PostGreSQL is released under the BSD license and appears to be free for all use. Links to both of these project home pages can be found in Resources.

FreeSwan (IPSEC)

While OpenSSH provides secure point-to-point connections, Internet Protocol SECurity (IPSEC) provides a secure tunnel into a network, allowing you to connect separate networks through an untrusted connection. FreeSwan is the open source VPN project. It provides both client and server functionality so it can be used to connect to an existing network that uses the IPSEC standard, or to provide a VPN doorway into your network. IPSEC is not included in many Linux distributions because of laws regarding export of strong encryption products. Use of FreeSwan may be restricted in some geographies. Find the link to the FreeSwan project in Resources.

OpenOffice

Who says that office suites are just for laptops? OpenOffice is free, open source, multi-platform, and uses XML for its native file format. OpenOffice can read and write MS Office files. It includes word processing, spreadsheet, presentation, and drawing capabilities. It can connect to several database formats and can use Java through your own JDK. See Resources for the link to the OpenOffice project.

Figure 2. OpenOffice

Gimp

Gimp is a robust open source photo editing package. It handles a wide variety of graphical formats and has functions such as layer editing usually found in expensive commercial programs. Gimp also has scripting facilities that can be used to automate image processing, and it runs on multiple platforms. The link to the Gimp project home can be found in Resources.

Figure 3. Gimp photo editing

Blender

Blender is a 3D modeling and animation program that first distinguished itself by its ability to do 3D modeling with camera motion and lighting in a program size of 1 MB! Blender has gotten a little larger (4.5 MB) and more sophisticated, but it is still open source. The Blender project home link is listed in Resources.

Figure 4. Blender 3D modeling and animation program

Participating in the open source community

Community involvement is an important part of the growth and success of open source software.

Getting support

One of the concerns commonly expressed about using open source software is a perceived lack of support. Support is available, but it might not always follow the traditional paths of commercial support. In some cases, support is arguably better.

Documentation is available online and can range from very professional online manuals to very informal HOWTO files written by individuals.

When the documentation is not enough, other types of support are also available online. Most support is provided through e-mail or newsgroups, methods that don’t require point-to-point contact between the support requester and the provider. When you get support in this manner, you normally don’t communicate with a helpdesk; you communicate with the developers and regular users of the product. When was the last time that you asked for help and got an answer from someone who had actually worked on the source? While this form of support might seem chaotic as compared to a formal helpdesk, it is very effective. Answers to questions can often be retrieved instantly with a simple Google search. If an answer can’t be found, a friendly cry for help on a newsgroup will generally elicit answers within minutes or hours.

Most open source projects use an online program such as Bugzilla, which is also an open source project, to allow users to research and enter bugs. On the occasions when I have done this, I have seen the discussion between the programmers about my bug submission and been able to find the status at any time.

That isn’t to say that phone support is never available. Some projects such as Linux distributions, MySQL, and others have paid support options, which include a traditional helpdesk.

Giving support

Knowledge and experience are the prime currencies in the open source community. As you peruse the support lists, consider taking the time to briefly answer the questions to which you know the answer. Projects that have a lot of participation thrive. Those without participation tend to drop off of the radar screen. If you willingly answer questions for people who are reliving your mistakes, you will be rewarded with ready answers when it’s your turn.

Contributing to a project

If you do serious work with open source projects, you might find areas where you can actually contribute to a project in a tangible way. Programming skill is often needed; however, other skills are needed and often overlooked. Can you write clear documentation? Can you help translate documentation into another language? Do you have subject matter expertise? These are just some of the things needed by open source projects. You might have the key to taking a good project to the level of great or even indispensable. You don’t have to sit on the sidelines. Get involved!

Summary

Open source software is real software developed by a broad range of people. Much of it is of commercial quality, and some projects surpass commercial offerings. Open source does not necessarily mean free, though much of it can be had at no cost. Open source projects receive a lot of scrutiny by experts, so bugs are generally spotted and corrected in short order. If you have any doubts about a project, you can examine and edit the source yourself.

If you are using Linux, you are already using open source software. Your Linux distribution comes packaged with many open source projects, but you are by no means limited to what is in the box. Repositories such as SourceForge provide good tools for finding the right project for your needs.

You can download projects as pre-built RPM files for your distribution, which is the most reliable way to incorporate a new project. But if a binary RPM is not available, you can build from source or from an SRPM. Programs installed from raw source do not register with the RPM database, so you should build RPMs yourself, if necessary, for environments that are RPM managed.

Support for open source projects is available, but it is rarely in the form of a support specialist on the phone. Support is delivered, instead, through e-mail and newsgroups. You have better access to the actual developers in open source projects. The key to success with open source projects is to be aware of what’s happening in the project community. Keep an eye on the support lists, and be willing to give as well as take. Remember, most projects are volunteer efforts, and you might have something tangible to offer. Projects need more than code; they need documentation, organization, and participation.

Open source projects not only belong in a modern computing environment, they provide safe, reliable resources, allowing you to invest your precious IT dollars in the areas where they are most needed.

Resources

• Many open source projects at IBM are available on developerWorks.

• Visit the official Linux kernel Web site.

SourceForge.net is an excellent resource for open source projects. You can add your own projects as well.

• For a repository for pre-built RPMs, visit rpmfind.net.

• Learn more about packaging software with RPM in this developerWorks series: Packaging software with RPM, Part 1,

Part 2, and Part 3.

• The GNU Project Web server provides a central repository for GPL projects.

• Download the Gimp photo editor from the Gimp download page, and browse the Gimp Web site for additional info.

• The home page for IPTables is the home of the netfilter/iptables project.

• Visit the project home for the Gnu C Compiler.

• Download a 60-day trial version of the IBM VisualAge C++ V6.0 for Linux on pSeries and read additional info.

• Visit the Apache Software Foundation for information on the Apache HTTP server and related projects.

• Learn more about the MySQL and PostGreSQL projects.

• Get information on OpenSSH, a free version of the SSH protocol suite of network connectivity tools.

Linux FreeS/WAN provides information on the FreeSwan IPSEC project.

• Visit the project home for the OpenOffice office suite.

• For downloads and documentation on the Blender 3D modeling and animation studio, see the Blender Web site.

• See the Download center for Linux on iSeries and pSeries for additional downloads, education, and documentation.

• Visit the Linux for pSeries home page.

• Find more resources for building Linux apps in Speed-start your Linux app 2003, including a tech support forum.

• To get more familiar with developing on Linux, read “Basic tasks for new Linux developers” (developerWorks, January 2003).

• Find Linux distributions on these Web sites:

Red Hat Linux

UnitedLinux

SuSE Linux

Turbolinux

• Find more resources for Linux developers in the developerWorks Linux zone.

2010-05-26T17:04:47+00:00 April 3rd, 2004|Linux, Tools and Tips|0 Comments

About the Author:

Chris Walden is an e-business architect with IBM's Developer Relations. He is the official Linux fanatic in his hallway and does his best to spread the good news to all who will hear it. In addition to his architect duties, he manages the area's all-Linux infrastructure servers, which include file, print, and other application services in a mixed-platform user environment. Chris has ten years of experience in the computer industry, ranging from field support to Web application development and consulting. You can contact Chris at cmwalden@us.ibm.com.

Leave A Comment