Monday, June 28, 2010

How to install Directadmin

How to install Direct admin

Direct Admin installation is very simple process to do.

Before installation kindly check the following packages are installed..

gcc
gcc-c++
automake
make
flex

If not install it using yum.



Install DirectAdmin:

# wget http://directadmin.com/setup.sh

# chmod +x setup.sh

# ./setup.sh

 When you run this setup.sh, it will ask you to fill the following informatrion..

==========
Client ID:

License ID:

Hostname:

Is this correct? (y,n) :

Is eth0 your network adaptor with the license IP? (y,n) :

Enter the name of the ethernet device you wish to use :

Is XXX.XXX.XXX.XXX the IP in your license? (y,n) :

DirectAdmin will now be installed on: Enterprise 5
Is this correct? (must match license) (y,n) :

You now have 2 options for your apache/php setup.

Enter your choice (1 or 2):

Would you like the default settings of apache 2.2 and php 5 cli? (y/n):
==========


it will take little bit time to install the directadmin..
At the end of the installation it wil generate username,passoerd... and display it
like..

 -----------------------
The following information has been set:

Admin username:   admin
Admin password:   xxxxxxx
Admin email:      xxx@xxxxxxx


Server IP: xxx.xxx.xxx.xxx
Server Hostname: xxxxxxxxxxx.com

To login now, follow this link:

http://XXX.XXX.XXX.XXX:2222

and enter your Admin username and password when prompted.

Thank you for using DirectAdmin.
-------------------

.

Monday, June 21, 2010

How to create software raid0

How to create software raid0

RAID:

RAID- Redundant Array of Independent Disks
RAID0- is a method of storing data on multiple computer storage devices to achieving faster read and write speeds.The data is broken down into blocks and each block is written to a separate disk drive. If one disk fails total data will loose.

Here we are going to create software raid0.

consider we have 2 hardisk sda and sdb

# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1318    10482412+  83  Linux
/dev/sda3            1319        1579     2096482+  82  Linux swap / Solaris
/dev/sda4            1580       60801   475700715   83  Linux

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1       60801   488384001   42  SFS


We are going to create raid in /dev/sda4 and /dev/sdb1

First we have to change the id of both the partitions.

# fdisk /dev/sda
..........
..........
Command (m for help):t
Partition number (1-4):4
Hex code (type L to list codes):fd
Command (m for help):w


# fdisk /dev/sdb
..........
..........
Command (m for help):t
Partition number (1-4):1
Hex code (type L to list codes):fd
Command (m for help):w

NOw,

# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1318    10482412+  83  Linux
/dev/sda3            1319        1579     2096482+  82  Linux swap / Solaris
/dev/sda4            1580       60801   475700715   fd  Linux

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1       60801   488384001   fd  SFS

Use the partprobe to reload the changes without rebooting the box:

# partprobe /dev/sda4
partprobe /dev/sdb1


Create raid0:

# mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sda4 /dev/sdb1

create file system on our raid,

# mkfs.ext3 /dev/md0 

To check the raid0,

# cat /proc/mdstat 
Personalities : [raid0]
md0 : active raid0 sdb1[1] sda4[0]
      964083520 blocks 64k chunks
unused devices:


and,

# mdadm --detail /dev/md0 
/dev/md0:
        Version : 0.90
  Creation Time : Wed Jun 16 02:01:47 2010
     Raid Level : raid0
     Array Size : 964083520 (919.42 GiB 987.22 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Wed Jun 16 02:01:47 2010
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

     Chunk Size : 64K

           UUID : 7df3ae47:4d85c172:4522530b:f2487312
         Events : 0.1

    Number   Major   Minor   RaidDevice State
       0       8        4        0      active sync   /dev/sda4
       1       8       17        1      active sync   /dev/sdb1


Finally we have to mount the raid to any location like,

# mount /dev/md0 /raid

If you want to prementaly mount it, give the detais in the fstab.

I think this document is usefull for you...... :-)



.

To Compress Drectory/File in Linux

To Compress Drectory/File in Linux.

Here we are going compress the directory/file using the tar command.
This is a good way to create backups and archives.

Some of the options used with the tar are: 

-c:  Create archive
-v:  Verbose i.e show the progress of the files being archived.
-f:  Archive File name
-t:  Show the list of files in the tar file.
-x:  Extract files from an archive.
-z:  Compress the tar file with gzip(gzip-Compression Tool)
-j:  Compress the tar file with bzip2(bzip-Compression Tool)


Example:

1)To compress the /home/admin/user1 folder as backup1.tar.gz

# tar -zcvf backup1.tar.gz  /home/admin/user1

To restore the 'tar.gz',

# tar -zxvf backup1.tar.gz

to restore in a particular directory

# tar-zxvf backup1.tar.gz -C /tmp


2)To compress the /home/admin/user1 folder as backup1.tar.bzip2

# tar -jcvf backup1.tar.bzip2  /home/admin/user1

To restore the 'tar.bzip2',

# tar -jxvf backup1.tar.bzip2






.

Sunday, June 20, 2010

SSHD fatal: daemon() failed: No such device

SSHD fatal: daemon() failed: No such device:

If you got error like "sshd stop failed", check the log message in  /var/log/secure . Here you may find the "SSHD fatal: daemon() failed: No such device" error.

You can solve it using the following simple steps:

# rm -rf /dev/null
# mknod /dev/null c 1 3
/etc/rc.d/init.d/sshd restart


.

Wednesday, June 16, 2010

Install and use rsync

Install and use rsync


rsync is a free software computer program for Unix and Linux like systems.


Using rsync we can take backup/mirroring a directory tree of files from one machine to another machine or in a same machine.


To install rsync:


In  Ubuntu,
# apt-get install rsync


In  CentOS/Fedora Core Linux,
# yum install rsync


rsync syntax:


rsync {source}  {destination}


Options:
--delete : delete files that don't exist on sender (system)
-v          : Verbose
-a         : archive mode
-r         : recurse into directories
-z        : compress file data


Example:


In a single machine:


# rsync -avz /src/bar /data/tmp


This will transfer all files from the directory /src/bar to /data/tmp/bar directory.


# rsync -avz /src/bar/ /data/tmp


This will transfer all files from the directory /src/bar to /data/tmp/.
"/" (slash) on a source means "copy the contents of this directory".




From a local computer to a remote server:


rsync  -avz  --rsh='ssh -p{ssh-port.no}'   {source}  {remote machine IP}:{destination}


example:


rsync  -avz   --rsh='ssh  -p2222'  /src/bar/  192.168.1.1:/data/tmp/


If the remote server using default port(22):


rsync  -avz   -e ssh  /src/bar/  192.168.1.1:/data/tmp/


.

Saturday, June 12, 2010

chkconfig in Ubuntu

chkconfig in Ubuntu :

chkconfig in ubuntu is  sysv-rc-conf



On Ubuntu you need to install

# sudo apt-get install sysv-rc-conf
Once it is installed run the command

# sudo sysv-rc-conf


Friday, June 11, 2010

How to set mysql root password

How to set mysql root password:

You can easily set the mysql root password...

# mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE user='root';
mysql> FLUSH PRIVILEGES;
mysql> exit


Now try to login with the password:

# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.......
.......