Thursday, April 21, 2011

How to reset forgot MAC root password

1. boot computer and hold the "apple" key and the "s" key.
2. wait for terminal show
3. release keys
4. type without the quotes: "/sbin/mount -uaw"
5. press enter
6. type without the quotes: "rm /var/db/.applesetupdone
7. press enter
8. type without the quotes: "reboot"
9. press enter

this will let you create a new admin account when you reboot your computer.
Tuesday, April 5, 2011

How to incress swap file size of linux server

dd if=/dev/zero of=/temp/swapfile1 bs=1024 count=6000000 6000000 GB

/sbin/mkswap /temp/swapfile1

/sbin/swapon /temp/swapfile1

/temp/swapfile1 swap swap defaults 0 0


Procedure to add a swap file

You need to use dd command to create swapfile. Next you need to use mkswap command to set up a Linux swap area on a device or in a file.

a) Login as the root user

b) Type following command to create 512MB swap file (1024 * 512MB = 524288 block size):
# dd if=/dev/zero of=/swapfile1 bs=1024 count=524288

c) Set up a Linux swap area:
# mkswap /swapfile1

d) Activate /swapfile1 swap space immediately:
# swapon /swapfile1

e) To activate /swapfile1 after Linux system reboot, add entry to /etc/fstab file. Open this file using text editor such as vi:
# vi /etc/fstab

Append following line:
/swapfile1 swap swap defaults 0 0

So next time Linux comes up after reboot, it enables the new swap file for you automatically.

g) How do I verify swap is activated or not?
Simply use free command:
$ free -m
Monday, March 14, 2011

How to remove Exchange

http://support.microsoft.com/kb/833396

http://support.microsoft.com/kb/310516
Thursday, March 10, 2011

Amazon Internal Network Access via Private IP

You will need to add the following rule to your security group to enable ICMP traffic to the host

Protocol : ICMP
From Port : -1
To Port : -1
Source ( IP or group ) : IP_address/32 ( Change the IP_address to be the IP you want to allow traffic from )

For SAMBA you will need to add rules for the following ports
Port 135/TCP, Port 137/UDP, Port 138/UDP, Port 139/TCP, Port 445/TCP
Monday, February 14, 2011

Ffmpeg installtion

FFmpeg (http://ffmpeg.mplayerhq.hu)
Mplayer + Mencoder (http://www.mplayerhq.hu/design7/dload.html)
Flv2tool (http://inlet-media.de/flvtool2)
Libogg + Libvorbis (http://www.xiph.org/downloads)
LAME MP3 Encoder (http://lame.sourceforge.net)
FlowPlayer - A Free Flash Video Player - http://flowplayer.org/
Installing FFMpeg

yum install ffmpeg ffmpeg-devel

If you get package not found, then you will need to add few lines in the yum repository for dag packages installation. Create a file named dag.repo in /etc/yum.repos.d with the following contents on it

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1

then

yum install ffmpeg ffmpeg-devel

If everything is fine, then the installation should proceed smoothly. If not you will get something like warning GPG public key missing .
Common Errors

To fix rpmforge GPG key warning:

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

For more information refer to this faq depending on Centos version

Missing Dependency Error:

If you get missing dependency error like shown below, in the middle of ffmpeg installation

Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package ffmpeg
Error: Missing Dependency: libtheora.so.0(libtheora.so.1.0) is needed by package ffmpeg
Error: Missing Dependency: rtld(GNU_HASH) is needed by package ffmpeg
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package imlib2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package a52dec
Error: Missing Dependency: rtld(GNU_HASH) is needed by package imlib2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package gsm
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package x264
Error: Missing Dependency: rtld(GNU_HASH) is needed by package xvidcore
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package lame
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package a52dec
Error: Missing Dependency: rtld(GNU_HASH) is needed by package faad2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package x264
Error: Missing Dependency: rtld(GNU_HASH) is needed by package lame
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package xvidcore
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package faac
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package faad2
Error: Missing Dependency: libgif.so.4 is needed by package imlib2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package faac
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package gsm
Error: Missing Dependency: libpng12.so.0(PNG12_0) is needed by package imlib2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package libmp4v2
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package libmp4v2

then most commonly you have GLIB 2.3 installed instead of GLIB 2.4 version. To check the current GLIB version installed on your server. just use

yum list glib*

and it should list the latest GLIB package version.

The reason i was getting this error was my rpmforge packages was pointed to centos 5 versions instead of centos 4.6.

To fix dependency error:

To fix this error, you might need to check your rpmforge packages compatible to the release of your existing CentOS version.
Check the file /etc/yum.repos.d/rpmforge.repo and it should look like for Centos 4.6(Final). If you have lines like http://apt.sw.be/redhat/el5/en/mirrors-rpmforge you might need to make changes to the rpmforge.repos like shown below

Note: Backup the original rpmforge.repo file before you edit its content.

[rpmforge]
name = Red Hat Enterprise $releasever - RPMforge.net - dag
#baseurl = http://apt.sw.be/redhat/el4/en/$basearch/dag
mirrorlist = http://apt.sw.be/redhat/el4/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

To know what linux type and version you are running

cat /etc/redhat-release

Once this is done, do again yum install ffmpeg.

This trick resolved the problem in my linux box running Centos 4.6 and this is the only way i found to install ffmpeg using yum.
To check the FFmpeg working:

Finally, check the ffmpeg whether it is working or not.

> ffmpeg
> ffmpeg -formats
> ffmpeg --help
// This lists path of mpeg, its modules and other path information


ffmpeg -i Input.file Output.file
To check what audi/video formats are supported

ffmpeg -formats > ffmpeg-format.txt

Open the ffmpeg-formats.txt to see the ooutput

D means decode
E means encode
V means video
A means audio
T = Truncated
Thursday, February 3, 2011

Set Java path permant in linux

vi /root/.bash_profile


# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs
export JAVA_HOME=/usr/java/jdk1.6.0_16
PATH=$PATH:/usr/java/jdk1.6.0_16


export PATH
unset USERNAME

Set Java path for all user

vi /etc/.bash_profile
Thursday, January 6, 2011

How to mount Linux LVM volume partitions on Linux

1) Once we were in live session, we opened a terminal and ran

[root]# fdisk -l

This lists out the partition table of the system and it looked something like this

Device Boot Start End Blocks Id System
/dev/sda1 * 1 4864 39070048+ 7 HPFS/NTFS
/dev/sda2 4865 6691 14675377+ 83 LVM2_member
...

2) The good news was that the system was at least able to distinguish the partitions. So, in order to backup the data, the next step was to access the /dev/sda2 partition. But since it is an lvm partition we will had to take some additional steps to mount it.

Now, run the pvs command. Please note that while in live session you may find that this is not installed by default. In order to install the required tools, run the following command.

[shredder12]$ sudo apt-get install lvm2

Of course, you should be connected to internet. Once you are done with this run pvs.

[root]# pvs

This will list the volume groups to which our physical volume /dev/sda2 belonged. It would be of the form

PV VG Fmt Attr PSize PFree
/dev/hda2 VolGroup01 lvm2 a- 148.94G 32.00M

The second field, VG, shows the Volume group. The above output is just an example, showing that we are concerned with the Volume group "VolGroup01". The next step is to list the information about this volume group.

[root]# lvdisplay /dev/VolGroup01

It will throw a bunch of ouput, but the one we are concerned with is LV Name. It will look something like this

LV Name /dev/VolGroup01/LogVol00

In our case, there were two entries of type LV Name, the other being LogVol01, the swap. The whole output along with it will help you to identify the target logical volume you are looking for. Assuming that the above one is the partition that we need to mount, just use the usual method to mount it.

[root]# mount /dev/VolGroup01/LogVol00 /mnt

Now, you can to find the data you were looking for in the /mnt folder.