Debian Hack - How to Setup your Mirror!
This might not be for all of you but for those Linuxers out there, here’s an example of how to setup your mirror:
(Mirror is a way of replicating one server to another btw if you didn’t know.)
To download the mirrors I use this script:
<script sync_mirror.sh>#!/bin/bash OPTIONS="--nosource --progress --postcleanup --ignore-release-gpg --ignore-small-errors --pdiff=none"; MIRROR=`basename ${0} | cut -f2 -d "_"` DEST="/home/debian-mirror" case "${MIRROR}" in "debian" ) METHOD="--method=http" HOST="--host=ftp.de.debian.org" ROOT="--root=debian" DIST="--dist=etch,etch-proposed-updates" ARCH="--arch=i386" SECTION="--section=main,contrib,non-free" DEST="${DEST}/debian/" ;; "security" ) METHOD="--method=ftp" HOST="--host=security.debian.org" ROOT="--root=/debian-security/" DIST="--dist=etch/updates" ARCH="--arch=i386" SECTION="--section=main,contrib,non-free" DEST="${DEST}/debian-security/" ;; "volatile" ) METHOD="--method=http" HOST="--host=volatile.debian.org" ROOT="--root=debian-volatile" DIST="--dist=etch/volatile" ARCH="--arch=i386" SECTION="--section=main,contrib,non-free" DEST="${DEST}/debian-volatile/" ;; "multimedia" ) METHOD="--method=http" HOST="--host=www.debian-multimedia.org" ROOT="--root=/" DIST="--dist=etch" ARCH="--arch=i386" SECTION="--section=main" DEST="${DEST}/debian-multimedia/" ;; "backports" ) METHOD="--method=http" HOST="--host=www.backports.org" ROOT="--root=debian" DIST="--dist=etch-backports" ARCH="--arch=i386" SECTION="--section=main,contrib,non-free" DEST="${DEST}/debian-backports/" ;; * ) echo "${0} called incorrectly" exit ;; esac debmirror ${OPTIONS} ${METHOD} ${HOST} ${ROOT} ${DIST} ${ARCH} ${SECTION} ${DEST}</script sync_mirror.sh>
To setup the permissions I use this script:
<script permissions.sh>#!/bin/bash MIRROR=`basename ${0} | cut -f2 -d "_"` DEST="/home/debian-mirror" case "${MIRROR}" in "debian" ) DEST="${DEST}/debian/" ;; "security" ) DEST="${DEST}/debian-security/" ;; "volatile" ) DEST="${DEST}/debian-volatile/" ;; "multimedia" ) DEST="${DEST}/debian-multimedia/" ;; "backports" ) DEST="${DEST}/debian-backports/" ;; * ) echo "${0} called incorrectly" exit ;; esac echo "Setting Ownership" chown -R www-data:www-data ${DEST} echo "Setting File Permissions" chmod -R 660 ${DEST} echo "Setting Folder Permissions" find ${DEST} -type d -exec chmod 770 {} \;</script permissions.sh>
And then to pull it all together I have thefollowing directory structure (mirrors left out as it’s a ling list of files)
/home/debian-mirror/ |-- debian |-- debian-backports |-- debian-multimedia |-- debian-security |-- debian-volatile |-- scripts | |-- permissions.sh | `-- sync_mirror.sh `-- scripts.d |-- mirror_backports -> ../scripts/sync_mirror.sh |-- mirror_debian -> ../scripts/sync_mirror.sh |-- mirror_multimedia -> ../scripts/sync_mirror.sh |-- mirror_security -> ../scripts/sync_mirror.sh |-- mirror_volatile -> ../scripts/sync_mirror.sh |-- permissions_backports -> ../scripts/permissions.sh |-- permissions_debian -> ../scripts/permissions.sh |-- permissions_multimedia -> ../scripts/permissions.sh |-- permissions_security -> ../scripts/permissions.sh `-- permissions_volatile -> ../scripts/permissions.shAnd then I just setup a cronjob:
0 0 * * 0 root /bin/run-parts --verbose /home/debian-mirror/scripts.d | /usr/bin/mailx -s "`uname -n` - Debian mirror sync completed" rootThis was to disable the mirroring of one of the repositories I just need to remove the symlink from the scripts.d folder
Ubuntu Hack - How to Make Ubuntu run Super Fast!

For those of us who are anti-Windows and anti-Mac, we will benefit from learning how to make Ubuntu run super fast.
Here’s some great tips on minimizing processes to make your Ubuntu run faster than ever:
1. Remove Network Manager if you do not need it “sudo apt-get remove network-manager”. If possible give yourself a static IP in /etc/network/interfaces like so:
auto lo
iface lo inet loopbackauto eth0
iface eth0 inet static
address 192.168.1.150
netmask 255.255.255.0
network 192.168.1.100
broadcast 192.168.0.255
gateway 192.168.1.1Having a static IP helps with boot time as your machine doesn’t have to communicate with the router/dhcp server as much to obtain an address.
2. Also remove firestarter or whatever graphical firewall frontend you’re using. Learn to control iptables at boot up and shutdown. It’ll be much snappier.
3. Install bum, “sudo apt-get install bum” and run it with root access. Shut off all unnecessary services. If you’re not sure about a service research it before shutting it off. Also, install sysv-rc-conf. Run the application as root. This will allow you to control, in an easy way, what services start at which run level. It’s like bum, but more detailed. Be very careful with which services you are removing from which run-level. If you don’t know what you’re doing here, research it or don’t touch it. After you do this you may want to reboot to make sure you didn’t break anything.
4. Turn off usplash in grub. (Mind you, you’re bootup won’t be as pretty as the splash will go away).
- vim /boot/grub/menu.lst
- on the kernel line delete the words “splash” and “quiet”
- Reboot to see the changes.
5. If you have a dual core processor, you can decrease your boot time with concurrency.
sudo vim /etc/init.d/rc- and find the line CONCURRENCY=none and change it to:
CONCURRENCY=shell- Reboot to see the changes. (tired of rebooting yet?)
6. Remove some TTYs
I could easily do this by editing /etc/inittab and then commenting the extra TTYs there. With the new upstart mechanism in place, things are a little different.
You have to edit /etc/default/console-setup file. This file defines how many ttys should you get.
Change ACTIVE_CONSOLES=”/dev/tty[1-6]” to the number of consoles you want. Lets say, 3 ttys, then change it to “/dev/tty[1-3]“.
And then goto /etc/event.d/ and change the ttyx files that you DONOT want. Edit them and comment lines starting with “start on runlevel”. So, in this case, you’ll comment the start line in tty4..tty6 files.
Rebooting shoud minimize the number of consoles for you. Worked for me!! Good luck, NOTE: Even though you’ve reduced the tty number, X is still on Alt-F7. Again, go ahead and reboot to make sure you didn’t break anything.
Linux Server Hack - How to Limit Bandwidth with Linux, TC, and iproute2!

Remember I did a quick post on how to write a load-balancing script (or bandwidth throttling)?
Well, today I found another cool script for limiting bandwidth. I believe this one if more complicated but if you need it, it might be greatly helpful.
Here’s the code via Adamsinfo.com:
# Set some variables
#!/bin/bash
EXT_IFACE=”eth0″
INT_IFACE=”eth1″
TC=”tc”
UNITS=”kbit”
LINE=”10000″ #maximum ext link speed
LIMIT=”5000″ #maximum that we’ll allow
Continue reading ‘Linux Server Hack - How to Limit Bandwidth with Linux, TC, and iproute2!’
Linus Torvalds - Software is like sex: it’s better when it’s free

I remember first hearing about Linus Travolds back in the early 90s and I thought Linux was going to be a hit in year 2000.
Well, it turns out I was right, just about 10 years early. You have to admit, Linux is really taking over the world right now with web servers (including this one) and Eee PCs and other laptops that come loaded with Linux.
Anyways, I don’t want to bore my readers, here’s the 15 Great Quotes from the Linus Travolds and Stallman:
1. “To be able to choose between proprietary software packages is to be able to choose your master. Freedom means not having a master. And in the area of computing, freedom means not using proprietary software.”
-Richard M. Stallman2. “Software is like sex: it’s better when it’s free.”
-Linus Torvalds3. “Value your freedom or you will lose it, teaches history. ‘Don’t bother us with politics’, respond those who don’t want to learn.”
-Richard M. Stallman4. “Software patents are a huge potential threat to the ability of people to work together on open source. Making it easier for companies and communities that have patents to make those patents available in a common pool for people to use is one way to try to help developers deal with the threat.”
-Linus Torvalds5. “If programmers deserve to be rewarded for creating innovative programs, by the same token they deserve to be punished if they restrict the use of these programs.”
-Richard M. Stallman6. “One of the questions I’ve always hated answering is how do people make money in open source. And I think that Caldera and Red Hat — and there are a number of other Linux companies going public — basically show that yes, you can actually make money in the open-source area.”
-Linus Torvalds7. “Control over the use of one’s ideas really constitutes control over other people’s lives; and it is usually used to make their lives more difficult.”
-Richard M. Stallman8. “It just makes it even harder for people to even approach the (open source) side, when they then end up having to worry about … public humiliation.”
-Linus Torvalds9. “I founded the free software movement, a movement for freedom to cooperate. Open source was a reaction against our idealism. We are still here and the open-source people have not wiped us out.”
-Richard M. Stallman10. “When it comes to software, I much prefer free software, because I have very seldom seen a program that has worked well enough for my needs, and having sources available can be a life-saver.”
-Linus Torvalds11. “If you focus your mind on the freedom and community that you can build by staying firm, you will find the strength to do it.”
-Richard M. Stallman12. “Anybody who tells me I can’t use a program because it’s not open source, go suck on rms. I’m not interested. 99% of that I run tends to be open source, but that’s _my_ choice, dammit.”
-Linus Torvalds13. “’Free software’ is a matter of liberty, not price. To understand the concept, you should think of ‘free’ as in ‘free speech,’ not as in ‘free beer’.”
-Richard M. Stallman14. “I’m doing a free operating system just a hobby, won’t be big and professional like gnu for 386 (486) AT clones.”
-Linus Torvalds15. “Once GNU is written, everyone will be able to obtain good system software free, just like air.”
-Richard M. Stallman
Wine Version 1.1.5 Now Available for Download!

Wine, a Linux application that lets you run Windows programs, has now released version 1.1.5: (Go knock yourself out now, drink too much wine!)
The Wine development release 1.1.5 is now available. What's new in this release (see below for details): - Substantial JavaScript implementation. - Partial support for layered windows. - Support for Unicode file export in Regedit. - Proper exception handling in widl-generated code. - Asynchronous requests and cookies support in WinHTTP. - Various bug fixes. The source is available from the following locations: http://ibiblio.org/pub/linux/system/emulators/wine/wine-1.1.5.tar.bz2 http://prdownloads.sourceforge.net/wine/wine-1.1.5.tar.bz2 Binary packages for various distributions will be available from: http://www.winehq.org/site/download You will find documentation on http://www.winehq.org/site/documentation You can also get the current source directly from the git repository. Check http://www.winehq.org/site/git for details. Wine is available thanks to the work of many people. See the file AUTHORS in the distribution for the complete list.
Eee PC Hack - How to install Ubuntu Eee for ASUS Eee PCs!

In case you have bought an ASUS Eee PC with Windows, there’s a special version of Ubuntu, customized just for the Eee PC models.
This allows you to install the Ubuntu on Eee PCs without too much headache as it has already been configured for the factory hardware.
Ubuntu Eee is not only Ubuntu optimized for the Asus Eee PC. It’s an operating system, using the Netbook Remix interface, which favors the best software available instead of open source alternatives (ie. Skype instead of Ekiga). Sounds great! How can I help out? Please consider contributing with knowledge or money. And while you’re at it, please become a fan on Facebook and add yourself to the map of users
Here’s some resources for Ubuntu Eee for all you Eee PC lovers:
DIY Linux HACK - HOW TO optimize your Wordpress Blog, MediaWiki, or any other high load website with Compression!
Well, we did a lot of server hacking before with some MySQL, eAccelerator, and httpd.
There’s a lot of major blogs out there I have checked using Web Page Compression Tool that are not using compression. (For one, I checked John Chow’s blog)
Try to check one of your posts instead of checking your main URL as the tool is funky with root domains. (e.g. Check http://zedomax.com/blog/2008/02/23/never-give-up-especially-your-blog-dude/ instead of http://zedomax.com)
Here’s a screenshow of compression test I did for one of John Chow’s posts:

As you can see, John Chow’s blog does not use compression. As a result, he’s losing out on almost 5 times of bandwidth!!!
With level 9 compression, his site could be loaded on your web browser at 21K instead of the whopping 100K.
Now the compression might not be for all of you with slow CPUs. Our Zedomax.com runs on Quad-CPU server which has a lot of CPU processing power.
Here’s a screenshow of my server under normal load:

As you can see, most of the time, my CPU is idling at 80.8%! That means my CPU is pretty much sitting on its ass instead of doing work for me.
Now, if you have a similar situation, compression will help your site load faster and also bring your load down so you can handle more traffic.
Here’s how to enable compression if you have a dedicated or access to root on your server:
(Most servers have zlib installed, if you don’t have zlib installed, you will have to install that first, you can check it by making a test file and putting <?php phpinfo() ?> and search for zlib)
Add the following lines to your /etc/php.ini:
zlib.output_compression = on
zlib.output_compression_level = 5
and then restart apache! (of course):
httpd -k restart
Now, go check one of your posts on the Compression Test Tool here.

As you can see above, I just compressed one of my blog posts by a whopping 76.1%!
If you are using Super Cache plugin for Wordpress, make sure to go to options and do this too:

Now, your server will run faster since there’s less data being transmitted to your visitors, meaning you save bandwith, time, and most importantly, the ability to handle more traffic.
At 70% increase in bandwidth, that could translate to that many more visitors too as bandwidth is directly proportional to amount of time a visitor stays on your site. (Yes, I did take Calculus in college, I failed miserably before passing.) The less time a visitor takes to load a page on your blog or your site, the more time and bandwidth you have for other visitors.)
I was searching through the web for many ways to use compression for server optimization but I couldn’t find any so I sort put everything together here.
Hopefully, it helps you.
And one more thing, you can also check out this great tutorial on your httpd.conf setup.
You can always check out HOWTO decrease load on your server by 5 times also.
DIY HACK - HOWTO Upgrade (or downgrade) from Vista to Windows XP!

(Your computer will be faster and more reliable using Windows XP vs. Vista)
After testing out Windows Vista on one of my 6 PCs laying around my apartment, I finally decided it was time to scrap Vista for Windows XP.
Well, it turns out my HP a6040n desktop I bought off the shelf at Fry’s sucked at downgrading to XP. Why?
You go to HP’s driver downloads and they don’t even have XP drivers. I think HP has to at least put the specs of all the parts on their site. I had to open up the case and track down the motherboard, and then found a generic Intel ethernet driver just to get the internet working.
What a hassle. I love HP computers but this was probably the worst experience. (Well, I could’ve called their tech support but I am too lazy.)
Another problem I encountered? Basically I got one of those blue screen of death because the harddrive is set to “RAID” on BIOS setup and Windows XP cannot detect that unless you got a driver for it.
So all I did was set the settings back to “IDE” on BIOS setup and the blue screen of death disappeared. Wala!
(Trust me, you really don’t need RAID unless you are thinking about running bunch of servers.)
I also did some research and found you can also completely re-format your harddrive using DBAN. Although it took me some 6 hours to DBAN my HP harddrive, it was worth it. DBAN is great if your harddrive seems to be protected or whatever. Just nuke it and go along.
I also made sure to re-partition with room for Ubuntu, which I will be installing next on this experimental PC.
I used to run all Linux computers with VMware running windows on it. It did pretty good and my computer never gave me a blue screen of death. All I had to do was reboot the Virtual Machine but I might be headed down that path again soon.
Now I feel so good, it feels like I really flushed that “hard stool” that was sitting in my gut for 6 months.
Good bye Vista!
Next up we will be covering a step-by-step transition on how to install Ubuntu and use VMware to experience a new way to access the internet. Of couse, if you get bored of our tutorials, you can always go buy a Mac, we like Macs too. (they are unix based, which is pretty much a fancy Linux machine really)
You should also check out the Vista-XP parody ad we made couple months earlier.

