Admins eHow SysAdmin Tips & Tricks

September 9, 2011

Install Apache2 + PHP5 on Debian

Filed under: Apache,Debian,PHP — Tags: , , , , — admin @ 8:16 am

Very Simple…

apt-get install libapache2-mod-php5
/etc/init.d/apache2 restart

Xen – PyGrub – warning: grub-probe can’t find drive for /dev/xvda1

Filed under: Debian — Tags: , , , , , , , — admin @ 8:05 am

If you get following while doing “apt-get upgrade” on Debian Squeeze :

Setting up linux-image-2.6.32-5-amd64 (2.6.32-35squeeze1) ...
Running depmod.
Running update-initramfs.
update-initramfs: Generating /boot/initrd.img-2.6.32-5-amd64
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 2.6.32-5-amd64 /boot/vmlinuz-2.6.32-5-amd64
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 2.6.32-5-amd64 /boot/vmlinuz-2.6.32-5-amd64
Searching for GRUB installation directory ... found: /boot/grub
warning: grub-probe can't find drive for /dev/xvda1.
grub-probe: error: cannot find a GRUB drive for /dev/xvda1. Check your device.map.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-2.6.32-5-amd64.postinst line 799, line 2.
dpkg: error processing linux-image-2.6.32-5-amd64 (--configure):
subprocess installed post-installation script returned error exit status 2

The solution is :

Run…

echo '(hd0) /dev/xvda' > /boot/grub/device.map
mknod /dev/xvda b 202 0

Edit /usr/sbin/update-grub :
Change…

find_device ()
{
if ! test -e ${device_map} ; then
echo quit | grub --batch --no-floppy --device-map=${device_map} > /dev/null
fi
grub-probe --device-map=${device_map} -t device $1 2> /dev/null
}

to…

find_device ()
{
if ! test -e ${device_map} ; then
echo quit | grub --batch --no-floppy --device-map=${device_map} > /dev/null
fi
#grub-probe --device-map=${device_map} -t device $1 2> /dev/null
echo /dev/xvda
}

Run…

update-grub 0
sed -i "s/xvda/xvda1/g" /boot/grub/menu.lst

Everything should be fixed now.

References :
http://www.sysadmintalk.net/forums/Thread-PyGrub-grub-probe-can-t-find-drive-for-dev-xvda1-error-Debian-Squeeze
http://lists.bitfolk.com/lurker/message/20080529.142153.954fedf4.el.html

September 5, 2011

IPTables packet traverse map

Filed under: CentOS,Debian,General,linux,Security — Tags: , , , , , — admin @ 7:23 am

1.

(more…)

June 19, 2011

Linux Redirection Cheat Sheet

Filed under: Bash,linux — Tags: , , , , — admin @ 2:32 pm
Normal Redirect:

command > filename        Redirect command output to a file
command >> filename       APPEND into a file
command < filename        Type a text file and pass the text to command
commandA  |  commandB     Pipe the output from commandA into commandB
commandA &  commandB      Run commandA and then run commandB
commandA && commandB      Run commandA, if it succeeds then run commandB
commandA || commandB      Run commandA, if it fails then run commandB

Numeric handles:

STDIN  = 0  Keyboard input
STDOUT = 1  Text output
STDERR = 2  Error text output
UNDEFINED = 3-9

command 2> filename       Redirect any error message into a file
command 2>> filename      Append any error message into a file
command > file 2>&1       Redirect errors and output to one file
command > file 2<&1       Redirect output and errors to one file
command > fileA 2> fileB  Redirect output and errors to separate files
command 2>&1 >filename    This will fail!

Redirect to /dev/null (hide errors):

command 2> /dev/null            Redirect error messages to /dev/null
command >/dev/null 2>&1         Redirect error and output to /dev/null
command >filename 2> /dev/null  Redirect output to file but suppress error

Source : ss64.com

June 7, 2011

Thanks to Android, HTC sales in May reached $1.42 billion, more than double last year’s total

Filed under: General — Tags: , , , , , — admin @ 3:52 pm

HTC has doubled its sales in 1 year by selling android phones, it shows how smart the managers of HTC are.
HTC originally had a partnership with Microsoft to implement WP7 on its hardware, when HTC implemented Android, Microsoft sued HTC due breaking the agreement.
Finally HTC insisted on using Android and agreed to pay $5 fine to Microsoft per Android device sold. Microsoft has received millions of dollar from HTC so far due to this fine.
In fact Microsoft has made more revenue from Android compared to its own mobile solutions ! Microsoft should be a big fan of Android now.
Current position of HTC puts Nokia partnership with Microsoft in question , when Nokia chose WP7 for its smartphones , Google made an announcement calling Nokia’s decision a big mistake.
Is Nokia wise enough to pay millions dollars of fine to Microsoft like HTC did and implement Android ? We should wait and see 🙂
All of this are very bad news for Apple. no company likes to see its competitors having 100% revenue increase in just one year.
I can see the comments of disappointed Apple Lovers all over the web now , begging Apple to do something , like this one :

Please Apple put some effort in your next phone. Otherwise i have to buy one of these HTC products too.

Its time to say goodbye to iOS and iPhone and switch to Android 🙂

Source :
http://www.engadget.com/2011/06/07/htc-sales-in-may-reached-1-42-billion-more-than-double-last-ye/

June 6, 2011

No iPhone 5 for Apple lovers , Apple stock price fall

Filed under: General — Tags: , , , , , , — admin @ 10:35 pm

Regardless of announcing some new updates including iCloud, iOS 5 and Mac OS X Lion in Apple’s WWDC 2011, The Apple stock price fell dramatically this afternoon losing 4.57% of its value.
Seems the investors already know that apple has fell behind the competition and has nothing new to offer. I expect more price fall and a gap between today’s closing price and tomorrow’s opening price for AAPL.

It is very clear that market is not satisfied and will continue to react to absence of announcement of an iPhone 5.
Many apple lovers were waiting for iPhone 5 and with no clear release date, a large portion will decide to not to wait anymore and buy an available phone.
It makes a brilliant opportunity for android device makers like Samsung, HTC, LG and Motorola to saturate the market with their own products and cut the Apple’s market share even faster.
Some rumors suggest that iPhone 5 will be released with iOS 5 this fall, but even if it’s true, it is a very bad move for Apple. disappointing many customers.
It is time to say goodbye to iPhone and switch to Android devices 🙂

May 27, 2011

file_post_contents php function

Filed under: PHP — Tags: , , — admin @ 6:30 pm

This php function is useful when you want to send arguments by POST method instead of GET. very handy 😉
The usage is same as file_get_contents

function file_post_contents($url,$headers=false) {
    $url = parse_url($url);

    if (!isset($url['port'])) {
      if ($url['scheme'] == 'http') { $url['port']=80; }
      elseif ($url['scheme'] == 'https') { $url['port']=443; }
    }
    $url['query']=isset($url['query'])?$url['query']:'';

    $url['protocol']=$url['scheme'].'://';
    $eol="\r\n";

    $headers2 =  "POST ".$url['protocol'].$url['host'].$url['path']." HTTP/1.0".$eol. 
                "Host: ".$url['host'].$eol. 
                "Referer: ".$url['protocol'].$url['host'].$url['path'].$eol. 
                "Content-Type: application/x-www-form-urlencoded".$eol. 
                "Content-Length: ".strlen($url['query']).$eol.
                $eol.$url['query'];
    $fp = fsockopen($url['host'], $url['port'], $errno, $errstr, 30); 
    if($fp) {
      fputs($fp, $headers2);
      $result = '';
      while(!feof($fp)) { $result .= fgets($fp, 128); }
      fclose($fp);
      if (!$headers) {
        //removes headers
        $pattern="/^.*\r\n\r\n/s";
        $result=preg_replace($pattern,'',$result);
      }
      return $result;
    }
}

May 25, 2011

YouTube Monkeys

Filed under: General — admin @ 7:59 am

No Comments 😀

May 16, 2011

iPhone 4 awarded Guinness World Records – Poor Apple

Filed under: General — Tags: , , , , — admin @ 7:09 am

After market of smart phones is conquered by an army of Android phones and iOS market share is falling so fast,
I heard the news that iPhone 4 is awarded some Guinness Word Records , it seems a good news for fruit company fans at the first glance, but they should hope no one reads the full story 😀
Lets see what is the Record for : “Fastest-Selling Portable Gaming System” wtf ! and it is compared to PSP and Nintendo.

Guinness states that the iPhone 4’s first-day sales estimates of 1.5 million make it the fastest selling game system in history. By comparison the PSP only sold 200,000 units its first day and the Nintendo DS sold 600,000 units in its first week.

I guess fruit company should sue Guinness for this record because everyone was thinking iPhone is a smartphone and does not fall into the category of portable gaming systems ! lol
and now we may expect some new records for iPhone in near future :
The fastest selling portable internet TV ( cause you can watch youtube on it )
The fastest selling portable WC notification system ( cause it shows the place of public WC’s on the map )
and many more …
After fruit company shot itself in the leg by suing Samsung for some nonsense claims, now we see this desperate attempt to save iPhone.
I am sorry Steve, let me tell you what you should do to save iPhone market.
You should create an iPhone with Android OS on it , If I remember correctly it is what you have already done for your desktops and laptops after your share of desktop and laptop market dropped to nothing. right ?
you let users buy your products and install windows on it. that was a wise decision 🙂
Why don’t you learn a lesson from history ?

May 9, 2011

PayPal Online Subscription Link Generator

Filed under: General — Tags: , , , , — admin @ 10:59 am

Your PayPal E-mail:
Description:
Amount: USD
« Newer PostsOlder Posts »

Powered by WordPress