Friday, January 7, 2011

Thursday, January 6, 2011

clear mysql-bin log file or disable mysql bin log

Step 1,
Go to folder
/var/lib/mysql

Step 2:
Run:
[root@localhost mysql]# mysqladmin -u xxxx -pxxxx flush-logs

Mysql will create a new bin-log file - for my server it is mysql-bin.000014
-rw-rw---- 1 mysql mysql 22770974 Jan 6 04:02 mysql-bin.000011
-rw-rw---- 1 mysql mysql 79427070 Jan 6 04:04 mysql-bin.000012
-rw-rw---- 1 mysql mysql 109593 Jan 6 04:07 mysql-bin.000013
-rw-rw---- 1 mysql mysql 1318 Jan 6 04:07 mysql-bin.000014
-rw-rw---- 1 mysql mysql 266 Jan 6 04:07 mysql-bin.index

Step 3:
You can delete all mysql-bin log file except the latest one.
Here is the sample:
rm mysql-bin.000004 -f
rm mysql-bin.000005 -f
rm mysql-bin.000006 -f
rm mysql-bin.000007 -f
rm mysql-bin.00000* -f


Delete mysql bin log file older than 2 days
find /var/lib/mysql/mysql-bin.* -mtime +2 -exec rm {} \;

Thursday, December 16, 2010

ubuntu enable apache rewrite engine

root@SS:/# a2enmod rewrite
Module rewrite installed; run /etc/init.d/apache2 force-reload to enable.
root@SS:/# /etc/init.d/apache2 force-reload

Thursday, November 25, 2010

Adding a startup script to be run at bootup - ubuntu

513 mkdir startup
514 mv iptable-rules.20101124 startup/
515 cd startup/
516 ll
517 vim mybootup.sh
518 ll
519 cp mybootup.sh /etc/init.d/
520 chmod +x /etc/init.d/mybootup.sh
521 update-rc.d mybootup.sh defaults

Tuesday, November 23, 2010

Could not find gem 'mysql2 (>= 0, runtime)' in any of the gem sources listed in your Gemfile.

My OS is ubuntu.
I have issue when I try to run 'rake db:create'.
greg@cm-test:/mydisk/ruby/blog/config$ rake db:create
(in /mydisk/ruby/blog)
Could not find gem 'mysql2 (>= 0, runtime)' in any of the gem sources listed in your Gemfile.
Try running `bundle install`.


Here is what I did to fix this issue
1, find current libmysqlclient for your system. Then install it
greg@cm-test:/mydisk/ruby/blog/config$ sudo apt-get install libmysqlclient15-dev

2, After install mysql lib, need to install gem mysql

greg@cm-test:/mydisk/ruby/blog/config$ sudo gem install mysql -- --with-mysql-config=/usr/bin/mysql_config

You need to find correct path for mysql_config
greg@cm-test:/mydisk/ruby/blog/config$ sudo updatedb
greg@cm-test:/mydisk/ruby/blog/config$ locate mysql_config

3, do bundle all
greg@cm-test:/mydisk/ruby/blog/config$ sudo bundle install
Fetching source index for http://rubygems.org/
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.4.2)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.6)
Using tzinfo (0.3.23)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.10)
Using actionmailer (3.0.3)
Using arel (2.0.4)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bundler (1.0.7)
Installing mysql2 (0.2.6) with native extensions
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

greg@cm-test:/mydisk/ruby/blog/config$ bundle show
Gems included by the bundle:
* abstract (1.0.0)
* actionmailer (3.0.3)
* actionpack (3.0.3)
* activemodel (3.0.3)
* activerecord (3.0.3)
* activeresource (3.0.3)
* activesupport (3.0.3)
* arel (2.0.4)
* builder (2.1.2)
* bundler (1.0.7)
* erubis (2.6.6)
* i18n (0.4.2)
* mail (2.2.10)
* mime-types (1.16)
* mysql2 (0.2.6)
* polyglot (0.3.1)
* rack (1.2.1)
* rack-mount (0.6.13)
* rack-test (0.5.6)
* rails (3.0.3)
* railties (3.0.3)
* rake (0.8.7)
* thor (0.14.6)
* treetop (1.4.9)
* tzinfo (0.3.23)

greg@cm-test:/mydisk/ruby/blog/config$ rake db:create
(in /mydisk/ruby/blog)

Thursday, November 18, 2010

Wednesday, October 6, 2010

nessus: The remote service supports the use of weak SSL ciphers.

1, test your ssl if support weak ssl
openssl s_client -connect 172.22.113.113:8443 -cipher LOW

2, disable tomcat weak ciphers
In order to achieve this I made a simple change:

in //conf/templates/server.xml I added:

ciphers="SSL_RSA_WITH_RC4_128_MD5" right after sslProtocol = "TLS" and restarted the hyperic server.