Tuesday, September 27, 2011

Error: httpd is disabled via /etc/apachedisable please re-enable to continue

Advertisements

You may get this error while running the script easyapache

!! 'httpd' is disabled via '/etc/apachedisable', please re-enable to continue. !!

Solution:
Enable httpd in Service Manager

Steps:
Login to WHM

Main >> Service Configuration >> Service Manager
Check the boxes for httpd
Save it [bottom in page]
Now try again.

See the following images if confused.

Main >> Service Configuration >> Service Manager


Check the boxes for httpd


After checking

Now run easypache again

Monday, September 26, 2011

date: cannot set date: Operation not permitted openvz

Advertisements

This post explains how to solve the following error while setting the time in a openvz container vps.

Error:
date: cannot set date: Operation not permitted

Reason:
Capability not set for the vps

Soultion:

On Openvz node:

Stop the vps
[root@test ~]# vzctl stop 9851

set the parameter

[root@test ~]# vzctl set 9851 --save --capability sys_time:on
Saved parameters for CT 9851

Start the vps
[root@test ~]# vzctl start 9851

Enter into the vps
[root@test8 ~]# vzctl enter 9851
entered into CT 9851
[root@abc /]#

check date
[root@abc /]# date
Fri Sep 16 00:39:09 CST 2011

Change date
[root@abc /]# date -s "Tue Sep 27 00:39:09 CST 2011"
Tue Sep 27 00:39:09 CST 2011

check date again
[root@abc /]# date
Tue Sep 27 00:39:19 CST 2011

Thats it. Date has been changed. 



Recommended Reading

1. Practical Guide to Linux Commands, Editors, and Shell Programming, A (2nd Edition)
2. UNIX and Linux System Administration Handbook (4th Edition)
3. Linux All-in-One For Dummies
4. Introduction to the Command Line (Second Edition): The Fat Free Guide to Unix and Linux Commands

Tuesday, September 20, 2011

Error: Device (vbd) could not be connected /etc/xen/scripts/block failed error detected

Advertisements

You may get this error while starting a xen vps


[root@test ~]# xm create /home/xen/vm854/vm854.cfg
Using config file "/home/xen/vm854/vm854.cfg".
Error: Device 5632 (vbd) could not be connected. /etc/xen/scripts/block failed; error detected.

Check the hotplug log

[root@test ~]# tail /var/log/xen/xen-hotplug.log
xenstore-read: couldn't read path backend/vbd/176/5632/node
Nothing to flush.
losetup: could not find any free loop device
xenstore-read: couldn't read path backend/vbd/177/5632/node
Nothing to flush.
losetup: could not find any free loop device
xenstore-read: couldn't read path backend/vbd/178/5632/node
losetup: could not find any free loop device
Nothing to flush.
xenstore-read: couldn't read path backend/vbd/179/5632/node

See the reason
losetup: could not find any free loop device


it says there is no free loop back devices. Your vps might be at present mounted with a cd-rom. but as there is no free loop device it cant mount it and start vps. Unmount the cdrom and start the vps again. It will work.

Monday, September 19, 2011

changing the RAM of Domain-0 in xen

Advertisements

This post explains how to set or change Domain-0 RAM allocation. This is a dynamic method so I'm not sure it will survive reboot.

Current usage

[root@test ~]# xm list
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0    19002     8 r----- 331242.1
vm649                                     27     1007     2 r-----  81706.6
vm652                                     20     2007     2 -b---- 156137.8
vm770                                     26     2007     2 r----- 230305.3

Now setting the Domain-0 RAM to 4GB

[root@test ~]# xm mem-set 0 4096

After changing the RAM of Domain-0

[root@test ~]# xm list
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0     4096     8 r----- 331416.8
vm649                                     27     1007     2 r-----  82261.6
vm652                                     20     2007     2 -b---- 156240.8
vm770                                     26     2007     2 r----- 230515.7
[root@test ~]#

There is also another method which edits grub.conf
#vi /etc/grub.conf

title CentOS (2.6.18-238.19.1.el5xen)
        root (hd0,0)
        kernel /boot/xen.gz-2.6.18-238.19.1.el5 dom0_mem=4096
        module /boot/vmlinuz-2.6.18-238.19.1.el5xen ro root=LABEL=/ rhgb quiet
        module /boot/initrd-2.6.18-238.19.1.el5xen.img
It needs rebooting the system

clearing arp cache in linux

Advertisements

Address Resolution Protocol (also known as ARP) is one of the effective ways for searching the address of a host’s hardware(Ethernet). Sometimes wrong arp cache will make problems. You can clear all arp cache using following commands.

how to see current arp cache
root@cpaneltest [~]# arp -n
Address HWtype HWaddress Flags Mask Iface
192.168.1.1 ether 00:25:5E:1F:7A:BE C eth0
192.168.1.2 ether 6C:F0:49:C5:BF:6A C eth0
192.168.1.4 ether 6C:F0:49:C5:BF:26 C eth0
root@cpaneltest [~]#

Clearing arp cache with verbose
root@cpaneltest [~]# ip -s -s neigh flush all
192.168.1.1 dev eth0 lladdr 00:25:5e:1f:7a:be ref 17 used 28/27/81 REACHABLE
192.168.1.2 dev eth0 lladdr 6c:f0:49:c5:bf:6a ref 2 used 64/64/20 STALE
192.168.1.4 dev eth0 lladdr 6c:f0:49:c5:bf:26 ref 4 used 92/3/0 REACHABLE

*** Round 1, deleting 3 entries ***
*** Flush is complete after 1 round ***

current entries
root@cpaneltest [~]# arp -n
Address HWtype HWaddress Flags Mask Iface
192.168.1.1 (incomplete) eth0
192.168.1.2 (incomplete) eth0
192.168.1.4 ether 6C:F0:49:C5:BF:26 C eth0
root@cpaneltest [~]#

You can also delete particular arp entries using following command
root@cpaneltest [~]# arp -d 192.168.1.1
root@cpaneltest [~]# arp -d 192.168.1.2

Adding a static arp entry
root@cpaneltest [~]# arp -s 192.168.1.10 00:00:93:12:04:57

This will answer ARP requests for 10.0.0.2 on eth0 with the MAC address for eth1.
 #arp -i eth0 -Ds 10.0.0.2 eth1 pub

Delete the ARP table entry for 10.0.0.1 on interface eth1. This will match published proxy ARP entries and permanent entries.
#arp -i eth1 -d 10.0.0.1


Recommended Reading

1. Practical Guide to Linux Commands, Editors, and Shell Programming, A (2nd Edition)
2. Understanding the Linux Virtual Memory Manager
3. UNIX and Linux System Administration Handbook (4th Edition)

Thursday, September 15, 2011

How to disable mod_security using .htaccess

Advertisements

This post explains how to disable mod_security using .htaccess for one domain. You may have problem with mod_security if you are using certain plugins, XMLRPC, wordpress, etc.


Go to your public_html directory of the desired domain and in .htaccess file add the following lines.


#vi .htaccess


<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>


Thats it. Now mod_security is disabled.

Wednesday, September 14, 2011

How to enable passive ftp in vsftpd

Advertisements

This post explains how to configure or enable passive ftp in vsftpd and open the ports in csf firewall. This is configuring in centos linux. It will also work in other linux distors.

# vi /etc/vsftpd/vsftpd.conf

##Add the following lines

pasv_enable=YES
pasv_promiscuous=NO
port_enable=YES
port_promiscuous=NO
pasv_max_port=65534
pasv_min_port=49152

Save the file.

Tuesday, September 13, 2011

route add command in linux

Advertisements

You can add a routing rule in a linux system as follows. It will work all linux systems including redhat, centos, ubuntu and debian

Syntax
route add -net network_id netmask subnet_mask gw gateway_ip dev device_name

root@cpaneltest [~]# route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.10 dev eth0

Checking the rule
root@cpaneltest [~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.51    0.0.0.0         255.255.255.255 UH    0      0        0 eth0
192.168.1.52    0.0.0.0         255.255.255.255 UH    0      0        0 eth0
192.168.1.0     192.168.1.10    255.255.255.0   UG    0    0    0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

You can delete the above rule as follows
root@cpaneltest [~]# route del -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.10 dev eth0

Checking again
root@cpaneltest [~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.51    0.0.0.0         255.255.255.255 UH    0      0        0 eth0
192.168.1.52    0.0.0.0         255.255.255.255 UH    0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
root@cpaneltest [~]#

Wednesday, September 7, 2011

nameserver ips showing old ips in cpanel

Advertisements

Even after changing the nameserver ips, the nameserver ips in WHM may show old ips. This post explains how to change the nameserver ip addresses in a cpanel server.
You can change this as follows:

First edit the /etc/nameserverips

root@test[~]# cat /etc/nameserverips
IP_address1=ns1.domain.tld
IP_address2=ns2.domain.tld
root@test[~]#

Now edit /var/cpanel/nameserverips.yaml

root@test[~]# cat /var/cpanel/nameserverips.yaml
---
ns1.domain.tld:
  IP_address1: 1
  count: '3'
  zones: ns1.domain.tld,domain.tld,ns2.domain.tld
ns2.domain.tld:
  IP_address2: 1
  count: '3'
  zones: ns1.domain.tld,domain.tld,ns2.domain.tld
root@test[~]#

Names of zones files can be found in /etc/named.conf
Now restart the cpanel
root@test[~]# /etc/init.d/cpanel restart

Thats it. It should effect the changes on WHM

Resetting kloxo password

Advertisements

In case if you forgot your kloxo admin password, you have to reset the password for login again. This post explains how to reset the password for admin for kloxo lxadmin control panel.

#cd /usr/local/lxlabs/kloxo/httpdocs
#/usr/bin/lphp.exe ../bin/common/resetpassword.php master PASSWORD

Thats it. Now the admin password is changed to PASSWORD

Tuesday, September 6, 2011

vzctl start Container already locked

Advertisements

While starting the openvz container you may get an error like this
Error:
Container already locked

You wont be able to start, restart or stop the container. It is because the container is locked.

Solution:
Delete the /vz/lock/VEID.lck file (where VEID is the number of your VPS).
vzctl chkpnt VEID --kill

Now start the vps.
vzctl start VEID

hypervm adding ip to /etc/hosts.deny

Advertisements

You may get this error while sshing to a ip
ssh_exchange_identification: Connection closed by remote host

It could be because of many reasons. One of them is hypervm adding the ips to /etc/hosts.deny file.
It will add the ip again if you remove it from /etc/hosts.deny.

The solution is after removing the ip, run this command

chattr +i /etc/hosts.deny

Sunday, September 4, 2011

jail environment using vsftpd

Advertisements

This post explains how to limit users to only their home directory in vsftpd ftp demon so that the users will be in a jail environment and he can not change to other directories.

Open the vstpd configuration file
vi /etc/vsftpd/vsftpd.conf

Add the following variable

chroot_local_user=YES

Restart the vsftpd service
/etc/init.d/vsftpd restart

Now on wards when the user logs in via ftp he gets into his home directory. But he cannot change the directory out of it. This is known as jailed environment. 

Backing up and restoring mysql databases

Advertisements

Tacking the back up of a database
mysqldump  -u username -ppassword  database_name > database_name.sql
For example
mysqldump  -u root -pabc123 horde > horde.sql

Restoring the database
mysql database_name < database_name.sql
For example
mysql horde < horde.sql

Restart the mysql
/etc/init.d/mysqld restart

Saturday, September 3, 2011

/usr/bin/ld: cannot find -lglut

Advertisements


Error:
/usr/bin/ld: cannot find -lglut
collect2: ld returned 1 exit status
make: *** [etr] Error 1

Solution:
apt-get install freeglut3-dev

Listing installed packages in ubuntu and centos

Advertisements


You can list installed packages in ubuntu or debian system using following command
#dpkg --get-selections

You can search whether a package is available or not using
#apt-cache search package_name

You can list installed packages in centos or redhat based system using following command
#yum list installed

All the files installed and available
#yum list all
#yum list package_name

Segmentation faultsts... 0% in ubuntu

Advertisements

You may get this error while using apt-get or aptitude


root@test# apt-get  install libogg
Segmentation faultsts... 0%

Reason:
Files got corrupted in /var/cache/apt

solution:
#rm /var/cache/apt/*.bin

Then update aptitude
#aptitude update

If you are using apt-get
#apt-get update

Sometimes you may need a reboot.

Installing phpmyadmin on ubuntu

Advertisements

This post explains how to install and configure phpmyadmin on ubuntu or debian systems.

Install phpmyadmin using apt-get
#apt-get install phpmyadmin

Copy the phpmyadmin apache configuration file to /etc/apache2/conf.d/
#cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/
Or
You can include the configuration file in apache2.conf by adding this line to it
Include /etc/phpmyadmin/apache.conf

No restart apache
#/etc/init.d/apache2 restart

Sometimes you may have to add a blowfish secret to accept cookies.
#vi /var/lib/phpmyadmin/blowfish_secret.inc.php
$cfg['blowfish_secret'] = 'a8b7dafdferHJHJ^&U^45776TIUuiYc6d';

error: 'PIX_FMT_RGBA32' undeclared

Advertisements

You may get this error while installing ffmpeg.
The solution is
#vi /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c
and

:%s/PIX_FMT_RGBA32/PIX_FMT_RGB32
The thing is you have to replace
 “PIX_FMT_RGBA32″ by  “PIX_FMT_RGB32″ in the file ffmpeg_frame.c
save the file and you can proceed with installation.