IPTables

Config IPTables to provide a firewall by only exposing ports you want to communicate through.

service iptables start

chkconfig iptables on

service iptables status

iptables -I RH-Firewall-1-INPUT 3 -p tcp -m tcp –dport 80 –tcp-flags SYN,RST,ACK SYN -j ACCEPT

/etc/init.d/iptables save

Mysql Caching

By default there is no caching enabled in MYSQL, to improve performance, add a little memory to the cache to help speed up responses by storing queries.

in mysql type

show variables like 'query_cache_size';

this will show the value of the current cache size, to modify the cache size use ->

SET GLOBAL query_cache_size = 16777216;

That sets the cache to 16mb of each instance of mysql that runs. Don’t over do this value if you are running on a VPS with limited resources.

How do you know if your cache size is right? Check out the Qcaches and look at the results

show status like "qcache%";

+————————-+———-+
| Variable_name           | Value    |
+————————-+———-+
| Qcache_free_blocks      | 42       |
| Qcache_free_memory      | 16431944 |
| Qcache_hits             | 339      |
| Qcache_inserts          | 759      |
| Qcache_lowmem_prunes    | 0        |
| Qcache_not_cached       | 179      |
| Qcache_queries_in_cache | 188      |
| Qcache_total_blocks     | 451      |
+————————-+———-+
The lowmem_prunes is the important value here,  it counts the number of  times the cache had to be free up spaces to cache a new result set.

PID Off….

find out the process ID of a process

pidof processname

to kill it?

kill -9 PID

Copy files between servers using SCP

scp username@hostB:~/myfile.file /localdir

hostB is the remote server we want to copy the file from

Loading mysql db from bash term

create database dbname;

use dbname;

source dbname.sql;

XEN

http://www.howtoforge.com/centos_5.0_xen

Proc Info

System Info – procinfo
procinfo gathers some system data from the /proc directory and prints it formatted on the screen.

Some of the information displayed is

Last Boot time
Load Average
average number of jobs running
number of runnable processes
total number of processes
PID of the last process run (idem)
Swap info
Memory resources
Number of disks
IRQ info
Installed modules (with the -a or -m option)
File Systems (with the -a or -m option)
To automatically update the displayed info every 30 seconds

yum install procinfo

procinfo -fn30

Free up some memory with DROP Cache

sync; echo 3 > /proc/sys/vm/drop_caches

Writing to this will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
This is a non-destructive operation, and dirty objects are not freeable, the user should run “sync” first in order to make sure all cached objects are freed

Change the default editor for Crontab

export EDITOR=nano

Install the virtual viewer a VNC Client

Install the Virtual Viewer VNC Client
yum install virt-viewer