Archive for the 'Linux Support' Category

SBDavid

Splitting a file in GNU/Linux

Splitting a file in GNU/Linux

If you want to split a file “myvideo” with size 9.6 Mb( 10000000 b) into two, then the command to do the same is:

$ split -b 5000000 myvideo

File “myvideo” is now split into two files “xaa” and “xab” by default and these two files will be having the size 5000000 b. Reducing file size will lead to more number of new files generated. You can also specify the output filename. Suppose you want to use output file name as “video”, then the following command will help you:

$ split -b 5000000 example myvideo

Now how to join the splitted files? You can use the cat command to join the splitted files. For example if the new files generated by split are “xaa”, “xab” and “xac”, use the following command to join the splitted files.

$ cat xa* > filename

How to increase swap space in a Linux server?

It has been a common issue that in most of the cases the RAM gets upgraded after the server is live. For maximum utilization of the resources, it is recommended to create swap space of twice the amount of RAM. Hence if a RAM of 1GB is present in the server 2GB of swap space should be present. In order to create a swap space of 1GB.

dd if=/dev/zero of=/swapfile1 bs=1024 count=1048576
/sbin/mkswap -c -v1 /swapfile1
/sbin/swapon /swapfile1

Add the entry to /etc/fstab to automate it after a Reboot. Edit /etc/fstab and add the entry below.

/swapfile1 swap swap defaults 0 0

A new swap file can be created with new name replace the filename “swapfile1″ with a new one and follow the same procedure. The above commands are used to create 1GB swap. If the amount of RAM in the server is 2GB, then a swap file of 4GB is required.
The easiest way to create this swap file is to created four swap files of 1GB each.

SBDavid

Server time lagging too often

Server time lagging too often

Some times , the server time will be either slow or fast. This kind of clock issues can “usually” be fixed with the following steps:

1. Correct the server time

2. Edit /etc/grub.conf. The parameter to be added varies with processor as shown below.

Case a) Pentium D processor - add “notsc” into the kernel line in grub.conf

Case b) AMD processor - add “clock=pmtmr” into the kernel line in grub.conf

3. Reboot the server

SBDavid

How to enable runkit PHP extension

How to enable runkit PHP extension

Installing runkit PHP extension.

#cd /usr/local/src
#wget http://pecl.php.net/get/runkit-0.9.tgz
#tar -zxvf runkit-0.9.tgz
#cd runkit-0.9
#phpize
#./configure
#make

After running the make command you will get the following error.

/usr/local/src/runkit-0.9/runkit_import.c: In function ‘php_runkit_import_class_props’:
/usr/local/src/runkit-0.9/runkit_import.c:230: warning: passing argument 2 of
‘zend_unmangle_property_name’ makes integer from pointer without a cast
/usr/local/src/runkit-0.9/runkit_import.c:230: error: too few arguments to function
‘zend_unmangle_property_name’ make: *** [runkit_import.lo] Error 1

Fix is as follows

Edit the file /usr/local/src/runkit-0.9/runkit_import.c and change the following line
zend_unmangle_property_name(key, &cname, &pname);

To:

zend_unmangle_property_name(key, key_len, &cname, &pname);

Again continue with the installation steps.

#cd /usr/local/src/runkit-0.9
#make
#make install

Edit the loaded PHP configuration file ( here /usr/local/lib/php.ini ) and add the following line.

extension=runkit.so

You can verify the runkit extension by

root@host[/usr/local/src/runkit-0.9]# php -i | grep -i runkit
runkit
runkit support => enabled
SBDavid

SNMP community user

SNMP community user

We know that any monitoring tool (like Nagios , Mrtg etc ) installation needs SNMP to be configured.

In case you find any queries related to “snmp community user”, you can follow the steps below:

Command to use SNMP community user:

net-snmp-config –create-snmpv3-user -ro -a MD5 -A PASSWORD USERNAME

Example:

If I want to create a SNMP community user “admin” with password “tree321″,
then the command will be:

net-snmp-config –create-snmpv3-user -ro -a MD5 -A admin tree321

Note:

Encrypted password of SNMP community user will be stored
in /var/net-snmp/snmpd.conf.

Config file for SNMP : /etc/snmp/snmp.conf

In case you can’t find the command “net-snmp-config”, don’t get panic:)

Just install net-snmp-devel using yum or up2date.

« Prev - Next »