Linux System Administration

Next couple lines describes simplest process of getting started with Perl and CGI on Linux system in particular Debian Linux. Although the following steps are performed on a Debian Linux system they should be valid for all other distributions expect the step of Apache web server installation. First we need to install Apache Web server:

# apt-get install apache2

for RPM based distribution this step could involve yum

# yum install apache2

If you did not get any major errors the apache2 web server should be up and running at this point. Therefore we can navigate to /usr/lib/cgi-bin directory

# cd /usr/lib/cgi-bin

and create a following function based CGI program named hello.cgi:

 
#!/usr/bin/perl -T 
use strict; 
use CGI ':standard'; 
print header; 
print start_html('Hello World'); 
print h1('Hello World'); 
print end_html(); 
exit; 

Here is an Object-Oriented alternative of the above program:

 
#!/usr/bin/perl -T 
use strict; 
use CGI; 
my $cgi = new CGI; 
print $cgi->header; 
print $cgi->start_html('Hello World'); 
print $cgi->h1('Hello World'); 
print $cgi->end_html(); 
exit; 

At this stage we need to make our new CGI program executable:

# chmod 755 /usr/lib/cgi-bin/hello.cgi

All is now ready to launch our first CGI based web page by navigating our browser to and IP address of the apache server. In my case I'm running Apache locally so I use a localhost:

http://localhost/cgi-bin/hello.cgi

What is DHCP?

Anyone with a basic knowledge of computer networking knows that in order for two hosts communicate on the same network using TCP/IP model, both hosts need to have an unique IP address. There are two ways on how a network host can obtain an IP address.

One way is to manually configure network interface and assign an IP address by hand. This is called static configuration which means that host's IP address will never change until changed manually again by user or system administrator. If company's network includes more than 1000 hosts this job of setting up each individual host with static IP address will become tiresome and more importantly inefficient.

Another way how to set host's IP address and this is also a solution to the above issue would be to have some way to automatically assign an IP address to any host on the network upon the request. This is where DHCP ( Dynamic Host Configuration Protocol ) comes handy.

The DHCP protocol lets a DHCP client to lease network configuration parameters such as an IP address. In fact parameters to lease are not limited to IP address only and they also include:

  • IP addresses and network masks
  • Domain Names servers ( DNS )
  • Default Gateways
  • WINS servers
  • Syslog hosts
  • Proxy servers
  • NTP servers
  • X Font servers
  • Syslog hosts

If you still have some questions after reading this article please try our new LinuxCareer Forum.

Read more ...

Where to get a Linux ? This question comes to mind to any first time "wishing to try Linux" user. Linux operating system is for free and can be obtained by anyone with an Internet connection. This article is written for complete beginners and the aim of this article is to attempt to answer some fundamental questions such us "Where to get Linux" or Which Linux to get". Download links will be provided at the end of this article in "Where to get linux" section.

NOTE:

If you are already using Linux when reading this text this basic "where to get linux" article is surly not for you as it is intended for a very Linux beginners.

Package management

Before we answer a question on where to get linux, we need to understand two main differences between all Linux distributions. Any Linux operating system belongs to one of the following two groups:

  • RPM ( Redhat Package Mangement )
  • DEB ( Debian Package Management )

Package management defines the rules on how the software ( packages ) will be installed on any particular system. Beyond this all Linux systems are very similar and if a user get comfortable with a command line administration and usage of Linux distribution with RPM, he would be very much like home when using DEB based Linux distribution.

Read more ...

Page 71 of 72



Free Linux eBooks

Go to top