Wednesday, December 7, 2011

Hiya

If you human or just plain silly like me. I find I forget what packages and library’s I need to install for Ruby Enterprise.

Here is my brief howto.
apt-get install libssl-dev libreadline-dev

Monday, October 31, 2011

Today I received an interesting request for one of the dev KVM vm's.
I was requested to raise the memory.

By default I always use 512Mb. Id never raised the memory before.
A quick google search introduced me too.

virsh edit devvm.

HTH
Brent

Friday, September 23, 2011

Speed up FreeBSD ports download.

I find FreeBSD ports randomly gets it's source server list from /usr/ports/Mk/bsd.sites.mk, as defined by the port maintainer.

But the problem is, sometimes the server chosen is just to damn slow.

In steps fastest_sites.

All you need to do is:
1) Install port
2) Run /usr/local/bin/fastest_sites > /usr/local/etc/ports_sites.conf
3) echo ".include \"/usr/local/etc/ports_sites.conf\"" >> /etc/make.conf

And thats that.

If you want to cron it.

0 6 * * * /usr/local/bin/fastest_sites > /usr/local/etc/ports_sites.conf
 
HTH
Brent 

Friday, September 2, 2011

Im fortunate that I work for a very large web hosting company.
So you can imagine, I SSH to a large number of hosts. Im ashamed to say it, but Ive just disabled SSH checking.

The way I have achieved that is:

alias ssh="ssh -c arcfour -o TCPKeepAlive=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"

Friday, August 19, 2011

I got this  weird message today doing a mysqldump.

mysqldump: Error 2020: Got packet bigger than 'max_allowed_packet' bytes when dumping table

Answer is to add --max_allowed_packet= to your command line.

E.g. time mysqldump --max_allowed_packet=512M database > database.sql.

HTH

Brent

Thursday, August 18, 2011

I sometimes use gedit, for a means of quick coding as my IDE.

Here is some tips that may make your life easier.
  1. Run gedit.
  2. Open Preferences from the gedit menu and select the Editor tab.
  3. Change Tab width: to 2.
  4. Select (make sure a check mark is in) Insert spaces instead of tabs.
  5. Turn on "Automatic indentation" as well.
  6. Open the View tab and turn on "Display line numbers".
HTH

Brent

Saturday, August 13, 2011

Remove MySQL Binary Log with PURGE BINARY LOGS Statement

A while ago I had a problem whereby on a very busy mysql cluster,
I had a problem whereby mysql was filling up /var. 
To fixed the problem, I made use of Linux's find and its ability to find 
all mysqls binary logs older than a certain date. 

Ive now discovered 'PURGE BINARY LOGS'.  
Heres my examples:

mysql -u username -p
mysql>PURGE BINARY LOGS TO 'mysql-bin.000005';
 
shell> mysql -u username -p
mysql> PURGE BINARY LOGS BEFORE '2011-08-13 00:00:00';


For more information. 
http://dev.mysql.com/doc/refman/5.0/en/purge-binary-logs.html 

Encrypt a file with a password

This will add an encrypted file called [filename].gpg.
gpg --cipher-algo AES -c [filename]
(passphrase will be prompted) 
This will create the decrypted file called [filename].
gpg -o [filename] -d [filename].gpg

Thursday, August 11, 2011

Problems with Apache over NFS (Or maybe any other network file system for that matter), maybe look at

http://httpd.apache.org/docs/2.2/mod/core.html#enablemmap
http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile

Long story short, disable these.
I.e.
vi /etc/apache2/conf.d/mmap.conf
add

EnableMMAP off
EnableSendfile off


HTH

Brent

*Update*
Just to add. I just came across these links.

http://www.cyberciti.biz/tips/apache-223-corrupt-file-download-issue.html
http://www.scribd.com/doc/7234985/Scaling-Apache-Handout

Wednesday, August 3, 2011

Debugging NFS

Debugging nfs problems can be frustrating. I just found on stackoverflow,
that this helps you get more info from the logs:
 
* RPC debugging:
       echo 2048 > /proc/sys/sunrpc/rpc_debug
       grep . /proc/net/rpc/*/content
       ls -l /proc/fs/nfsd
       cat /proc/fs/nfs/exports 
* NFS debugging:
      # turn on linux nfs debug
      echo 1 > /proc/sys/sunrpc/nfs_debug
      # turn off linux nfs debug
      echo 0 > /proc/sys/sunrpc/nfs_debug 
 
HTH 

Secure Apache2

Im fortunate that, in the past, I've been audited for PCI Compliancy and gained extended experience in server hardening.

One of the key things I see that most don't do is a simple Apache config change to help secure ones self.

Just:
vim /etc/apache2/conf.d/security 
and add

ServerTokens Prod
ServerSignature Off
TraceEnable Off
 
/etc/init.d/apache2 restart

Mysql : Problems with debian-sys-maint db user.

I recently restored a Mysql full database backup to a new server. As a result I had a problem with the system user (i.e. debian-sys-maint ).

The quickest way to get 'debian-sys-maint' working on the new server is:

1) /etc/mysql/debian.cnf and get the password.
2) Run mysql -u root -p
3) Run GRANT ALL PRIVILEGES ON *.* \
TO 'debian-sys-maint'@'localhost' \
IDENTIFIED BY 'passwordIndebian.cnf' WITH GRANT OPTION;
 
HTH
Brent 

Thursday, April 14, 2011

I love performance and optimising tuning.

I recently came across another MySQL tuning tool.
http://www.day32.com/MySQL/tuning-primer.sh

(You will need to first install bc)

HTH

Brent