Linux Application Development For The Enterprise (Charles River Media Programming)

 < Day Day Up > 


Today’s computers are not limited to Enterprise-level servers alone; a desktop or a laptop computer has almost become an essential piece of equipment for a normal household, very similar to a TV or a VCR. Therefore, the operating systems should be as user-friendly as possible. In fact, the operating system running on a home-based desktop computer should provide more user-friendly interface than a more robust architecture. The majority of home-based users are giving priority to more GUI-based fancy features and are not caring even if the system hangs and they have to reboot the computer several times a day. Hence, for an operating system such as Linux, which is built on a UNIX-based robust architecture, it is necessary to add some fancy features so that the common user community can accept it on their home-based desktops and laptops. For this reason, the Linux developer community has put tremendous efforts into designing state-of-the-art desktop environments, as discussed in this section.

The Desktop

Similar to the Microsoft Windows operating system, the Linux operating system also provides two ways to interact with the user—the graphical desktop and the command prompt. Because Linux was developed on the concepts of UNIX, the command line interaction with the user is very strong. Everything that you can do in the graphical desktop can also be done at the command prompt. In fact, the command line mode forms the core of Linux, over which the graphical desktop is built using the X-Windows architecture. There are different types of desktop systems developed by different organizations. However, KDE and GNOME desktops have attained a maturity level that can be compared with any commercial operating system desktops such as Microsoft Windows and MacOS. They are developed and maintained by open source developer groups. KDE stands for K Desktop Environment developed by the group www.kde.org. GNOME desktop is developed by the GNOME developer group www.gnome.org. Most of the prominent Linux distributions come with both the KDE and GNOME desktop environments. At the time of writing this book, KDE 3.1 and GNOME 2.2 are the most recent releases. These organizations are continuously working on improving the desktops and providing a set of software tools that work with their respective desktop libraries. You can build powerful GUI-based applications for these desktops, in a way similar to the traditional Windows applications. In later chapters, we will take a closer look at the tools available on the market that let us build GUI applications for the Linux platform.

Starting from Release 8.0, Red Hat provides a very similar look and feel to the desktop with their Red Hat Blue Curve desktop theme, whether you are using the GNOME or KDE desktop environment. Figure 2.5 displays a typical Red Hat Linux 8.0 or 9.0 desktop.

Figure 2.5: Typical Red Hat Linux 8.0/9.0 desktop.

The different items displayed in the figure are annotated to describe what they represent. For example, the red hat icon on the bottom panel is the starting point to launch an application and provides a start menu. Each time you log in to your desktop, you can choose either KDE or GNOME or any other desktop. You can set one of the desktops as default in the login screen. To exit one desktop and start another, just log out of the desktop session and re-log in to the desired desktop in the login screen.

File Managers and Browsers

A file manager is an application that displays a list of directories and their contents in a scrollable graphical window. The KDE desktop comes with the Konqueror file manager, and the GNOME desktop comes with the Nautilus file manager. For convenience, we will discuss the Konqueror here; you are advised to explore the Nautilus file manager on your own. Both file managers provide very similar features.

The Konqueror is an open source file manager and Web browser. Functionally, it resembles the Windows Explorer of the Microsoft Windows operating system Using Konqueror, we can see the directories and their contents in the Linux file systems. It also acts as a universal viewer; you can view the contents of the many file types without opening the file with its associated application. With the directory and file listings, you can see their properties such as size, permissions, last modified timestamp, and so on. You can see the contents in different view modes, including Icon View, MultiColumn View, Tree View, Detailed List View, and Text View. This can be done by choosing the View ® View Mode from the Konqueror menu and then selecting the appropriate view mode. Figure 2.6 displays the Konqueror file manager window in a Red Hat Linux 8.0 /9.0 desktop. Figure 2.7 illustrates how to choose the different view modes to view the contents of the file manager. However, the View Mode option is not available in the View menu if you are browsing a Web page.

Figure 2.6: Konqueror file manager in Red Hat Linux 8.0/9.0.

Figure 2.7: Choosing different View modes in Konqueror.

Figure 2.8 displays the changed view of Konqueror’s contents when the Detailed List View mode is selected in the menu.

Figure 2.8: Konqueror contents in Detailed List View mode.

As a browser, Konqueror is HTML 4.0 compliant, supports ECMA Script/JavaScript, Java applets, Cascading Style Sheets (CSS), and Secured Socket Layer (SSL) protocol. You can configure Konqueror browser settings to suit your needs. The configuration screen is displayed by choosing Settings ® Configure Konqueror… in the menu. In the displayed window, you can set your choices for settings such as appearance and HTML/Java/JavaScript/PlugIns-related choices, cookie policy and management, style sheet settings, and so on. When the Konqueror is used as the file manager, you can perform drag-and-drop operations on items from the Konqueror window to another Konqueror window, or to another application, or to the desktop. When it is used as a browser, you can drag images and HTML links and drop them to the target objects discussed earlier. You can invoke the Find Files dialog from Konqueror menu, which displays the dialog embedded within the Konqueror window. Figure 2.9 displays the Konqueror window in a SuSE Linux 8.1/8.2 desktop, and Figure 2.10 shows the embedded Find Files dialog.

Figure 2.9: Konqueror window on a SuSE Linux 8.1 desktop.

Figure 2.10: Konqueror window embedding Find Files dialog.

As mentioned earlier, Konqueror may be used to view Web pages as a browser. Figure 2.11 displays a Web page being viewed in a Konqueror window.

Figure 2.11: Konqueror as a Web browser.

In addition to Konqueror, the Linux system also comes with another open source browser called Mozilla™, which originated from the Netscape® Navigator and is maintained by the virtual organization www.mozilla.org. Additionally, Mozilla comes with a composer tool, which may be used to edit or create Web pages in a WYSIWYG (What You See Is What You Get) style. Although you design your Web page in a way similar to how you create a document in a word processor, the composer automatically writes the HTML code for you behind the scenes. This makes it very easy for you to develop HTML pages for the Internet, an intranet application, or HTML-style help guides for your applications.

The Shell Prompt

As mentioned earlier, the command line is most commonly used by many UNIX/Linux veterans due to the associated ease of use and performance. A shell is an environment with which the user interacts by passing shell-specific commands, which are interpreted and executed by the associated shell program. As the name suggests, a shell is a program that hides the critical parts of the kernel and exposes the kernel’s functionality to the user through a set of user-friendly commands. Typically, shells are capable of executing (or spawning running processes of) any executable program or a shell script. There are several shells that have become popular in the UNIX environment over a period of time. Because Linux is architecturally similar to UNIX, all the better-known UNIX shells have been ported to Linux. Examples of popular Linux shells are Borne shell (sh), Korn shell (ksh), C-shell (csh), Borne-again shell (bash), and so on. There are similarities and differences between the various shell environments, which we will discuss in more detail in Chapter 4 Shell Scripting Explorer. For now, what is required is a shell prompt to execute shell commands. Every user defined in the system may have one of the shells as default, so that the user will be able to start interacting with the operating system/kernel through the shell after logging into the system. This default shell is set in the user’s profile file when the user is created and can be changed by the administrator at any time. Also, the user can switch from one shell environment to another for the currently logged session without changing the default shell. Microsoft Windows-based users may visualize the shell prompt as something similar to the DOS prompt (such as C:). However, the Linux shell (or command line) is very powerful and flexible. In fact, it is not surprising to say that every Enterprise-class application in the Linux/UNIX environment uses shell script(s). Figure 2.12 displays a typical shell prompt window in a Red Hat Linux 8.0/9.0 environment, and Figure 2.13 displays the same in a SuSE Linux 8.1 system.

Figure 2.12: Shell prompt window on a Red Hat Linux 8.0/9.0 system.

Figure 2.13: Shell prompt window in a SuSE Linux 8.1 system.

Most of the Linux commands are documented in the form of manual, or man, pages. These are usually installed along with the operating system. When you are not sure of the syntax of a command, you can check the man pages by typing the following command at the shell prompt:

[root@etslinux root] man <command> [root@etslinux root] man useradd

The first line provides the general syntax of the man command, while the second line gives an example to view the manual page for the useradd command. The manual pages are simple files formatted for general viewing, and are usually available for core Linux commands and not for the graphical tools provided by GNOME and KDE desktops. We will go through some commonly used commands in later sections of this chapter.

Users and User Groups

Like any other multiuser operating system, Linux provides a multiuser environment. The system administrator creates and maintains the users and groups on a Linux system. Individual user accounts provide identification to specific users and help to create a secure environment. Each user is identified with a user id and password. Users are accountable for the commands (and processes) they execute, and their access to specific files and programs is controlled through file-level and directory-level permissions. Groups of users are maintained to facilitate providing the same level of permissions to all users within that group. An application may be designed to permit access to certain individual users or one or more groups of users; by incorporating process-level logging, it is very easy to investigate which user or which group could have executed an application improperly. Also, by defining different users (and groups) for different tasks, it is possible to implement role-based authentication of process execution.

The system administrator is identified with the user id root, very similar to the Administrator user id on a Windows NT/2000/XP environment. People who know the password to the root user account act as system administrators and can execute any command on the system. By improper use of the root account, an administrator could cause damage to the system. This is the reason that the same person who acts as administrator might also have a different user account while working as a normal user. It is not a good idea to use the root account for regular use or programming tasks.


 < Day Day Up > 

Категории