Configuring Different Servers in Linux: Quickest
Guide
Following servers will be covered
1)
NFS File Server
- share files between Linux and Linux
machine.
2) Samba File Server - share
files between Windows machine and Linux machine.
3)
Telnet server - log into server and get a command prompt just as if they were
logged into the VGA consol.
4)
SSH
Server – Same as Telnet. But telnet sends name and password as plain text but ssh
send name and password as encrypted data.
5)
FTP Server - We can share file in internet through ftp
server.
6)
DNS Server - converts machine names to IP address that
all machines on the net have
7)
DHCP Server – dynamically defines ip for its client
computer.
8)
Apache Server - to use a Linux system as a web server.
NFS File Server
Creating
an NFS file server is a way to share large amounts of data among the users and
computers in an organization. We can share files between Linux and Linux
machine by NFS file server. An administrator of a Linux system has several
things to do to get a NFS working.
Installing
NFS server:
We
can check nfs is installed or not by following command
#
rpm -qa nfs*
If
the nfs server is not installed then we have to install it by following command
#
rpm -ivh nfs-rpm-file-name
Configuring
the /etc/exports file:
We
have to give the path of all directories we want to share, the host name or ip
we want to give share (* for all host) and permission
/etc/exports
file:
/mnt/win_e
*(rw)
/home/LinuxSoft/
*(rw)
if
we give host name we have to define the ip for host name in /etc/hosts file
Starting
NFS Server:
We
have to start NFS by
#
service nfs start
we
can also use
#
service nfs restart and #service nfs stop to restart and stop NFS server
Viewing
Shared Files in Other Hosts:
To
see the shared files in another host we have to use the following command
#
showmount -e hostname or
#
showmount -e ipaddress
Mounting
and Unmounting Files from other host :
To
mount files from other hosts we have to use following command
#
mount hostname:/share_dir_name /mount_point
here
we can also use ip in place of hostname
After
mounting we will file all files in the mount_point where we mounted.
To
unmount
#
umount /mount_point
Samba File Server
Samba
is software package that lets us share files between Windows machine and Linux
machine.
Installing
Samba server:
We
can check samba is installed or not by following command
#
rpm -qa samba*
If
the samba server is not installed then we have to install it by following
command
#
rpm -ivh samba-rpm-file-name
Configuring
the /etc/samba/smb.conf file:
We
have to configure the following options in /etc/samba/smb.conf file
workgroup = Rakeb
server string = rakeb's samba server
hosts allow = 192.168.1. 192.168.2. 127.
printcap name = /etc/printcap
load printers = yes
security = share
Giving
Share:
To
share any directory we have to configure the following options in
/etc/samba/smb.conf file
[LinuxSoft]
comment = Lalir drive
path = /home/LinuxSoft
public = yes
writable = yes
[Win_e]
comment = Windows e drive
path = /mnt/win_e
public = yes
writable = yes
here
we shared /home/LinuxSoft and /mnt/win_e directories
Starting
Samba Server:
We
have to start Samba by
#
service smb start
we
can also use
#
service smb restart and #service smb stop to restart and stop samba server
Viewing
Shared Files in Other Hosts:
To
see the shared files in another host we have to use the following command
#
smbclient -L rak_pc
This
command will show a list of shared directories of rak_pc, we can also use ip
address in place of rak_pc i.e. In place of host name.
Mounting
and Unmounting Files from other host :
To
mount files from other hosts we have to use following command
#
smbmount '//rak_pc/RakebCd' /tmp
After
mounting we will file all files in the mount_point where we mounted.
To
unmount
#
smbumount /tmp
Telnet Server
Telnet
is a program that allows users to log into server and get a command
prompt
just as if they were logged into the VGA consol.
Configuring
/etc/xinetd.d/telnet file:
We
need to configure /etc/xinetd.d/telnet file as following
#
default: on
#
description: The telnet server serves telnet sessions; it uses \
# unencrypted username/password pairs
for authentication.
service
telnet
{
flags = REUSE
socket_type = stream
wait =
no
user =
root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
disable = no
}
Restarting
xinetd:
We
have to restart xinetd service
#
service xinetd restart
Logging
in by Telnet:
We
have to give the following command
[root@rakebpc
root]# telnet 192.168.1.17
Trying
192.168.1.17...
Connected
to 192.168.1.17.
Escape
character is '^]'.
Red
Hat Linux release 9 (Shrike)
Kernel
2.4.20-8 on an i686
login:
rakeb
Password:
Last
login: Sun May 9 13:08:43 from 192.168.1.17
this
is rakeb's pc
[rakeb@rakebpc
rakeb]$
Here
telnet enables a connection with 192.168.1.17 then we give a user name and
password
SSH Server
SSH
is same as Telnet. But telnet sends name and password as plain text but ssh
send name
and
password as encrypted data. We can also login as root by telnet.
Starting
ssh server:
[root@rakebpc
root]# service sshd start
Loging
in unisg SSH:
[root@rakebpc
root]# ssh -l rakeb 192.168.1.17
rakeb@192.168.1.17's
password:
this
is rakeb's pc
[rakeb@rakebpc
rakeb]$
FTP Server
FTP
is File Transfer Protocol. We can share file in internet through ftp server.
Starting
FTP server:
[root@rakebpc
root]# service vsftpd start
Logging
to the ftp server:
[root@rakebpc
root]# ftp 192.168.1.17
Connected
to 192.168.1.17 (192.168.1.17).
220
(vsFTPd 1.1.3)
Name
(192.168.1.17:root): rakeb
331
Please specify the password.
Password:
230
Login successful. Have fun.
Remote
system type is UNIX.
Using
binary mode to transfer files.
ftp>
put
(local-file)
/mnt/rakeb.jpg
(remote-file)
/home/rakeb/new.jpg
local:
/mnt/rakeb.jpg remote: /home/rakeb/new.jpg
227
Entering Passive Mode (192,168,1,17,156,216)
150
Ok to send data.
226
File receive OK.
6942
bytes sent in 0.0123 secs (5.5e+02 Kbytes/sec)
ftp>
get
(remote-file)
/home/rakeb/new.jpg
(local-file)
/mnt/new1.jpg
local:
/mnt/new1.jpg remote: /home/rakeb/new.jpg
227
Entering Passive Mode (192,168,1,17,236,158)
150
Opening BINARY mode data connection for /home/rakeb/new.jpg (6942 bytes).
226
File send OK.
6942
bytes received in 0.000277 secs (2.4e+04 Kbytes/sec)
ftp>
bye
221
Goodbye.
here
we connect to 192.168.1.17 ftp server and login as rakeb.
Uploading
and Downloading File:
We
have to use put command for uploading files
and
get command for downloading files
DNS Server
DNS
Server is Domain Name System Server. DNS converts machine names to
IP
address that all machines on the net have. It maos from name to IP address
and
IP address to name.
Installing
DNS Server:
We
can check dns server is installed or not by following caommand
[root@rakebpc
root]# rpm -qa bind*
If
it is not installed then we have to install it by
[root@rakebpc
root]# rpm -ivh bind-rpm-file-name
Files
Required To Configure:
/etc/hosts
/etc/named.conf
/ets/resolve.conf
/var/named/os2.edu.fz
/var/named/os2.edu.rev
/var/named/named.local
First
we have to make a copy of /var/named/localhost.zone as /var/named/os2.edu.fz
which
is
our forward zone file
Then
we have to make a copy of /var/named/named.local as /var/named/os2.edu.rev
which
is
our reverse zone file
Configuring
/etc/hosts:
We
have to configure /etc/hosts as following
# Do
not remove the following line, or various programs
#
that require network functionality will fail.
127.0.0.1 localhost
192.168.1.18 raselpc
192.168.1.17 rakeb.os2.edu rakeb
Configuring
/etc/named.conf:
The
configuration of this file will be like following
//
generated by named-bootconf.pl
options
{
directory "/var/named";
/*
* If there is a firewall between you and
nameservers you want
* to talk to, you might need to uncomment the
query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses
an unprivileged
* port by default.
*/
query-source address * port 53;
};
//
// a
caching only nameserver config
//
controls
{
inet 127.0.0.1 allow { localhost; }
keys { rndckey; };
};
zone
"." IN {
type hint;
file "named.ca";
};
zone
"os2.edu" IN {
type master;
file "os2.edu.fz";
allow-update { none; };
};
zone
"1.168.192.in-addr.arpa" IN {
type master;
file "os2.edu.rev";
allow-update { none; };
};
zone
"localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone
"0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
include
"/etc/rndc.key";
Configuring
/var/named/os2.edu.fz:
The
file named /var/named/os2.edu.fz is our forwardzone file.
It's
configuration will be like following.
$TTL 86400
$TTL 86400
@ 1D
IN SOA rakeb.os2.edu. root.os2.edu. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400
) ; Minimum
@ 1D IN NS rakeb.os2.edu.
rakeb IN A 192.168.1.17
www IN A 192.168.1.17
proxy IN A 192.168.1.17
mail IN A 192.168.1.17
Configuring
/var/named/os2.edu.rev:
The
file named /var/named/os2.edu.rev is our reversezone file.
It's
configuration will be like following.
$TTL 86400
@ IN
SOA rakeb.os2.edu.
root.os2.edu. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400
) ; Minimum
@ IN
NS rakeb.os2.edu.
17 IN
PTR rakeb.os2.edu.
17 IN
PTR mail.os2.edu.
17 IN
PTR www.os2.edu.
17 IN
PTR proxy.os2.edu.
Configuring
/var/named/named.local:
The
file named /var/named/named.local is our reversezone file for localhost.
It's
configuration will be like following.
$TTL 86400
@ IN
SOA localhost.
root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
@ IN
NS rakeb.os2.edu.
1 IN
PTR localhost.
Configuring
/etc/resolv.conf:
It's
contents will be like following.
search
os2.edu
nameserver
192.168.1.17
nameserver
192.168.1.1
nameserver
203.188.190.136
Starting
dns server:
We
have to start dns server by following command
[root@rakebpc
root]# service named start
DHCP Server
DHCP
server dynamically defines ip for its client computer.
Installing
DHCP Server:
we
have to check dhcp server is installed or not
[root@rakebpc
root]# rpm -qa dhcp*
dhcp-3.0pl1-23
if
dhcp server is not installed then we have to install its rpm
[root@rakebpc
root]# rpm -ivh dhcp-rpm-file-name
Configuring
/etc/dhcpd.conf:
We
have to configure /etc/dhcpd.conf as following
ddns-update-style
interim;
ignore
client-updates;
subnet
192.168.1.0 netmask 255.255.255.0 {
option domain-name "os2.edu";
option domain-name-servers 192.168.1.17;
option routers 192.168.1.17;
option subnet-mask 255.255.255.0;
range 192.168.1.200 192.168.1.220;
default-lease-time 21600;
max-lease-time 43200;
}
Creating
/var/lib/dhcp/dhcpd.leases:
We
have to create it by following command
[root@rakebpc
root]# touch /var/lib/dhcp/dhcpd.leases
Starting
dhcp server:
We
have to start dhcp server by following command
[root@rakebpc
root]# service dhcpd start
Starting
dhcpd:
[ OK ]
We
can also use restart and stop
Now
if we use windows in client computer we have to set ip by automatically ip
address.
If
we use Linux in client computer we have to set ip by automatically obtain ip
setting with dhcp.
APACHE Web Server
Apache
server is needed when to want to use a Linux system as a web server. Two of the
most popular UNIX web server packages are Apache and NCSA.
Installing
apache:
We
can check apache is installed or not
[root@rakebpc
root]# rpm -qa apache
If
it is not installed we have to install it by following command
[root@rakebpc
root]# rpm -ivh apache-rpm-file-name
Configuring
/etc/httpd/conf/httpd.conf:
We
have to configure the following options
ServerName
www.os2.edu:80
DirectoryIndex
index.html index.html.var index.php
DocumentRoot
"/var/www/html"
Starting
apache server:
service
httpd start
Now
we have to open a web browser and type the address like www.os2.edu then
index
page will be opened.