Friday, 22 November 2013

Setup Yum Server on Linux step by step.

Yellowdog updater, Modified (Yum) is a software package manager that installs, updates and removes packages on RPM-based Linux distributions. Yum uses an online repository by default, and we can also configure it to use a local repository packages.

Use the below steps to setup yum serer on your linux server:
First of all mount the contents of your CentOS 6.2 DVD in the /mnt directory or wherever you want.

[root@Packages]#mount /dev/cdrom /mnt/
mount: block device /dev/sr0 is write-protected, mounting read-only.

Install vsftpd package, so that we can use this  as a FTP serer to share our repository in the client systems.
Change to the directory where you mounted CentOS DVD.

#cd /mnt/Packages
#rpm -ivh vsftpd (tab) vsftpd-2.2.2-11.el6.i686.rpm

Start the FTP service:

#service vsftpd start

Install createrepo package if it is not installed. This package will used to create our local repository:

[root@Packages]#rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm
error: Failed dependencies:
      deltarpm is needed by createrepo-0.9.8-4.el6.noarch.rpm
      python-deltarpm is needed by createrepo-0.9.8-4.el6.noarch.rpm

It shows us the dependency problem. So install missing dependencies first:

[root@Packages]#rpm -ivh deltarpm-3.5-0.5.200900810git.el6.x86_64.rpm
Preparing....           ##########################################[100%]
1:deltarpm             ##########################################[100%]

[root@Packages]#rpm -ivh python-deltarpm-3.5-0.5.200900810git.el6.x86_64.rpm
Preparing....           ##########################################[100%]
1:python-deltarpm  ##########################################[100%]

Now install the createrepo package:
[root@Packages]#rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm
Preparing....           ##########################################[100%]
1:createrepo          ##########################################[100%]

Create a folder called yum (you can use your own) in /var/ftp directory to save all the packages from CentOS DVD.
Copy all the files in the yum folder from the DVD.

[root@Packages]# mkdir /var/ftp/yum
[root@Packages]#cp /mnt/Packages/* /var/ftp/yum/

After all packages are copied, create a repo file called it.repo in /etc/yum.repos.d directory.

[root@Packages]#vi /etc/yum.repos.d/it.repo
and type the following entries and save the files:

[not-install]
baseurl=ftp://ip address of server/yum
gpgcheck=0

Now it's time to create our repository:

[root@Packages]#createrepo /var/ftp/yum

Client side configuration:
Create a repo file in your client system as mentioned above in the /etc/yum.repos.d/ directory:

 [client@ss]#vi /etc/yum.repos.d/it.repo
and type the following entries and save the files:

[not-install]
baseurl=ftp://ip address of yum server/yum
gpgcheck=0

For any query please feel free to contact me my email ID is sashwatkatore@gmail.com.

Tuesday, 19 November 2013

Install ftp server and set ftp permission on home directory on Linux.

vsftpd  is a service which allows us to setup ftp server in secure way. By default ftp server can be access by anonymously and we can also configure login-based FTP session.

Use the below steps to Install vsftpd server:

Step 1
#yum install vsftpd

Step 2 - (Edit in main configuration file)
#vi /etc/vsftpd/vsftpd.conf

change below line as follows :
anonymous_enable=NO
local_enable=YES

Step 3 - (Enable 'vsftpd' service for automatic start after server restart)
#chkconfig vsftpd on
#service vsftpd start

Step 4 - (Set SeLinux Booleans)
#getsebool -a | grep ftp
#setsebool -P ftp_home_dir on

Now we can make login-based ftp session on web browser or Filezilla ftp client:

Step 5 - (Create Users):
#useradd user1

and update the password of user1
#passwd user1

Now you can access file server :

ftp://ip address of ftp server


username:


passwd:


For any query please feel free to contact me my email ID is sashwatkatore@gmail.com.

Saturday, 26 October 2013

Install Fedora EPEL repository on CentOS Linux

In my this blog i will describe how to configure a CentOS based system to use Fedora EPEL repository and third party remi package repository and As advantage they provide much more current versions of popular applications.

Install the third party or extra repositories:
Now download some RPM files that contain the additional Yum repository definitions. In the below example we are using 64 bit version that work with our server.

Download  Requires RPM files for Centos 5.X:

# wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5.4.noarch.rpm

# wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

# sudo rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

Download  Requires RPM files for Centos 6.X:

# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm


# wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

# sudo rpm -Uvh remi-release-6*.rpm eplel-release-6*.rpm

Once Installed we can see some additional repository definitions under the /etc/yum.repos.d directory.

# ls -l  /etc/yum.repos.d/epel* /etc/yum.repos.d/remi.repo

/etc/yum.repos.d/epel.repo

/etc/yum.repos.d/epel-testing.repo

/etc/yum.repos.d/remi.repo

Enable the remi repository:
remi repository provides a variety of up-to-date packages that are useful for web based services. That means it's good to enable the remi repositories by default.
Now open the /etc/yum.repos.d/remi.repo repository file using your favourite text editor:

# vim /etc/yum.repos.d/remi.repo

Now edit the [remi] portion of the file so that the enabled option is set to 1. This will enable the remi repository.

name=Les RPM de remi pour Enterprise Linux $releasever - $basearch
# baseurl=http://rpms.famillecollet.com/enterprise/$releasever/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
failovermethod=priority

Now we will have a larger array of yum repositories.

For any query please feel free to contact me my email ID is sashwatkatore@gmail.com.

Friday, 25 October 2013

Difference between ext2, ext3 and ext4 File System on Linux.

Linux is a very flexible operating system, Linux can read and write several different file systems that originated with other operating systems much different from linux. 
One main reason is that Linux support so many file systems because Linux works on VFS (Virtual File System) Layer. The VFS layer avoids duplication of common code between all file systems also it provides a fairly universal backward compatible method for programs to access data from almost all type of file systems.

ext2 Filesystem:
  • ext2 stands for second extended file system.
  • Introduced with kernel 1.0 in 1993.
  • Super block feature increase file system performance
  • Flexible can handle upto 4 TB
  • ext2 filesystem is popular on USB and other solid-state devices.
  • ext2 filesystem reserve 5% of disk space for root
ext3 Filesystem:
  • ext3 filesystem was introduced in 2001 & Developed by Stephen Tweedie.
  • ext3 filesystem stands for third extended file system.
  • ext3 filesystem was released with Linux Kernel 2.4.15.
  • The main advantage of ext3 filesystem is that it allows journaling.
  • By journaling the possibility of file system corruption is less, So its a main advantage.
  • In ext3 filesystem Maximum file size can be from 16 GB to 2 TB.
  • Overall ext3 filesystem size can be from 2 TB to 32 TB.
  • We can convert a ext2 filesystem to ext3 filesystem directly.
Journaling: it has a dedicated area in the file system, Where all changes are tracked and when the system crashes the possibility of data loss is less because of Journaling.

ext4 Filesystem:
  • ext4 filesystem was introduced in 2008.
  • ext4 filesystem stands for fourth extended file system.
  • ext4 filesystem was released with Linux Kernel 2.6.19.
  • ext4 filesystem supports huge individual file size.
  • In ext4 filesystem Maximum file size can be from 16 GB to 16 TB.
  • Overall ext4 filesystem size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte).
  • In ext4 filesystem we can mount an existing ext3 filesystem as ext4 filesystem.
Converting ext2 Filesystem to ext3 Filesystem:
For example, if we are converting /dev/sda3 that is mounted as /home, from ext2 to ext3, do the following:

#umount /dev/sda3

#tune2fs -j /dev/sda3

#mount /dev/sda3 /home

Converting ext3 Filesystem to ext4 Filesystem:
For example, if we are converting /dev/sda3 that is mounted as /home, from ext3 to ext4, do the following:

#umount /dev/sda3

#tune2fs -0 extents,uninit_bg,dir_index /dev/sda3

#e2fsck -pf /dev/sda3

#mount /dev/sda3 /home

For any query please feel free to contact me my email ID is sashwatkatore@gmail.com.

Wednesday, 23 October 2013

Backup of Linux Using dd command on Linux.

In some cases critical data loss will have a financial impact on companies. In my this blog i am updating 4 examples for using dd command to backup the Linux system. dd is a powerful Unix utility, Which is used by the Linux kernel to make boot images. dd command can only run by the root user or superuser. 

Warning: Please be careful while using dd command, If you don't know what you are doing, You will loss your data.

Example 1. - Hard Disk Backup (disk to disk)
We can use dd command to backup entire copy of a hard disk to another hard disk connected to the same system. run the dd command as shown below. In below example, the name of the source hard disk is /dev/sda and the name of the target hard disk is /dev/sdb.

# dd if =/dev/sda of =/dev/sdb

* Here "if" represents input file and "of " represents to output file, So the backup copy of /dev/sda will be available in /dev/sdb.
* If there are any errors, the above command will fail. Add the parameter "conv=noerror"
* Input file and Output file should be mentioned very carefully.

In the copy of hard disk to hard disk using dd command given below, sync option allows you to copy everything.

# dd if=/dev/sda of=/dev/sdb conv=noerror,sync

Example 2. - Create an Image of a Hard Disk
Instead of taking a backup of the hard disk, We can create an image file of the hard disk and save it. There are many advantages to backing up data to a disk image, This method is faster than other types of backups, and enabling you to quickly restore data.

# dd if=/dev/sda of=~/sdadisk.img

Example 3. - Restore Using Image Backup
To restore Image backup file on another hard disk, use the following dd command:

# dd if=sdadisk.img of=/dev/sdb

The image file sdadisk.img file, is the image of a /dev/sda, So the above command will restore the backup of /dev/sda to /dev/sdb.

Example 4. - Backup a Partition
We can use the device name of a partition in the input file, and in the output file we can specify target path or image file as shown in the below example:

# dd if=/dev/sda1 of=~/partition1.img

For any query please feel free to contact me my email ID is sashwatkatore@gmail.com.

Monday, 21 October 2013

How to Mount NTFS Partition on Linux Step by Step.

For access to other drive or external hard drive in linux system you need to do the following:

Note: If you face any problem in any of the steps, Please add a comment and i'll get back with solution.

#yum install fuse fuse-ntfs-3g

If not able to install or getting something like,
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
* base: centos.syn.co.il
* extras: centos.syn.co.il
* updates: centos.syn.co.il
Setting up Install Process
No package ntfs-3g available
No package ntfsprogs available

Don't Worry, you can download them using the following link, Just copy-paste it your browser and download will start:

#wget ftp://ftp.muug.mb.ca/mirror/fedora/epel/6/x86_64/ntfs-3g-2011.4.12-5.el6.x86_64.rpm

Once downloaded, Install the package:

#rpm -ivh ntfs-3g-2011.4.12-5.el6.x86_64.rpm

Now you should be able to open the ntfs partition by double clicking it.

For any query please feel free to contact me my email ID is sashwatkatore@gmail.com.

Monday, 23 September 2013

Why yum grouplist and groupinstall command not working on Linux.

Whenever we are trying to install all the default packages by group using 'yum groupinstall groupname' command under RHEL v5.x. But, grouplist, groupinstall and groupdelete options are not working with yum.
How do I fix this issue and make sure yum command works with software groups under Redhat Enterprise Linux to increase productivity?

We need to install a package called yum-utils. its a collection of utilities that make yum easier and more powerful to use. 

Install yum-utils:
Type the following command:
# yum install yum-utils

To list software groups enter:
# yum grouplist


Loaded plugins: rhnplugin, security
Setting up Group Process
Installed Groups:
   Engineering and Scientific
   Graphics
   Network Servers
   System Tools
Available Groups:
   Administration Tools
   Authoring and Publishing
   Development Tools
   Editors
   Educational Software
   FTP Server
   Fedora Packager
   GNOME Desktop Environment
   GNOME Software Development
   Games and Entertainment
   Graphical Internet
   Hardware Support
   KDE (K Desktop Environment)
   KDE Software Development
   Mail Server
   News Server
   Office/Productivity
   Sound and Video
   Text-based Internet
   Web Development
   Web Server
   Window Managers
   X Window System
Done

To install "Web server" group, enter:
#yum groupinstall "Web server"

For any query please feel free to contact me my email ID is sashwatkatore@gmail.com.