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.
Tags: increase, Linux server, Swap Space
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
Tags: Server time lagging too often
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.
You can verify the runkit extension by
root@host[/usr/local/src/runkit-0.9]# php -i | grep -i runkit
runkit
runkit support => enabled
Tags: enable, extension, runkit PHP
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.
Tags: community, SNMP, User
Turn on DMA mode on a hard drive
DMA
Direct memory access (DMA) allows certain hardware subsystems within the computer to access system memory for reading and/or writing independently of the central processing unit. It uses a procedure called cycle stealing, where the central processor memory access cycles are delayed for very short times to intersperse DMA controller memory access cycles. DMA is used for transferring data between the local memory and the main memory.
You can turn On DMA mode on a hard drive
You can check whether DMA is enabled on a hard drive for the IDE harddrive.
If DMA is on, the output should contain the following line,
If it is off you can enable it as follows,
This will toggle the value of “using_dma” (It will turn off the value of “using_dma” if it was already on).
Tags: DMA mode, hard drive