Wednesday, November 3, 2010

Upgrade From Fedora 13 To Fedora 14 Desktop & Server

The commands in this article must be executed with root privileges. Open a terminal (on a Fedora 13 desktop, go to Applications > System Tools > Terminal) and log in as root, or if you log in with a regular user, type
su
to become root.

2 Upgrading To Fedora 14 (Desktop)

First we must upgrade the rpm package:
#yum update rpm
Then we install the latest updates:
#yum -y update
Next we clean the yum cache:
#yum clean all
If you notice that a new kernel got installed during yum -y update, you should reboot the system now:
reboot
(After the reboot, log in as root again, either directly or with the help of)
#su

Now we come to the upgrade process.


Install preupgrade...
#yum install preupgrade
... and call it like this:
#preupgrade
The preupgrade wizard will then start on your desktop. Select Fedora 14 (Laughlin). Afterwards the system is being prepared for the upgrade.
At the end, click on the Reboot Now button.
During the reboot, the upgrade is being performed. This can take quite a long time, so please be patient.
Afterwards, you can log into your new Fedora 14 desktop.

3 Upgrading To Fedora 14 (Server)

First we must upgrade the rpm package:
#yum update rpm
Then we install the latest updates:
#yum -y update
Next we clean the yum cache:
#yum clean all
If you notice that a new kernel got installed during yum -y update, you should reboot the system now:
reboot
(After the reboot, log in as root again, either directly or with the help of)
#su

Now we come to the upgrade process. We can do this with preupgrade.
Install preupgrade...
#yum install preupgrade
... and call it like this:
#preupgrade-cli
It will show you a list of releases that you can upgrade to. If all goes well, it should show something like Fedora 14 (Laughlin) in the list:
[root@rajat-fc ~]# preupgrade-cli
Loaded plugins: blacklist, whiteout
No plugin match for: rpm-warm-cache
No plugin match for: remove-with-leaves
No plugin match for: auto-update-debuginfo
Loaded plugins: presto, refresh-packagekit
please give a release to try to pre-upgrade to
valid entries include:
   "Fedora 14 (Laughlin)"
[root@rajat-fc ~]#
To upgrade, append the release string to the preupgrade-cli command:
preupgrade-cli "Fedora 14 (Laughlin)"
Preupgrade will also take care of your RPMFusion packages, so all you have to do after preupgrade has finished is to reboot:
#reboot
During the reboot, the upgrade is being performed. This can take quite a long time, so please be patient. Afterwards, you can log into your new Fedora 14 server.

Tuesday, November 2, 2010

Clone RedHat / Cent OS / Fedora Bare Metal Recovery

Clonesys is a Shell script that can be used to create an ISO image of your Linux system. It is not another tool that backup users files but a tool that can recreate "ex nihilo" a similar system on another hardware.

#wget http://www.trickytools.com/downloads/clonesys-1.4.0.tgz
#tar xvzf clonesys-1.4.0.tgz
#cd clonesys-1.4.0
#sh clonesys.sh
STEP 1: Configuration Summary:
----------------------------------------------------------------------
Parameters used for Image Creation:
Prompt before executing commands: n
Clean Directories before creating the backup files: y
Temporary Files Location: /tmp/clonesys
Save the Ext2 Extended Attributes (lsattr): n
Save the Extended Attributes (getfattr): n
Save the ACL (getfacl): n
Use "star" instead of "tar": y
Boot Loader method: grub
RAID Management Method: none
Filename that contains additional kernel modules to include: moremodules.list
Build a Single Image: n
    Archive Maximum Size: 650 MB
    Tar Archive Slice Size: 50 MB
ISO Image Name: /tmp/clonesys.iso
Burn the CD when process completed: n
Parameters used for System Restoration:
Write the Boot Sector on the MBR: y
Check for Badblocks when partitioning: n
Force the load of some CD-Rom kernel drivers (recommanded): y
Press to continue or to abort

star not found - it will not be used instead of tar

STEP 2: Clean the build directory:
----------------------------------------------------------------------
Done

STEP 3: Check for required commands:
----------------------------------------------------------------------
Checking existence of command pidof: OK
Checking existence of command readlink: OK
Checking existence of command ldd: OK
Checking existence of command basename: OK
Checking existence of command dirname: OK
Checking existence of command du: OK
Checking existence of command sed: OK
Checking existence of command uname: OK
Checking existence of command cut: OK
Checking existence of command mknod: OK
Checking existence of command dd: OK
Checking existence of command tr: OK
Checking existence of command tail: OK
Checking existence of command tar: OK
Checking existence of command sort: OK
Checking existence of command uniq: OK
Checking existence of command grep: OK
Checking existence of command sfdisk: OK
Checking existence of command fdisk: OK
Checking existence of command lsmod: OK
Checking existence of command mkisofs: OK
Checking existence of command modprobe: OK
Checking existence of command mount: OK
Checking existence of command umount: OK
Checking existence of command gzip: OK
Checking existence of command modinfo: OK
Checking existence of command awk: OK
Checking existence of command stat: OK
Checking existence of command bc: OK
Checking existence of command cdrecord: OK

STEP 4: Check and create needed sub-directory:
----------------------------------------------------------------------
Checking existence of directory /tmp/clonesys: OK
Checking existence of directory /tmp/clonesys/tmp: OK
Checking existence of directory /tmp/clonesys/loop: OK
Checking existence of directory /tmp/clonesys/iso/realconf: OK
Checking existence of directory /tmp/clonesys/iso/isolinux: OK
Checking existence of directory /tmp/clonesys/initrd: OK
Checking existence of directory /tmp/clonesys/iso/backup: OK

STEP 5: Copy source files to /tmp/clonesys:
----------------------------------------------------------------------
Copy ./isolinux files: OK
Copy ./initrd files: OK
Copy real basename and required libraries: OK
Copy library /lib/libc.so.6:  OK
Create the symbolic link:  OK
Copy library /lib/ld-linux.so.2:  OK
Create the symbolic link:  OK
Copy real cat and required libraries: OK
Copy library /lib/libc.so.6:  OK
Create the symbolic link:  Link already created
Create the symbolic link:  Link already created
Copy ./realconf files:  OK

STEP 6: Create configuration files under /tmp/clonesys/iso/backup:
----------------------------------------------------------------------
Copy the currently loaded modules:
Forcing module ide-cd
Forcing module isofs
Copy Module ide_cd: OK
Copy Module cdrom: OK
Copy Module iptable_filter: OK
Copy Module ip_tables: OK
Copy Module x_tables: OK
Copy Module ipv6: OK
Copy Module xfrm_nalgo: OK
Creating special node for /dev/sdj: OK
Unmounting the CD-Rom: OK
Create the mount points:
Mount point for /dev/sda3 is / (Type=ext3, Options=rw)
Mount point for /dev/sda1 is /boot (Type=ext3, Options=rw)

STEP 7: Backup the system files:
----------------------------------------------------------------------
Building the file list:
Managing Directory: /bin
Managing Directory: /sbin
Managing Directory: /usr/sbin
Managing Directory: /usr/sbin/euca_admin
Managing Directory: /usr/bin
Managing Directory: /usr/lib
Managing Directory: /usr/lib/alsa-lib
Managing Directory: /usr/lib/alsa-lib/smixer
Managing Directory: /usr/lib/anaconda-runtime
Managing Directory: /usr/lib/anaconda-runtime/boot
Managing Directory: /usr/lib/apr-util-1
Managing Directory: /usr/lib/aspell-0.60
Managing Directory: /usr/lib/audit
Managing Directory: /tmp/clonesys/
Creating the file archive (Please wait): testmade
OK

STEP 8: Prepare the Boot Loader:
----------------------------------------------------------------------
Check if file grub/grub.conf has been backup up OK
Check if file grub/menu.lst has been backup up OK
Check if file grub/device.map has been backup up OK
Check if file grub/stage1 has been backup up OK
Check if file grub/stage2 has been backup up OK
Check if file grub/e2fs_stage1_5 has been backup up OK
Check if file grub/fat_stage1_5 has been backup up OK
Check if file grub/ffs_stage1_5 has been backup up OK
Check if file grub/iso9660_stage1_5 has been backup up OK
Check if file grub/jfs_stage1_5 has been backup up OK
Check if file grub/reiserfs_stage1_5 has been backup up OK
Check if file grub/xfs_stage1_5 has been backup up OK

STEP 9: Create the Initial RAMDisk image:
----------------------------------------------------------------------
Compute the initial RAMDisk size: OK (found 22356 KBytes)
Create the initial RAMDisk file: 38740+0 records in
38740+0 records out
39669760 bytes (40 MB) copied, 0.317524 seconds, 125 MB/s
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
9696 inodes, 9685 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=12582912
1 block group
32768 blocks per group, 32768 fragments per group
9696 inodes per group

Writing inode tables: done                           
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
OK
Loopback mount of /tmp/clonesys/iso/isolinux/initrd: OK
Copy initrd files: OK
Unmounting /tmp/clonesys/iso/isolinux/initrd: OK
Compressing the initial RAMDisk: OK
Copy current Linux kernel under /tmp/clonesys/iso/isolinux directory: OK

STEP 10: Create the ISO Image:
----------------------------------------------------------------------
Do you want to enter a shell before making the ISO filesystem (y/n) ? Create the ISO images:
Preparing ISO image #1 (current archive=1, start size=10544)
Create the ISO image #1:
mkisofs: Warning: -follow-links does not always work correctly; be careful.
INFO:    UTF-8 character encoding detected by locale settings.
    Assuming UTF-8 encoded filenames on source filesystem,
    use -input-charset to override.
Size of boot image is 4 sectors -> No emulation
  1.97% done, estimate finish Tue Nov  2 16:11:42 2010
  3.93% done, estimate finish Tue Nov  2 16:11:42 2010
  5.90% done, estimate finish Tue Nov  2 16:11:42 2010
  7.86% done, estimate finish Tue Nov  2 16:11:54 2010
  9.83% done, estimate finish Tue Nov  2 16:11:52 2010
 11.79% done, estimate finish Tue Nov  2 16:11:50 2010
 13.76% done, estimate finish Tue Nov  2 16:11:49 2010
 15.72% done, estimate finish Tue Nov  2 16:11:54 2010
 17.68% done, estimate finish Tue Nov  2 16:11:53 2010
 19.65% done, estimate finish Tue Nov  2 16:11:57 2010
 21.62% done, estimate finish Tue Nov  2 16:11:55 2010
 23.58% done, estimate finish Tue Nov  2 16:11:58 2010
 25.55% done, estimate finish Tue Nov  2 16:11:57 2010
 27.51% done, estimate finish Tue Nov  2 16:12:00 2010
 29.48% done, estimate finish Tue Nov  2 16:11:58 2010
 31.44% done, estimate finish Tue Nov  2 16:12:01 2010
 33.40% done, estimate finish Tue Nov  2 16:11:59 2010
 35.37% done, estimate finish Tue Nov  2 16:11:58 2010
 37.34% done, estimate finish Tue Nov  2 16:11:58 2010
 39.30% done, estimate finish Tue Nov  2 16:11:59 2010
 41.27% done, estimate finish Tue Nov  2 16:11:58 2010
 43.23% done, estimate finish Tue Nov  2 16:11:58 2010
 45.20% done, estimate finish Tue Nov  2 16:11:57 2010
 47.16% done, estimate finish Tue Nov  2 16:11:58 2010
 49.13% done, estimate finish Tue Nov  2 16:11:58 2010
 51.09% done, estimate finish Tue Nov  2 16:11:59 2010
 53.06% done, estimate finish Tue Nov  2 16:11:58 2010
 55.02% done, estimate finish Tue Nov  2 16:12:00 2010
 56.99% done, estimate finish Tue Nov  2 16:11:59 2010
 58.94% done, estimate finish Tue Nov  2 16:12:00 2010
 60.91% done, estimate finish Tue Nov  2 16:12:00 2010
 62.87% done, estimate finish Tue Nov  2 16:12:01 2010
 64.84% done, estimate finish Tue Nov  2 16:12:02 2010
 66.81% done, estimate finish Tue Nov  2 16:12:01 2010
 68.77% done, estimate finish Tue Nov  2 16:12:02 2010
 70.73% done, estimate finish Tue Nov  2 16:12:01 2010
 72.70% done, estimate finish Tue Nov  2 16:12:02 2010
 74.66% done, estimate finish Tue Nov  2 16:12:02 2010
 76.63% done, estimate finish Tue Nov  2 16:12:02 2010
 78.60% done, estimate finish Tue Nov  2 16:12:02 2010
 80.56% done, estimate finish Tue Nov  2 16:12:03 2010
 82.53% done, estimate finish Tue Nov  2 16:12:02 2010
 84.49% done, estimate finish Tue Nov  2 16:12:03 2010
 86.45% done, estimate finish Tue Nov  2 16:12:02 2010
 88.42% done, estimate finish Tue Nov  2 16:12:03 2010
 90.38% done, estimate finish Tue Nov  2 16:12:03 2010
 92.35% done, estimate finish Tue Nov  2 16:12:02 2010
 94.31% done, estimate finish Tue Nov  2 16:12:03 2010
 96.28% done, estimate finish Tue Nov  2 16:12:02 2010
 98.24% done, estimate finish Tue Nov  2 16:12:03 2010
Total translation table size: 2048
Total rockridge attributes bytes: 4634
Total directory bytes: 8192
Path table size(bytes): 56
Max brk space used 1a000
254479 extents written (497 MB)
OK
ISO image generated as /tmp/clonesys1.iso - Ready to burn !
Error(s)  : 0
Warning(s): 1
Please, check for the errors & warnings in file /tmp/clonesys/tmp/tar.err



:D

Friday, October 29, 2010

Directories and its size for CentOS /Fedora /RedHat

which directories and trees take up all the diskspace?
du -sm $(find /start/dir/* -type d -maxdepth 1 -xdev) | sort -g

If you want more human readable output try:
du -ha /var | sort -n -r | head -n 10

you want to see ALL directories in the tree
find $1 -type d | xargs du -sm | sort -g

To show all directories size including sub directories, type

du -h

To calculate the current directory size you are in (-s stand for summary)

du -sh

To show all the 1 level sub directories size (which you are not interested at sub sub directories.)

du -sh *

To show the size of specific directory

du -sh /home

To show the size of all sub directories of a specific directory

du -sh /home/*

Thursday, October 28, 2010

Setup private cloud computing on Cent OS Eucalyptus 2.0

Eucalyptus is software that implements scalable IaaS-style private and hybrid clouds. The Eucalyptus architecture is highly modular with internal components consisting of Web services, which make them easy to replace and expand. Eucalyptus' flexibility enables it to export a variety of APIs towards users via client tools. Currently Eucalyptus implements the Amazon Web Service (AWS) API, which allows interoperability with existing AWS-compatible services and tools. This also allows Eucalyptus users to group resources drawn both from an internal private cloud and external public clouds to form a hybrid cloud.



#yum install -y java-1.6.0-openjdk-devel ant ant-nodeps libvirt-devel curl-devel httpd httpd-devel apr-devel openssl-devel dhcp libxml2 libxml2-devel gnutls gnutls-devel xen-devel libgcrypt-devel zlib-devel perl-Convert-ASN1 perl-Crypt-OpenSSL-RSA perl-Crypt-OpenSSL-Random chkfontpath scsi-target-utils fuse-libs swig gcc ntp

First, make sure JAVA_HOME is defined. For example, on Centos 5:
export JAVA_HOME="/usr/lib/jvm/java-openjdk/"
export JAVA="$JAVA_HOME/jre/bin/java"
 
reboot server in xen-kernel


  • run system-config-securitylevel-tui
  • select Security Level: Disabled
  • select OK
 
#vi /etc/xend/xend-config.sxp
(xend-http-server yes)
(xend-unix-server yes)
(xend-unix-path /var/lib/xend/xend-socket)
(xend-address localhost)
(network-script network-bridge)
(vif-script vif-bridge)
(dom0-min-mem 196)
(dom0-cpus 0)
(vncpasswd '')
download from http://open.eucalyptus.com/downloads


aoetools-21-1.el4.i386.rpm

eucalyptus-walrus-2.0.0-1.i386.rpm
euca2ools-1.3-1.i386.rpm

euca-rampartc-1.3.0-1.i386.rpm


euca-axis2c-1.6.0-1.i386.rpm

lzo2-2.02-3.el5.rf.i386.rpm

eucalyptus-2.0.0-1.i386.rpm

perl-Crypt-OpenSSL-Random-0.04-1.el5.rf.i386.rpm


eucalyptus-cc-2.0.0-1.i386.rpm

perl-Crypt-OpenSSL-RSA-0.25-1.el5.rf.i386.rpm


eucalyptus-cloud-2.0.0-1.i386.rpm

perl-Crypt-X509-0.32-1.el5.rf.noarch.rpm


eucalyptus-common-java-2.0.0-1.i386.rpm

python25-2.5.1-bashton1.i386.rpm


eucalyptus-gl-2.0.0-1.i386.rpm

python25-libs-2.5.1-bashton1.i386.rpm


eucalyptus-nc-2.0.0-1.i386.rpm

vblade-14-1mdv2008.1.i586.rpm


eucalyptus-sc-2.0.0-1.i386.rpm

vtun-3.0.2-1.el5.rf.i386.rpm


#yum localinstall eucalyptus*


Now start up your Eucalyptus services. On the front-end: 



/etc/init.d/eucalyptus-cloud start
/etc/init.d/eucalyptus-cc start
On the node:
/etc/init.d/eucalyptus-nc start
At this point you should be ready to go through the first-time
configuration. 
Point your browser to, https://front-end-ip:8443 Since Eucalyptus is using a self-signed certificate, your browser is likely to prompt you to accept the certificate. On some machines it may take few minutes after the starting of the Cloud Controller for the URL to be responsive the first time you run Eucalyptus. You will be prompted for a user and password both of which are set to admin initially. Upon logging in the first time you will be asked to
  1. change the admin password,
  2. set the admin's email address, and
  3. confirm the IP of the Cloud Controller host.
    #mkdir $HOME/.euca
    #unzip euca2-admin-x509.zip -d $HOME/.euca 
    
    #. $HOME/.euca/eucarc
  4. 
    

    Adding Images

    To enable a VM image as an executable entity, a user/admin must add a root disk image, a kernel/ramdisk pair (ramdisk may be optional) to Walrus and register the uploaded data with Eucalyptus. Each is added to Walrus and registered with Eucalyptus separately, using three EC2 commands. The following example uses the test image that we provide. Unpack it to any directory: #wget http://open.eucalyptus.com/sites/all/modules/pubdlcnt/pubdlcnt.php?file=http://eucalyptussoftware.com/downloads/releases/euca2ools-1.2-centos-i386.tar.gz&nid=3088 #cd euca-centos-5.3-i386
    #euca-bundle-image -i  --kernel true
    #euca-upload-bundle -b  -m /tmp/.manifest.xml
    #euca-register /.manifest.xml
    Next, add the root filesystem image to Walrus: #euca-bundle-image -i #euca-upload-bundle -b -m /tmp/.manifest.xml #euca-register /.manifest.xml Our test kernel does not require a ramdisk to boot. If the administrator would like to upload/register a kernel/ramdisk pair, the procedure is similar to the above: #euca-bundle-image -i --ramdisk true #euca-upload-bundle -b -m /tmp/.manifest.xml #euca-register /.manifest.xml
    
    
    :)