8/7/12

How to complie Linux Kernel 2.6

Step # 1 Get Latest Linux kernel code

Visit http://kernel.org/ and download the latest source code. File name would be linux-x.y.z.tar.bz2, where x.y.z is actual version number. For example file inux-2.6.25.tar.bz2 represents 2.6.25 kernel version. Use wget command to download kernel source code:

#root cd /tmp
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-x.y.z.tar.bz2 Note: Replace x.y.z with actual version number.

Step # 2 Extract tar (.tar.bz3) file

Type the following command:

# tar -xjvf linux-2.6.25.tar.bz2 -C /usr/src
# cd /usr/src
Install Location

#cd /usr/src
Step # 3 Configure kernel

Before you configure kernel make sure you have development tools (gcc compilers and related tools) are installed on your system. If gcc compiler and tools are not installed then use rpm command under Redhat Linux to install development tools.

#rpm -ivh gcc
Now you can start kernel configuration by typing any one of the command:

make menuconfig - Text based color menus, radiolists & dialogs. This option also useful on remote server if you wanna compile kernel remotely.

make xconfig - X windows (Qt) based configuration tool, works best under KDE desktop

make gconfig - X windows (Gtk) based configuration tool, works best under Gnome Dekstop. For example make menuconfig command launches following screen:

#make menuconfig
You have to select different options as per your need. Each configuration option has HELP button associated with it so select help button to get help.

Step # 4 Compile kernel

Start compiling to create a compressed kernel image, enter:

#make
Start compiling to kernel modules:

#make modules
Install kernel modules (become a root user, use su command):

#make modules_install
Step # 5 Install kernel

So far we have compiled kernel and installed kernel modules. It is time to install kernel itself.

#make install
It will install three files into /boot directory as well as modification to your kernel grub configuration file: System.map-2.6.25 config-2.6.25 vmlinuz-2.6.25

Step # 7 Modify Grub configuration file - /boot/grub/grub.lst

Open file using vi:

#vi /boot/grub/menu.lst
title Redhat Linux,kernel 2.6.25
root (hd0,0)
kernel /boot/vmlinuz root=/dev/hdb1 ro
initrd /boot/initrd.img-2.6.25

update-grub

Step # 8 : Reboot computer and boot into your new kernel

Just issue reboot command:

#reboot

Linux Network Configuration

How to Configure Network on Linux

What are the RPM need to installed

kdenetwork-3.5.4-4.fc6
system-config-network-1.3.99-1.el5
system-config-network-tui-1.3.99-1.el5
kdenetwork-devel-3.5.4-4.fc6
Network Configuration File

#/etc/sysconfig/network-scripts/ifcfg-eth0
#/etc/sysconfig/network
Network Configuration Tool

system-config-network
system-config-network-gui
system-config-network-cmd
system-config-network-tui

What is service need to be started

service network restart/stop/start

Editing network Configuration File

maually assigning ip address
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
IPADDR=10.192.194.110
BOOTPROTO=static ("dhcp" when you want dhcp server ip address)
NETMASK=255.255.240.0
MII_NOT_SUPPORTED=yes
ONBOOT=yes
How add the Default Route Redhat Linux:

vi /etc/sysconfig/network
HOSTNAME=bgospc
GATEWAY=10.192.207.254
NETWORKING=yes

How add the Default Route in SuSe Linux:

#vi /etc/sysconfig/network/routes
default 10.192.207.254 - -
How to add DNS Server name and IP address

Add the entry to vi /etc/resolv.conf

#vi /etc/resolv.conf
search bg.emulex.com ad.emulex.com emulex.com wa.emulex.com sj.emulex.com ma.emulex.com co.emulex.com
nameserver 138.239.197.20
nameserver 138.239.197.101
nameserver 138.239.197.103

Linux Samba Server Configuration

How to Configure Samba Server on Linux

What RPM Need to be installed:

system-config-samba-1.2.39-1.el5
samba-common-3.0.23c-2
samba-3.0.23c-2
samba-client-3.0.23c-2
What is the Config File:

#/etc/samba/smb.conf
what is the service need to started

#service smb restart
Configure Samba Server:

Add the entry to vi /etc/samba/smb.conf

[samba-disk1]
comment = samba-disk1
path = /disk1
write list = root
valid users = root guest
create mask = 0664
directory mask = 0775
#save
Add the Samba user Paasword

#smbpasswd -a root
How mount samba clinet on Windows

start->run->//sambaserver ipaddress it will ask sambaserver username and password
How to mount samba client on Linux

mount.smbfs //sambaserver ipaddress/shared path /localpath

Ex:
mount.smbfs //10.192.192.189/samba-disk1 /disk1
or

mount //10.192.192.189/samba-disk1 /disk1 and it will ask samba server password
Note:The samba.winbind package need to installed for this future

8/6/12

Linux RSH Server configuration

How to install and configure RSH Server on Linux

What is the RPM need to Installed

rsh-server-0.17-37.el5
rsh-0.17-37.el5
What is the RSH Server Config File:

#/etc/xinetd.d/rsh
#/etc/xinetd.d/rlogin
#/etc/xinetd.d/rexec
#/etc/securetty
#/root/.rhosts
#/etc/hosts
What is the Service need to be start:

#root@localhost#service xinetd restart
How To install RSH Server RPM

#root@localhost#mount 10.192.194.110:/work /mnt (mount it on Your Linux machine)
#root@localhost#cd /mnt/rhel5132/Server/
#root@localhost#rpm -ivh rsh-server-4.xxx.rpm
How to configure RSH Server on Linux

#root@localhost#vi /etc/xinetd.d/rsh
#service shell
{
socket_type = stream
wait = no
user = root
log_on_success += USERID
log_on_failure += USERID
server = /usr/sbin/in.rshd
disable = yes
}
Note:change disable=yes to no and save
#root@localhost#vi /etc/xinetd.d/rlogin
service login
{
socket_type = stream
wait = no
user = root
log_on_success += USERID
log_on_failure += USERID
server = /usr/sbin/in.rlogind
disable = yes
}
Note:change disable=yes to no and save
#root@localhost#vi /etc/xinetd.d/rexec
service exec
{
socket_type = stream
wait = no
user = root
log_on_success += USERID
log_on_failure += USERID
server = /usr/sbin/in.rexecd
disable = yes
}
Note: Change disable=yes to no
#root@localhostservice xinetd restart (restart Service)
Add the Entry in vi /etc/securetty

#root@localhost#vi /etc/securetty
rsh
rlogin
rexec
#save restart service
#service xinetd restart
Add the entry vi /etc/hosts

#root@localhost#vi /etc/hosts
hostname ipaddress [ex rshserver]
hostname ipaddress [ex rsh client]
#save File
#root@localhost#vi /root/.rhosts
ipaddress root (ex:server)
ipaddress root (ex:client)
#save
#service xinetd restart (Restart the Service)
#chkconfig xinetd on
Make Sure to Stop Firewall Service:

#root@localhost#/etc/init.d/iptables stop
#root@localhost#/etc/init.d/iptables stop
#root@localhost#chkconfig iptables off
#root@localhost#chckconfig ip6tables off

Linux NFS Server Configuration

What is NFS Server

The Network File System (NFS) was developed to allow machines to mount a disk partition on a remote machine as if it were a local disk. It allows for fast, seamless sharing of files across a network

How to Configure NFSServer in Linux

#There is two way to configure NFS Server.
#Using NFS Server COnfiguration Tool (System-Config-NFS)
#manually Editing Configuration File vi /etc/exportfs
NFS Server Configuration Tool

#root@locathost#system-config-nfs
#Basic tab add the below details
#Directory — Specify the directory to share, such as /tmp.
#Host(s) — Specify the host(s) with which to share the directory.(bglinux or 138.239.197.10 or * to give everyone access)
#Basic permissions — Specify whether the directory should have read-only or read/write permissions.

#General tab->click checkbox Sync write operations on request
#Hide Filesystem beneath
Manually Editing NFS Server Configuration File vi /etc/exportfs

#root@localhost#vi /etc/exportfs
#root@localhost# /work *(ro,sync) (edit or delete and !wq save file)
#root@localhost#exportfs -a (reflect changes in NFS Server
Linux NFS configuration services

#root@localhost#etc/rc.d/init.d/portmap start
#root@localhost#/etc/rc.d/init.d/nfslock start
#root@localhost#/etc/rc.d/init.d/nfs start

Verify NFS Server is Running

#root@localhost#rpcinfo -p

FTP Server Configuration in Linux

Short for File Transfer Protocol, the protocol for exchanging files over the Internet or network.

How to start FTP Service

#root@localhost#/etc/init.d/vsftpd start
#root@localhost#/etc/init.d/vsftpd stop
#root@localhost#/etc/init.d/vsftpd restart

VSFTPD to start at boot you can use the chkconfig command
#root@localhost#chkconfig vsftpd on

Test the VSFTPD Server Status

#root@localhost#netstat -a | grep ftp
tcp 0 0 *:ftp *:* LISTEN
The vsftpd.conf File

VSFTPD only reads the contents of its vsftpd.conf configuration file you'll have to restart VSFTPD each time you edit the file in order for the changes to take effect. The file may be located in either the /etc or the /etc/vsftpd VSFTPD runs as an anonymous FTP server you want any remote user to log into to your default FTP directory using a username of anonymous and a password

#anon_root=/data/ftp
VSFTPD allows only anonymous FTP downloads to remote users, not uploads from them. This can be changed by modifying the anon_upload_enable VSFTPD doesn't allow anonymous users to create directories on your FTP server. You can change this by modifying the anon_mkdir_write_enable. VSFTPD logs FTP access to the /var/log/vsftpd.log log file. You can change this by modifying the xferlog_file directive. By default VSFTPD expects files for anonymous FTP to be placed in the /var/ftp directory

# Allow anonymous FTP?
anonymous_enable=YES
#The directory which vsftpd will try to change
#into after an anonymous login. (Default = /var/ftp)
anon_root=/data/directory
...
# Uncomment this to allow local users to log in.
local_enable=YES
...
#Uncomment this to enable any form of FTP write command.
#Needed even if you want local users to be able to upload files)
write_enable=YES
...
# Uncomment to allow the anonymous FTP user to upload files. This only
# has an effect if global write enable is activated. Also, you will
#obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
...
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
...
# Activate logging of uploads/downloads.
xferlog_enable=YES
...
# You may override where the log file goes if you like.
# The default is shown below.
xferlog_file=/var/log/vsftpd.log
Other vsftpd.conf Options

Limiting the maximum number of client connections (max_clients) Limiting the number of connections by source IP address (max_per_ip) The maximum rate of data transfer per anonymous login. (anon_max_rate) The maximum rate of data transfer per non-anonymous login. (local_max_rate)

The /etc/vsftpd.ftpusers File

you may restrict FTP access to certain users by adding them to the list of users in the /etc/vsftpd.ftpusers file

FTP Greeting Banner

ftpd_banner= Welcome to FTP Server

TFTP Server Configuration in Linux

TFTP Configuration File

/etc/xinetd.d/tftp
TFTP Server Service

service xinetd restart
How to configure TFTP Server for Linux

[root@bgpxetest ~]#vi /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot/
disable = yes (change to no)
per_source = 11
cps = 100 2
flags = IPv4
}
:wq
[root@bgpxetest ~]#service xinetd restart

Note: Pls make sure this Setting
Disable= yes change to NO
Server_args= -s /tftpboot pls make sure to change install path for while doing pxe installation
/tftpboot/linux-install

Loading Kernel Modules in Linux

Loading Kernel Modules

Linux allows the Kernel to be configured at run time, to enable or disable different services as you see fit

Module Commands

There are a few commands that allow you to maniuplate the kernel. Each is quickly described below, for more information say `man [command]`.
• depmod - handle dependency descriptions for loadable kernel modules.
• insmod - install loadable kernel module.
• lsmod - list loaded modules.
• modinfo - display information about a kernel module.
• modprobe - high level handling of loadable modules.
• rmmod - unload loadable modules

Using Module Commands

Below the different kernel module commands are demonstrated

# Show the module dependencies.
depmod -n

# Install some module

insmod [modname]
modprobe -v modename

# This lists all currently loaded modules, lsmod takes no useful parameters

lsmod

# Display information about module eepro100

modinfo modname

# Removing a module (don't use the example)

rmmod modname
modprobe -r modname

Module Configuration Files

The kernel modules can use two different methods of automatic loading. The first method (modules.conf) is my preferred method

/etc/modules.conf or /etc/modprobe.conf
/etc/rc.local