Sunday, June 30, 2013

Install MCRYPT for Centos 6.3

MCRYPT is used to encrypt data. For example, user login passwords.

The EPEL repository provides for the mcrypt package.

Step 1: Download and install the files to support EPEL repository
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
wget  http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6
rpm --import RPM-GPG-KEY-EPEL-6
rpm -i epel-release-6-8.noarch.rpm

Step 2: Install mcrypt package

yum install php-mcrypt

Tuesday, June 25, 2013

Autoconfiguration ipv4 address

A funny thing happen on a newly installed MS Windows 8. After setting the fixed IP on the network interface (cable), it kept getting a an IANA ip of 196.254.x.x.

Although, the fixed IP was entered correctly, 10.x.x.x, the command ipconfig showed that it was still using the 196.254.x.x. Driving me mad, this don't happen on Linux as far as I know.

Resolve this by disabling the interface that is causing the problem.

At the command prompt as Admin follow the steps given below;

Step 1: Identify the interface name (Idx)
> netsh interface ipv4 show inter

Step 2: Disable the interface, replaceing the XXX below with the Idx found in Step 1.

> netsh interface ipv4 set interface XXX dadtransmit=0 store=persistent

Thanks to Lyngtinh

Tuesday, June 11, 2013

Install Clamav antivirus on Centos

Clamav is a much misunderstood software, at least from the response of people I know.

This is a follow up of previous posting http://tboxmy.blogspot.com/2011/06/open-source-software-antivirus-called.html

A simple to read manual can be found at
http://www.clamav.net/doc/latest/clamdoc.pdf

However, here are steps I took for the installation on Centos 6.3 and Centos 5.6

Step 1: Install required repository for clamav
http://tboxmy.blogspot.com/2013/06/install-yum-repo-for-centos.html

Step 2: Install the clamav software
yum install clamd clamav clamav-db

Step 3: Edit the configuration files with your own preferences
/etc/clamd.conf
/etc/freshclam.conf

Step 4: Test the scan with an example directory [/tmp/samples] and save the results in [output.scan]
clamscan -r -l output.scan /tmp/samples

You should notice a warning that the virus database is outdated.

Step 5: Update the virus database. Make sure the server has internet access, then type
freshclam

By default update is done daily, but can be changed by moving the /etc/cron.daily/freshclam to another cron folder.

Step 6: Schedule the scan with crontab
Use the command in step 4 as an example

Step 7: Manage how files detected as virus are handled

e.g. use perl-File-Scan-ClamAV



Install Yum repo for Centos

Adding additional source of packages (software) for Centos will greatly reduce the need to recompile OSS packages. Epel provides open source software that is free for use. This includes clamav, atop, cacti,

Here are step to add a common repository.

Centos 5

Step 1: install and enable epel repo
rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm


Centos 6

Step 1: install and enable epel repo
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm

Step 2: Enable priorities
yum install yum-priorities

Edit /etc/yum.repos.d/epel.repo
add under [epel]
priority=10


Friday, June 7, 2013

TinyMCE

One of the widely used WYSWIG for web forms is called TinyMCE. Currently it is at version 3.5.8 and version 4.0 is in Beta. Licensed as LGPL, it is available for download freely from tinymce.com website.

I like its highly configurable options. Some of these are listed at http://www.tinymce.com/wiki.php/TinyMCE3x:Buttons/controls

Here is how it looks like from the demo site.


Thursday, June 6, 2013

Backup selected rows from MyMSQL database

Just needed a few rows of data, after confirmed its existence with

> select count (*) from `attendances` where `meeting_id`=82;

Using mysqldump

mysqldump --opt -uroot -p development attendances --where='meeting_id'=19700 > outputrows.sql

Reviewed the extensive contents then inserted back into the db.