Monday, February 22, 2010

Important Directories in Linux

Home Directories : /root, /home/
User Executables : /bin,/usr/bin,/usr/local/bin
System Executables : /sbin,/usr/sbin,/usr/local/sbin
Mount points : /mnt
Configuration files : /etc
Temporary files : /tmp
Kernel and Boot loader files : /boot
Server Data : /var,/srv
Shared Libraries : /lib,/usr/lib,/usr/local/lib

Thursday, February 18, 2010

How To : Linux LVM (Logical Volume Manager)

This Article shows on how to create a logical volumes on Linux
STEP 1:(Create Partitions)
Here we are considering a physical Hard Disk (dev/sda)
Using fdisk command we are going to partition the /dev/sda into /dev/sda1 and /dev/sda2
Eg:fdisk /dev/sda
We created 2 partitions /dev/sda1 and /dev/sda2
STEP 2:(Create Physical Volumes)
Use the pvcreate command to create physical volumes# pvcreate /dev/sda1# pvcreate /dev/sda2
Use the pvdisplay command displays all physical volumes on your system
STEP 3:(Create Virtual group)
Here I am going to create a new Vitual group
# vgcreate mynew_vg /dev/sda1
To include both the partitions as a Single Virtual group,
# vgcreate mynew_vg /dev/sda1 /dev/sda2
Or else if you want to extend the same virtual group to other partitions
# vgextend mynew_vg /dev/sdb2
STEP 4:(Create Logical Volumes)
create a logical volume of size 1000 MB -L 1000create a logical volume of size 5 GB -L 5G
# lvcreate -L 1000 -n vol01 mynew_vg # lvcreate -L 5G -n vol02 mynew_vg
To display Logical volumes use the command lvdisplay
STEP 5:(Create File systems on logical volumes)
# mkfs.ext3 /dev/mynew_vg/vol01# mkfs.ext3 /dev/mynew_vg/vol02
STEP 6:(Edit fstab)
Edit /etc/fstab
Add the the created logical volumes
Eg:/dev/mynew_vg/vol02 /mnt/lvm ext3 defaults 0 2
STEP 7:(Mount LVM)
Make the directory where we want to mount as mentioned in fstab#mkdir /mnt/lvm
#mount -a
or
#mount /dev/mynew_vg/vol02 /mnt/lvm

Wednesday, February 17, 2010

Set up FTP server in Linux

STEP 1:
Install the package
$ sudo apt-get install vsftpd
STEP 2:
Edit /etc/vsftpd.conf
Disable anonymous access:
Change the "anonymous_enable" setting to NO
Change the "local_enable" setting to YES.

STEP 3:
Restart the services
$/etc/init.d/vsftpd restart

TROUBLESHOOTING:
Inorder to enable root login for FTP clients(Eg:File zilla)
We need to edit /etc/ftpusers
Comment the root user and restart the services.

Setting up TFTPD in Linux

STEP 1:
Install tftpd and related packages.
$ sudo apt-get install xinetd tftpd tftp
STEP 2:
Create /etc/xinetd.d/tftp and put this entry:
service tftp
{protocol = udp
port = 69
socket_type = dgram
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = /tftpboot
disable = no
}
STEP 3:
Make /tftpboot directory
$ sudo mkdir /tftpboot
$ sudo chmod -R 777 /tftpboot
$ sudo chown -R nobody /tftpboot
STEP 4:
Start tftpd through xinetd
$ sudo /etc/init.d/xinetd start
STEP 5:
Testing. Tranfering file hda.txt from 192.168.1.100 (Client using tftp) to 192.168.1.101(Server 192.168.1.101).Get an example file to transfer (eg. hda.txt)
$ touch /tftpboot/hda.txt
$ chmod 777 /tftpboot/hda.txt
$ tftp 192.168.1.101tftp> put hda.txt
Sent 722 bytes in 0.0 secondstftp> get tftp>quit

TROUBLESHOOTING:
1:"Error 1: File could not be found"The above mentioned error might occur if we try to use "put" command
In that case try creating the same file name in the other computer also,then it will over write.

Sunday, February 14, 2010

Accessing Fedora LVM in Ubuntu

Scenario:While trying to mount a LVM created in fedora on UBUNTU,you might get an error like"Unknown filesystem type"
STEP 1:
Install the following package,
[root@localhost ~]#apt-get install lvm2
STEP 2:
Load the necessary module,
[root@localhost ~]#modprobe dm-mod
STEP 3:
Scan your system for LVM volumes and identify in the output the volume group name that has your Fedora volume (mine proved to be VolGroup00):
[root@localhost ~]#vgscan
STEP 4:
Activate the volume
[root@localhost ~]#vgchange -ay VolGroup00
STEP 5:
Find the logical volume that has your Fedora root filesystem (mine proved to be LogVol00):
[root@localhost ~]#lvs
STEP 6:
Create a mount point for that volume:
[root@localhost ~]#mkdir /mnt/data
STEP 7:
Mount it:
[root@localhost ~]#mount /dev/VolGroup00/LogVol00 /mnt/data

Now copy the datas

Wednesday, February 10, 2010

Fedora:Takes long time to boot in GUI

The Scenario was that a Fedora machine was taking long time to boot into GUI,but it logs into Terminal very fast
STEP 1:
Try checking the logs from,
cat /var/log/messages
It will show the reason,in my case it was showing fails to authenticate to LDAP
STEP 2:
Go into authentication configuration,by typing the follwing command,
[root@localhost]#setup
Then go to "Authentication Configuration"
Disable all the unwanted authentications like NIS,LDAP etc according to your use

Now it should work fine...

Sunday, February 7, 2010

configure samba:Interoperability between windows and linux

STEP 1:
Before making changes to samba configuration file,back up the original samba config. file
Eg:cp /etc/samba/smb.conf /etc/samba/smb.conf.original
STEP 2:
Edit smb.conf
Eg:vim /etc/samba/smb.conf
Scrol down to the section SHARE DEFINITIONS
For example if you want to share your home folder,Add the following lines
Eg:[home]
path = /home
writable = yes
browseable = yes
valid users = root
guest ok = no

Then save the file by pressing "Esc" ":""wq"
STEP 3:
Now add samba users by using the command
Eg:smbpasswd -a root
enter password

STEP 4:
In Fedora,Restart the samba services
Eg:service smb restart
In Ubuntu:
Eg: /etc/init.d/samba restart

STEP 5:
Now go to your windows machine
Goto Start->Run->\\ipaddress of the linuxmachine
STEP 6:
Incase any issues like access denied try disabling the firewall and SE linux management

Friday, February 5, 2010

Installing JDK 1.5 on Fedora

STEP 1:
Download "jdk-1_5_0_21-linux-i586-rpm.bin" file from Java Website
Now change the permission of the downloaded file to 755 like this:chmod 755 jdk-1_5_0_21-linux-i586-rpm.bin
STEP 2:
Then run it:./ jdk-1_5_0_21-linux-i586-rpm.bin
You need to type "yes" to indicate your acceptance to their agreement and the installation will complete on its own
STEP 3:
Now you need to find the actual location of your JDK installation and indicate to Fedora to accept your choice.
Type the following
updatedb;locate javac grep bin

You will see an entry like this:
/usr/java/jdk1.5.0_21/bin/javac

Here /usr/java/jdk1.5.0_21 is the actual JAVA_HOME for your machine. Note this as you will need it to run the future commands.
STEP 4:
Now you need to run the alternatives command to instruct Fedora to recognize Sun's JVM
/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.5.0_21/bin/java 100
/usr/sbin/alternatives --install /usr/bin/jar jar /usr/java/jdk1.5.0_21/bin/jar 100
/usr/sbin/alternatives --install /usr/bin/javac javac /usr/java/jdk1.5.0_21/bin/javac 100
STEP 5:
Finally you should configure alternative to use Sun's JVM as the default JVM. To do this type:
/usr/sbin/alternatives --config java
Select /usr/java/jdk1.5.0_21/bin/java as default
/usr/sbin/alternatives --config javac
Select /usr/java/jdk1.5.0_21/bin/javac as default
STEP 6:
Add the following path in .bashrc
export PATH=$PATH:/usr/java/jdk1.5.0_21/jre/bin
Append the path in .bash_profile
/usr/java/jdk1.5.0_21/jre/bin:/usr/bin/java/jdk1.5.0_21/bin
STEP 7:
Type java –version
java version "1.5.0_21"
Java(TM) 2 Runtime Environment, Standard Edition(build 1.5.0_21-b01)
Java HotSpot(TM) Server VM (build 1.5.0_21-b01, mixed mode)