Friday, October 19, 2012
Thursday, October 18, 2012
Changing Time zone in OpenVz vps
Changing Time zone in CentOS server/ Cpanel/WHM Servers
Option :1
Option 2:
Editing the configuration Files
Option :1
Main >> Service Configuration >> PHP Configuration Editor [Date and Time] we can change
Changing the time in VPS via WHM Main >> Server Configuration >> Server Time,Option 2:
Editing the configuration Files
#cat /etc/sysconfig/clock
date.timezone="US/Chicago"
date.timezone="America/Chicago"
[~]# cat /etc/sysconfig/clock
ZONE="US/Central"
UTC=false
ARC=false
ZONE="US/Central"
UTC=false
ARC=false
Option 3:
# ls -la /etc/localtime
# cp /etc/localtime /etc/localtime.bkp
# cp /usr/share/zoneinfo/America/Chicago /etc/localtime
Or
# ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
And then update the time zone value in your php.ini file
date.timezone="America/Chicago"
Restart the apache and check your server time.
Option 3:
Sometimes if your server is vps then the above options will not be work , for that time you can do the following steps.
1. Directly set the time using the date command, You can get the right time from your other server.
date --set="2012-10-17 21:34 am"
and if it throws "step-systime operation not permitted" error please fix this issue from your Hardware Node.
# vzctl stop VEID
# vzctl set --capability sys_time:on --save
# vzctl set
# vzctl restart VEID
date --set="2012-10-17 21:34 am"
Another fix:
yum -y install ntp
Identify time zone from http://www.pool.ntp.org/
# vi /etc/ntp.conf
select a server.
eg: 0.centos.pool.ntp.org
# ntpdate servername
That is ntpdate clock.rethat.com
While doing the ntpupdate you may receive the following error: "step-systime operation not permitted"
Suggested Fix
# vzctl stopVEID
# vzctl set --capability sys_time:on --save
needs to be replaced by your container’s ID
After executing the command above, your container’s configuration file needs to be reloaded. Thus, use ‘vzctl‘ to restart it.
# vzctl restart
Identify time zone from http://www.pool.ntp.org/
# vi /etc/ntp.conf
select a server.
eg: 0.centos.pool.ntp.org
# ntpdate servername
That is ntpdate clock.rethat.com
While doing the ntpupdate you may receive the following error: "step-systime operation not permitted"
Suggested Fix
# vzctl stop
# vzctl set
After executing the command above, your container’s configuration file needs to be reloaded. Thus, use ‘vzctl‘ to restart it.
# vzctl restart
Saturday, October 13, 2012
scons running time error
Last time while installing flvtool++ i have encountered the following error.
[/usr/local/src/flvtool++]# scons
scons: Reading SConscript files ...
AMFData.h:270: error: 'dmap' was not declared in this scope
AMFData.h: In member function 'virtual std::string AMFArray::asString() const':
AMFData.h:273: error: 'dmap' was not declared in this scope
AMFData.h: In member function 'virtual void AMFArray::write(fout&) const':
AMFData.h:282: error: 'dmap' was not declared in this scope
AMFData.h:283: error: 'dmap' was not declared in this scope
AMFData.cpp: At global scope:
AMFData.cpp:10: error: expected constructor, destructor, or type conversion before '<' token
scons: *** [AMFData.o] Error 1
scons: building terminated because of errors.
Fix:
[/usr/local/src/flvtool++]# yum install wget boost-devel gcc gcc-c++
and then execute
[/usr/local/src/flvtool++]# scons
scons: Reading SConscript files ...
scons: warning: The env.TargetSignatures() method is deprecated;
convert your build to use the env.Decider() method instead.
File "/usr/local/src/flvtool++/SConstruct", line 3, in ?
scons: done reading SConscript files.
scons: Building targets ...
g++ -o AMFData.o -c -ggdb -O3 -Wall -I. -I/usr/local/include/boost-1_33_1 AMFData.cpp
g++ -o flvtool++.o -c -ggdb -O3 -Wall -I. -I/usr/local/include/boost-1_33_1 flvtool++.cpp
g++ -o flvtool++ -ggdb flvtool++.o AMFData.o
scons: done building targets.
[/usr/local/src/flvtool++]# scons
scons: Reading SConscript files ...
AMFData.h:270: error: 'dmap' was not declared in this scope
AMFData.h: In member function 'virtual std::string AMFArray::asString() const':
AMFData.h:273: error: 'dmap' was not declared in this scope
AMFData.h: In member function 'virtual void AMFArray::write(fout&) const':
AMFData.h:282: error: 'dmap' was not declared in this scope
AMFData.h:283: error: 'dmap' was not declared in this scope
AMFData.cpp: At global scope:
AMFData.cpp:10: error: expected constructor, destructor, or type conversion before '<' token
scons: *** [AMFData.o] Error 1
scons: building terminated because of errors.
Fix:
[/usr/local/src/flvtool++]# yum install wget boost-devel gcc gcc-c++
and then execute
[/usr/local/src/flvtool++]# scons
scons: Reading SConscript files ...
scons: warning: The env.TargetSignatures() method is deprecated;
convert your build to use the env.Decider() method instead.
File "/usr/local/src/flvtool++/SConstruct", line 3, in ?
scons: done reading SConscript files.
scons: Building targets ...
g++ -o AMFData.o -c -ggdb -O3 -Wall -I. -I/usr/local/include/boost-1_33_1 AMFData.cpp
g++ -o flvtool++.o -c -ggdb -O3 -Wall -I. -I/usr/local/include/boost-1_33_1 flvtool++.cpp
g++ -o flvtool++ -ggdb flvtool++.o AMFData.o
scons: done building targets.
Friday, October 12, 2012
Iptables rule delete
Sometimes you can not remove rules using your csf commands because the rules will be added as block wise.
root@ajeesh [~]# csf -g 172.16.9.55
Chain num pkts bytes target prot opt in out source destination
LOCALOUTPUT 9 183 11076 DROP all -- * !lo 0.0.0.0/0 172.16.0.0/16
LOCALINPUT 9 183 11076 DROP all -- * !lo 0.0.0.0/0 172.16.0.0/16
Like this case you can not remove a particular IP from from your server firewall using the commands
csf -tr ip and csf -dr IP
You can delete the IPs using iptables command,
Here should know what is the Ip chain number for your ipblock. From my side you can see my ip chain rule number is 9.
root@ajeesh [~]# iptables -L LOCALINPUT -n -v --line-numbers | grep 172.16.0.0/16
Using this command also you will get the IP chain number.
To delete this rule :
root@ajeesh [~]# iptables -D LOCALINPUT 9
root@ajeesh [~]# iptables -D LOCALOUTPUT 9
Wednesday, October 10, 2012
OpenVz kernel upgrade
Steps:
1. [root@openvz ~]# arch
x86_64
2. [root@openvz ~]# getconf LONG_BIT
64
3. cd /usr/local/src/
4. wget http://download.openvz.org/kernel/branches/rhel5-2.6.18/028stab101.1/ovzkernel-2.6.18-308.8.2.el5.028stab101.1.x86_64.rpm
5. rpm -ivh ovzkernel-2.6.18-308.8.2.el5.028stab101.1.x86_64.rpm
6. cat /etc/grub.conf
7. shutdown -f -r now
1. [root@openvz ~]# arch
x86_64
2. [root@openvz ~]# getconf LONG_BIT
64
3. cd /usr/local/src/
4. wget http://download.openvz.org/kernel/branches/rhel5-2.6.18/028stab101.1/ovzkernel-2.6.18-308.8.2.el5.028stab101.1.x86_64.rpm
5. rpm -ivh ovzkernel-2.6.18-308.8.2.el5.028stab101.1.x86_64.rpm
6. cat /etc/grub.conf
7. shutdown -f -r now
Sunday, October 7, 2012
Fatal error: Cannot redeclare date_diff()
This is normally your script is having some compatibility issues with php5.3. because i have seen this errors with scripts running in php 5.3 version.
Fatal error: Cannot redeclare date_diff() in /home/ajeesh/public_html/video/ajaxfunc.php
I have fixed these error with replacing "date_diff" function with zen_date_diff in the particular error showing path.
Tuesday, October 2, 2012
Enable sar iostat on your Linux server
It is very important to enable the monitoring tools like sar,iostat etc especial when you run your server as a virtual servers.
You can not install sar as "yum install sar" . So we need to know what is the package is for these utilities to installed.
If any of your server is enabled command called "sar" then you can trace which package is used for this utility.
[root@ajeesh ~]# yum whatprovides "/usr/bin/sar"
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* openvz-kernel-rhel5: mirror.fdcservers.net
* openvz-utils: mirror.fdcservers.net
sysstat-7.0.2-11.el5.x86_64 : The sar and iostat system monitoring commands.
Repo : base
Matched from:
Filename : /usr/bin/sar
sysstat-7.0.2-11.el5.x86_64 : The sar and iostat system monitoring commands.
Repo : installed
Matched from:
Other : Provides-match: /usr/bin/sar
OR
[root@ajeesh ~]# rpm -qf /usr/bin/sar
sysstat-7.0.2-11.el5
So we can install all these utilities using
[root@ajeesh ~]# yum install sysstat
Error:
[root@ajeesh ~]# sar
Cannot open /var/log/sa/sa01: No such file or directory
Solution:
cd /etc/init.d
chmod 755 sysstat
You can not install sar as "yum install sar" . So we need to know what is the package is for these utilities to installed.
If any of your server is enabled command called "sar" then you can trace which package is used for this utility.
[root@ajeesh ~]# yum whatprovides "/usr/bin/sar"
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* openvz-kernel-rhel5: mirror.fdcservers.net
* openvz-utils: mirror.fdcservers.net
sysstat-7.0.2-11.el5.x86_64 : The sar and iostat system monitoring commands.
Repo : base
Matched from:
Filename : /usr/bin/sar
sysstat-7.0.2-11.el5.x86_64 : The sar and iostat system monitoring commands.
Repo : installed
Matched from:
Other : Provides-match: /usr/bin/sar
OR
[root@ajeesh ~]# rpm -qf /usr/bin/sar
sysstat-7.0.2-11.el5
So we can install all these utilities using
[root@ajeesh ~]# yum install sysstat
Error:
[root@ajeesh ~]# sar
Cannot open /var/log/sa/sa01: No such file or directory
Solution:
cd /etc/init.d
chmod 755 sysstat
Subscribe to:
Posts (Atom)