Nginx as a Load Balancer
Posted: October 22, 2011 Filed under: System Administration Leave a comment »It is very basic setup of Nginx as a load balancer. I have two Apache servers (web1.meapay.com & web2.meapay.com). Ngnix will act as a load balancer in front of these two servers
I have done it on Debian squeeze. So first we have to install nginx package
#apt-get install nginx
Edit the nginx configuration file. Before editing, I have copied the original nginx conf file as default.orig
#cd /etc/nginx/sites-available/
#/etc/nginx/sites-available# cp default default.orig
#vi /etc/nginx/sites-available/default
upstream mysite {
server web1.meapay.com;
server web2.meapay.com;
}
server {
server_name http://www.meapay.com:80;
#listen [::]:80 default ipv6only=on; ## listen for ipv6
access_log /var/log/nginx/access.log;
location / {
proxy_pass http://mysite;
proxy_set_header Host $host;
}
}
#/etc/init.d/nginx restart
Its done.
Have FUN
Reference:
http://mickeyben.com/blog/2009/12/30/using-nginx-as-a-load-balancer/
Mounting RAID array device in /etc/fstab in Debian GNU/Linux
Posted: October 18, 2011 Filed under: System Administration Leave a comment »May be helpful for you while mounting RAID array device in /etc/fstab
While making entry in /etc/fstab for newly created RAID device, we need either device name (/dev/md7) or UUID. I got the UUID using the command
#mdadm –detail /dev/md7
and made the entry in fstab. But it did not worked as per expectation
Searched Google about the problem as usual. I found that we have to use the UUID provided by the following command
#blkid /dev/md7
not by the command mdadm. Both UUID are different. It works. I have no idea why they are different. So please if you find please tell me as well.
Have FUN! again
Copy GPT Partitioning layout to other hard disk drive
Posted: October 18, 2011 Filed under: System Administration Leave a comment »To copy GPT Partition layout to many drives we need sgdisk. sfdisk cant do that.
As of Debian 6.0. Installer does not have sgdisk. So I had rebooted the machine from Gparted live cd. and ran the command given below.
Note that the /dev/sdb is destination drive and source is second device(/dev/sda) (exchange them at your own risk). It will copy partition layout from /dev/sda to /dev/sdb
#sgdisk -R=/dev/sdb /dev/sda
The command below is required coz the first command copy/assign the same GUID to new device. So to assign another random unique GUID run the following command
#sgdisk -G /dev/sdb
Have FUN!
GigaByte GA-P67A-UD4-B3 Motherboard with Intel i7 restarting
Posted: October 18, 2011 Filed under: System Administration 2 Comments »It works for me. Please go ahead at your own risk.
I had assembled the Desktop Machine having GIGABYTE motherboard and Intel CPU 2 days before. It was working fine. Today for some reason I need it to reboot. It starts keep on restarting after initial BIOS Configuration screen. I was not able to go to BIOS configuration. Tried new Power Supply. Disconnected all the components. Tried different RAM slots with different RAM modules. No use.
I Googled about the problem and find the solution at link pasted at the end of the post as reference.
Solution:
1. Power off the Machine
2. Press and hold the Power On/Off button located on the cabinet CPU/BOX
3. While holding Power On and off button, switch on the power supply for the computer/cpu from the wall outlet.
4. When the display appears power off the computer and on again
5. It will show it is rewriting its flash from backup flash
6. Will up and running fine without any problem
According to the article the problem was due to corrupted BIOS
Have FUN!
Reference: http://forum.giga-byte.co.uk/index.php?topic=6542.0
How to Modify Participate in package survey? option in Debian
Posted: October 13, 2011 Filed under: System Administration Leave a comment »If by mistaken we had selected “Yes” to Participate in package survey? instead of “No”, during installation. It can be be modified at later stage by running the command as below
#dpkg-reconfigure popularity-contest
It will show you the same screen as the installation time. So we can select “No” this time
and Have FUN!
Change Debian root password without CD
Posted: October 8, 2011 Filed under: System Administration 4 Comments »It Works for me for Debian. Follow at you own risk. More Risk more profit and loss
If you had installed Debian or any other GNU/Linux Machine after having all or any one of Green Label/MaximummICE/CarloRossi, most likely the chances are you have forgetten the root password. If you forget root password for any other reason still you can follow the steps to reset root password
- Reboot the machine (If people are accessing service then they would get disconnected)
- At the grub prompt press ‘E’ or ‘e’ to pass kernel perimeters
- Go to the line that starts with “Linux” and add “init=/bin/sh” (without quotes) at the end of the line
- Then hold ctrl and press x key to boot the machine
- It will take to you # prompt with root privileges.
- / is mount as read only so you have to mount it as read/write
#mount -n -o remount,rw /
7. #vi /etc/passwd
8. Go to the line that stats with “root” and remove “x” from the second column. Save the file and reboot the machine/server
9. At login prompt enter “root” as user and you are logged in (it wont ask you password)
10. To change password
#passwd
Enter new UNIX password:
Retype new UNIX password:
11. Of-course you can choose easy password to remember e.g. MagicMoments, SMIRNOFF, GoldenEagle, RedKnight, KingFisher But very easy for cracker to crack.So choose another one.
Have FUN !
Installing Driver for Broadcom NIC during Debian installation
Posted: October 5, 2011 Filed under: System Administration Leave a comment »Installer prompted for driver for Broad com NIC during installation. As the drivers are available only via non-free. So were not available on Installer CD/DVD. Installer ask if this driver is on external USB stick etc. I was lazy and always use Pauls’ USB. Today Paul forget his USB at home. I find the deb package on Debian website. Downloaded and copied and extracted to my USB. Installer refused to get driver from USB. I thought it may not be on proper location. So i copied driver in another directory and on the root (without any directory) of USB as well. Still installer refused to get the driver.
I Googled again and what i find is….
My USB key has NTFS file system and installer can read from FAT only
Solution: Backed up all the USB data. Formatted USB as FAT. Copied Broadcom NIC Firmware files to USB. Tried again. Every thing was fine.
Be careful while Installing driver from external media and have Fun..