Menu Close

Category: Linux

How to disable mysql fulltext stopwords?

by nivas.hr
The stopword list is a list of most used words in english language. Common words such as “some”, “little”, “let” or “then” are stopwords and do not match if present in the search string.

Basically, fulltext searching for any of the stopwords would return (almost) all the entries, so MySQL ignores those words to reduce result pollution and for efficiency.

If the word starts with stopword, that word is returned, however if your word IS stopword, you are out of luck. Here is a list of build in stopwords in MySQL 5.0/5.1. Yeah, well this is so very exciting, but whole universe DOES NOT speak and write just english.

Rsync with SSH without prompting for password

by namhuy.net

Rsync is a free software computer program for Unix and Linux like systems which synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate.

** Always use rsync over ssh because rsync does not provide any security while transferring data.

rsync over ssh (with password)

rsync -avz ssh /home/user/ user@192.168.0.100:/backup/user/

To use a different ssh port, e.g., 123:

rsync -avz 'ssh -p 123' /home/user/ user@192.168.0.100:/backup/user/

The terminal will prompt for password before proceed.

To rsync without prompting for password, we can generate a ssh public key and add it to backup server’s ssh authorized keys. Below are the steps.

Email with Postfix, Dovecot and MySQL on Debian 6 (Squeeze)

by linode.com

The Postfix Mail Transfer Agent (MTA) is a high performance open source e-mail server system. This guide will help you get Postfix running on your Debian 6 (Squeeze) Linode, using Dovecot for IMAP/POP3 service and MySQL to store information on virtual domains and users. This guide is largely based on Christoph Haas’s great ISP-style Email Server with Debian-Lenny and Postfix 2.5 guide and HowtoForge Groupware Server With Group-Office, Postfix, Dovecot And SpamAssassin On Debian Lenny (5.0), with some packages omitted.

NOTE: Please read all of the information presented in this guide carefully. There are many files and commands that will need to be edited as part of the setup process: please do not simply copy and paste the example blocks.

Apache – Hide PHP Version (X-Powered-By)

by ducea.com

Applies: apache 1.3.x / apache 2.0.x Required apache module: mod-php4/mod-php5 Scope: php.ini Type: security

Description: How to hide the PHP version to remote requests. Useful: to not disclose un-needed information. As shown in Discover the web server software and version of a remote server anyone can find our valuable information from our apache server banner… This will show you how to suppress the PHP banner X-Powered-By.

find large files in ubuntu

This command find all files >400MB:

find /  -type f -size +400000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

And for exclude a folder from this command:

find / -not \( -path /mnt -prune \)  -type f -size +400000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

 

For see the free space you can do:

df -h

 

if you want to see  total size of a folder:

du -sk -h /home/

 

and for listing of all size:

du -h /home/

 

Type the following command at the shell prompt to find out top 10 largest file/directories:

# du -a /var | sort -n -r | head -n 10

Sample outputs:

1008372 /var
313236  /var/www
253964  /var/log
192544  /var/lib
152628  /var/spool
152508  /var/spool/squid
136524  /var/spool/squid/00
95736   /var/log/mrtg.log
74688   /var/log/squid
62544   /var/cache

If you want more human readable output try:

$ cd /path/to/some/where
$ du -hsx * | sort -rh | head -10

Where,

  • du command -h option : display sizes in human readable format (e.g., 1K, 234M, 2G).
  • du command -s option : show only a total for each argument (summary).
  • du command -x option : skip directories on different file systems.
  • sort command -r option : reverse the result of comparisons.
  • sort command -h option : compare human readable numbers. This is GNU sort specific option only.
  • head command -10 OR -n 10 option : show the first 10 lines.

Mount SATA DISK in Ubuntu VM ESXI5

Sometimes, we need to do things in different ways.

I’ve a new ESXI 5 Server, and i want to have a NAS virtual machine on it.

The problem is that ESXI doen’t not support direct access to SATA drives, and use virtual image disks for a NAS is not a good thing (very bad performance).

For bypass this problem, we use Raw Disk Mapping (RDM).

Optimize backup with IO e CPU priority

On my server, i need to backup my data and my databases about 2/3 times at day.

First, i compress folders with TAR, then i copy it with rsync to other servers in LAN.

Files are from 500MB to 2GB, so the transfer operation give my a heavy impact to server perfomance, with a Load from 5 to 7 (when the max should be 4 with my hardware) and sometime apache or mysql crash.

Clear Memory Cache on Linux Server

By default the Linux OS has a very efficient memory management process that should be freeing any cached memory on the machine that it is being run on. However when it comes to Cached memory the Linux OS may at times decide that the Cached memory is being used and is needed which can lead to memory related issues and ultimately rob your server of any potentially free memory. To combat this you can force the Linux OS to free up and stored Cached memory.