Tuesday, August 9, 2011

Linux smallest partition


VM partition for non-heavy usage Standard 4GB storage
partition mount point filesystem size (MB) type
/dev/sda1 /boot ext3 100 primary
/dev/sda2 / ext3 2,000 primary
/dev/sda3 swap swap 300 primary
/dev/sda4 - - - extended
/dev/sda5 /homeext3 200 logical
/dev/hda6 /tmpext3 500 logical
/dev/hda7 /varext3 remaining logical


When doing yum update, the package was download to /var partition before proceed to installation part.
So make sure /var partition is enough for the yum update

Wednesday, July 27, 2011

log rotate

this is to add function to rotate specific log

create a new file at /etc/logroate.d/
and write this into it for rotate log function

/var/log/SAT-backup/*.log {
     monthly
     rotate 4
     missingok
     compress
}

Wednesday, July 20, 2011

Centos change resolution

you can change the console resolution at
/boot/grub/grub.conf

add vga=775 at the end of kernal line

Thursday, June 30, 2011

Centos - basic knowledge

change DNS setting
/etc/resolve.conf

change host IP
/etc/sysconfig/network-script/ifcfg-eth0

change hostname
/etc/sysconfig/network

The easiest way to do it is
# system-config-network

Monday, June 6, 2011

Adding Swap Space

To add a swap file:
  1. Determine the size of the new swap file in megabytes and multiply by 1024 to determine the number of blocks. For example, the block size of a 64 MB swap file is 65536.
  2. At a shell prompt as root, type the following command with count being equal to the desired block size:
    dd if=/dev/zero of=/swapfile bs=1024 count=65536
  3. Setup the swap file with the command:
    mkswap /swapfile
  4. To enable the swap file immediately but not automatically at boot time:
    swapon /swapfile
  5. To enable it at boot time, edit /etc/fstab to include the following entry:
    /swapfile          swap            swap    defaults        0 0
    The next time the system boots, it enables the new swap file.
  6. After adding the new swap file and enabling it, verify it is enabled by viewing the output of the command cat /proc/swaps or free.
To remove the swap file:
  1. First must stop the swap file created by:
    swapoff  /swapfile
  2. Then delete the:
    rm -rf   /swapfile

    Monday, April 18, 2011

    Zend Optimizer

    Zend Optimizer

    • To install Zend Optimizer, it's best is to download from http://www.zend.com/en/products/guard/downloads . Be aware you will need to register an account to be able to download it. After a few browsing and searching, get this ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz OR ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
    • Extract it :
    tar -zxvf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
    • Then copy it to php modules folder:
    cp ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp/ZendOptimizer.so /usr/lib/php/modules/ 
    (if that is 32bit machine)
    • Create a file /etc/php.d/zend.ini, put this in:
    zend_extension=/usr/lib/php/modules/ZendOptimizer.so
    • Restart apache
    /etc/init.d/httpd restart
    • Now it should work. Try doing a
    php -i |grep -i zend
    to get the following result. This mean Zend is running
    /etc/php.d/zend.ini,
    Zend Extension => 220060519
    Zend Memory Manager => enabled
    This program makes use of the Zend Scripting Language Engine:
    Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
        with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies
    report_zend_debug => Off => Off
    zend.ze1_compatibility_mode => Off => Off
    Zend Optimizer
    Zend Loader => enabled
    • To test a encoded file, download ZendGuard from http://www.zend.com/en/products/guard/downloads , the latest is ZendGuard 5.5 which support php5.3, but it still could be used to encode php5.2. Just remember while encoded, choose php 5.2, since the ZendOptimzer we just installed only support until php5.2 (as at 2011-01-18)
    • Create a simple php script by putting
    <?php echo 'this is encoded file' ?>
    and encode it. It should be a binary if success encoded. Upload that file into the webserver and test whether you can get the exact output.

    Monday, April 11, 2011

    transfer log from remote machine

    vi /etc/sysconfig/syslog

    change SYSLOGD_OPTION="-m 0"
    to
    SYSLOGD_OPTION="-m 0 -r"

    then restart the syslog services

    vi /etc/syslog.conf

    instead of write the folder location
    change it to @172.30.10.10