Install mod_pagespeed (Website Optimizer) for Apache in CentOS

mod_pagespeed is an open source module for Apache web server that automatically optimize Web Pages to improve better performance while serving web pages using Apache HTTP Server. It has several filters that automatically optimize files like HTML, CSS, JavaScript, JPEG, PNG and other resources.

Step 1: Enabling Google’s mod_pagespeed Repository

Create a file called /etc/yum.repos.d/mod-pagespeed.repo with the help of your favourite editor and add the following lines of code to it based on your OS bit. Read More

Use a Different Color for the Root Shell Prompt

Linux only: This is an excellent tip that changes the prompt to red when using the root account from the terminal—as a reminder to be more careful. Using the tip is relatively simple—just edit the /root/.bashrc file and add in the following, preferably commenting out the existing lines that set the color, though you can simply add this line to the end of the file.
Read More

How to Back Up MySQL Databases

While automated backups are important, sometimes you just want to take a quick and dirty snapshot before making a change to your data.

Creating A Backup

The mysqldump command is used to create textfile “dumps” of databases managed by MySQL. These dumps are just files with all the SQL commands needed to recreate the database from scratch. The process is quick and easy.
If you want to back up a single database, you merely create the dump and send the output into a file, like so:
mysqldump database_name > database_name.sql
Multiple databases can be backed up at the same time: Read More

Number of open connections per remote host (netstat)

The following command can be used to find out the number of connections per remote hosts (which is useful to identify denial-of-service attacks):

# netstat -n | grep 'tcp\|udp' | awk '{ print $5; }' | cut -d: -f1 | sort | uniq -c | sort -nr

netstat -n is just faster than without the -n parameter since it shows numerical addresses instead of trying to determine symbolic host, port or user names.
grep 'tcp\|udp' only shows tcp and udp connections (thus removing unix sockets and headers). Read More