Wednesday, March 31, 2010

DNS forwarding

for a in `grep /etc/trueuserowners | cut -d ':' -f1`; do for b in `grep $a /etc/userdomains | cut -d":" -f1`; do replace "66.7.213.144" "66.7.219.239" -- /var/named/$b.db ; done ; done;

Friday, March 26, 2010

Installing 3rd party s/w

Click Be

============

mkdir -p /var/netenberg/click_be/installer/

cd /var/netenberg/click_be/

wget http://www.netenberg.com/files/click_be/free/click_be_installer.bz2

tar -xjpf click_be_installer.bz2

cd /var/netenberg/click_be/installer/

php click_be.php status

php click_be.php install

open_basedir =off
===============================


Rvskin
=========
mkdir /root/rvadmin
cd /root/rvadmin
wget http://member.rvskin.com/auto_rvskin.tgz
tar -xvzf auto_rvskin.tgz
perl auto_rvskin.pl

uninstall
-------
perl uninstall /scripts/killacct rvadmin
-----------------------
=====================

CSF
--------

/etc/csf

wget http://www.configserver.com/free/csf.tgz
tar -xvzf csf.tgz
sh install.sh

in csf.conf change TESTING = "0"

csf --update
---------


SVN
=========
use ful links
http://www.tonyspencer.com/2007/03/02/setup-a-subversion-server-in-4-minutes/

http://articles.slicehost.com/2007/9/5/introduction-to-svnserve


Setup a Subversion Server in 4 Minutes Code, Linux March 2nd, 2007
You are going to need to type fast but I think you can do it in 4 minutes.  These are my notes on what worked for me on my Fedora core 6 with svn lib already installed by the package manager:

1. Create a Repository
svnadmin create /svnrepos

2. Create a SVN User
vi /svnrepos/conf/svnserve.conf
In that file add these three lines:
anon-access = none
auth-access = write
password-db = passwd
Create a password file:
vi /svnrepos/conf/passwd
In that file add a line for your user:
# add users in the format : user = password
tony = mypassword
3. Import Your Project
(assuming you’ve put your project files in /projects/myrailsproject)
svn import /projects/myrailsproject file:///svnrepos/myrailsproject
4. Start the SVN Server as Daemon
svnserve -d
Done! You should now have a svn server running with one project named myrailsproject.
Try checking it out of the repository:
svn co svn://192.168.0.2/svnrepos/myyrailsproject
Since we set anon-access to none you should be prompted for username and password which you created in the file /svnrepos/conf/passwd.

How do I unzip a file in different format

If a file ends in .zip (for example, file.zip) type:
unzip file.zip

If a file ends in .tar (e.g., file.tar) type:
tar -xvf file.tar

If a file ends in .gz (for example, file.gz) type:
gzip -d file.gz

If a file ends in .tar.gz (e.g. file.tar.gz) type:
gzip -d file.tar.gz
and then
tar -xvf file.tar

If a file ends in .tgz (e.g. file.tgz) type:
tar -xvzf file.tgz

PGSQL

su postgres

$pg_dump databasename > achefeli_achefeliciano.sql

drop database achefeli_achefeliciano;

CREATE DATABASE achefeli_achefeliciano ENCODING 'LATIN1' TEMPLATE template0;

psql -d achefeli_achefeliciano -f achefeli_achefeliciano.sql

http://www.postgresql.org/docs/7.4/interactive/app-psql.html

Mysql

Repairing tables
=============

mysqlcheck --all-databases --auto-repair --> it repair all tables

myisamchk -crS /var/lib/mysql/mazad_almazad/*.MYI ---> for misam tables

mysqlcheck -r straysh_/*.frm ---> inodb
=================

Dump database
=======
mysqldump "database_name" > "database_name.sql" like this

root@server [~]# mysqldump indiaond_mmi > indiaond_mmi.sql

Drop
====
mysqladmin drop "database_name" like

mysqladmin drop indiaond_mmi

Create
=======
mysqladmin create "database_name" like

mysqladmin creat indiaond_mmi

Restore
====
mysql "database_name" < "dump path" like

mysql indiaond_mmi < /home/indiaond/indiaond/mysql/indiaond_mmi.sql

Mysql privileges
-------------
Enter in to mysql console

grant all privileges on database_name.* to 'database_username'@'localhost' identified by 'database_password';


mysql> grant all privileges on saudican_monpl2.* to 'saudican_monpl2'@'localhost' identified by 'monpl2';
=======================

The server is not responding (or the local MySQL server's socket is not correctly configured)
-------------------

. You just have to go into the config.inc.php file and change:
$cfg['Servers'][$i]['host'] = 'localhost';

to this

$cfg['Servers'][$i]['host'] = '127.0.0.1';

then save
and re-run [(your directory path]/phpmyadmin/index.php in your browser.
Damned annoying. But I am glad I found the fix now
----------------------------------


Change password through backend
------------------

mysql> select * from agb_book_auth;
+----+----------+-------------------------------------------+----------------------------------+------------+
| ID | username | password | session | last_visit |
+----+----------+-------------------------------------------+----------------------------------+------------+
| 1 | universo | *7ACE763ED393514FE0C162B93996ECD195FFC4F5 | a052734944b5f972db30c2a8f09c3e8d | 1241038315 |
+----+----------+-------------------------------------------+----------------------------------+------------+
1 row in set (0.00 sec)

mysql> update agb_book_auth set password=password('2003love') where username='universo';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from agb_book_auth;
+----+----------+-------------------------------------------+----------------------------------+------------+
| ID | username | password | session | last_visit |
+----+----------+-------------------------------------------+----------------------------------+------------+
| 1 | universo | *EE3B755DE94AD4D46D03BE2E1B6435D3EBA8970A | 712102efbd65e82fa0d789476a6a9382 | 1243574039 |
+----+----------+-------------------------------------------+----------------------------------+------------+
1 row in set (0.00 sec)
-----------------------------------



My.cnf normal standerds
-------
set-variable = max_connections=300
set-variable = max_user_connections=50
set-variable = interactive_timeout=100
set-variable = wait_timeout=100
set-variable = connect_timeout=100
safe-show-database
key_buffer = 384M
max_allowed_packet = 16M
table_cache = 1500
sort_buffer_size = 2M
read_buffer_size = 2M
myisam_sort_buffer_size = 64M
thread_cache = 8
query_cache_size = 32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
old-passwords = 1
----------------

Quota issues

Common scripts
==========
/scripts/resetquotas
/scripts/initquotas

main configuration file: vi /etc/quota.conf


quota -v "username" : will display quotas on filesystems where no storage is allocated.
quota -s "username" : option will make quota(1) try to choose units for showing limits, used space and used inodes.


Example Steps for /home partition:

1. First check whether quota is enabled for /home partition.

# vi /etc/fstab

LABEL=/home /home ext3 defaults,usrquota 1 2

2. Remount the /home partition

# mount -o remount /home

3. Create a file called aquota.user for which we need to run quotacheck.

# quotacheck -c /home

4. Enable quota

# quotaon /home

This will enable quota on /home. Now you can edit the quota of a user using.

# edquota

5) Run /scripts/fixquotas this will solve the quota issue of cpanel accounts.

# /scripts/fixquotas

6) After this `repquota -a` should print out the soft/hard limits with grace periods for all users. If quotas are still not reporting anything in WHM and/or CPanel, check

# repquota -a

7) /var/cpanel/cpanel.config for disablequotacache=0

If that is set to 0, try setting it to 1 and see if that fixes it.

# vi /var/cpanel/cpanel.config ; /scripts/fixquotas

8) If a user’s quota shows more space being used than is in their home directory chances are there are stray files on the system owned by their UID. To find these files, run the following as root:

# find -user username > /tmp/username.txt

Disk usage problem

Using find command you can locate the files owned by the user

find "path" -user "username" like this "find /home/.cpan/build -user" and change the unwanted ownership to root.

Eaccelerator cache fill /tmp daily "find . -name 'sess*' | xargs rm"

also disable Eaccelerator in php.ini or change the path

Cpanel Issues

How do I fix the error "License File Expired"?
---------------------
/usr/local/cpanel/cpkeyclt

http://twiki.cpanel.net/twiki/bin/view/AllDocumentation/All/WHMsFAQ#How_do_I_fix_the_error_License_F
---------------

Bandwidth day and year not showing
-----------
/scripts/rrdtoolinstall --force
---------

ClamAV
------
You can install clamav antivirus which is open source and do a clamav scan to make sure that the website is not affected. On a cPanel server, the below command will scan the entire website files of each users.

clamscan -i -r –remove /home/*/public_html/

http://solidservers.ca/2009/06/how-to-install-clamav-in-cpanel/
http://www.supportsages.com/blog/2009/04/how-to-do-virus-scan-on-linux-servers/

delete folders in /var/ and /var/run install it through WHM then do command " freshclam".

==============================

Fantastico

Install Fantastico
=====================

For 32-bit:

Code: rpm -qa wget ;
uname -a
wget ftp://ftp.funet.fi/pub/mirrors/ftp.redhat.com/pub/fedora/linux/core/5/i386/os/Fedora/RPMS/wget-1.10.2-3.2.1.i386.rpm

chattr -ia /usr/bin/wget
rpm -e wget
rpm -ivh --force wget-1.10.2-3.2.1.i386.rpm

For 64-bit:

Code: rpm -qa wget
wget http://download.fedora.redhat.com/pub/fedora/linux/releases/7/Everything/x86_64/os/Fedora/wget-1.10.2-15.fc7.x86_64.rpm
or
ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/releases/7/Fedora/x86_64/os/Fedora/wget-1.10.2-15.fc7.x86_64.rpm

chattr -ia /usr/bin/wget
rpm -e wget
rpm -ivh --force wget-1.10.2-15.fc7.x86_64.rpm

This for both 64 bit and 32 bit

Code: cd /usr/local/cpanel/whostmgr/docroot/cgi
wget -N http://files.betaservant.com/files/free/fantastico_whm_admin.tgz
tar -xvzf fantastico_whm_admin.tgz
rm -rf fantastico_whm_admin.tgz

also ione cube loader is enable in whm and try install fantastico through whm.

======================================

The ICON for Fantastico DOES NOT APPEAR in cPanel
---------------------------

The ICON for Fantastico DOES NOT APPEAR in cPanel « on: March 23, 2008, 03:33:39 AM » First, make sure you are using a theme that supports third-party addons like Fantastico. Some older themes and themes like x3mail do not support Fantastico.

You will need to check all of the following three things as any/all of these things may be the problem.

1) Make sure Fantastico is enabled, both in WHM's Feature Sets and that it is enabled in the WHM Fantastico admin settings.

2) Make sure you have a symlink to the Fantastico directory in every theme you use. For example if you use the "x3" theme:

Code: ln -s /usr/local/cpanel/3rdparty/fantastico /usr/local/cpanel/base/frontend/x3
3) If you use the X3 theme, make sure your icon cache is up-to-date:

Code: /usr/local/cpanel/bin/rebuild_sprites --force
If you get the following error after running rebuild_sprites:

Can't locate object method "newFromJpeg" via package "GD::Image" at /usr/local/cpanel/bin/rebuild_sprites line 17.

then you will need to install the Perl GD module first:

Code: /scripts/realperlinstaller --force GD or /scripts/installgd
After that, try rerunning the rebuild_sprites command above.

Please note that cPanel Inc. has discontinued support for the "x" and "x2" themes as of the release of cPanel v11. Although Fantastico does work in those themes we encourage you to switch to "x3" or another supported theme to ensure your users have the best experience possible.
----------------------------


Fantasitico shows ioncube error
===================

check php.ini in /usr/local/lib/php.ini

or php -v/

if its not present install /scripts/phpextensionmgr install IonCubeLoader

or ionecube present enable in tweak setting.

Cpanel shows error in fantastico : /scripts/makecpphp

http://www.netenberg.com/forum/index.php?topic=6902.0
http://www.netenberg.com/forum/index.php?topic=6795.0
=======================

FTP ISSUES

Access ftp
-------
ftp ip address

put - enter item into the account
get -

Common scripts
=========
/scripts/ftpupdate
/scripts/ftpup
==========

error log
----------
tail -f /etc/pure-ftpd/pure-ftpd.conf
-------


Also you can set ftp configuration through WHM.

WEBMAIL ISSUES

Fix Various Mail Permission
========
: /scripts/mailperm
=========


Sending message fails
============
This problem usually occurs when CSF ( Config Server Firewall ) is installed on your server and it is interacting with the working of squirrel mail. So while configuring CSF enable both SMTP_BLOCK & SMTP_ALLOWLOCAL . Enabling just SMTP_BLOCK can cause this issue.

$ vi /etc/csf/csf.conf
set
SMTP_BLOCK = '0'
save and exit

restart csf.


This will fix.
=================


To convert courier to dovecot please use the following two steps,
==========
# /scripts/setupmailserver --force dovecot
# /scripts/convert2dovecot
=========


Update webmails
-----------------
/usr/local/cpanel/bin/update-roundcube --force
/usr/local/cpanel/bin/update-squirrelmail --force
/usr/local/cpanel/bin/update-horde --force
--------------------

Squirrelmail not sending emails
================
vi /usr/local/cpanel/base/3rdparty/squirrelmail/config/config.php
just changed:
$useSendmail = false;

to:
$useSendmail = true;
==============


HORDE LOGIN PROBLEMS
================
Reset Horde is a solution

/scripts/resethorde
Or
/scripts/fullhordereset ———-Don’t do it until you find another solution. :)
?HORDE LOGIN PROBLEM

Hope you would have got this issue often. The client cannot able to login to his Horde account to check his mail. He would have reached till the login screen and if he click “Login” it will stay back in the same screen instead of going to his inbox. Here is the fix for it,

Check the following first,

1. goto ” cd var/lib/mysql/horde ” and check if there is a file named ” horde_sessionhandler.frm “

2. move all the file named “horde_sessionhandler” with other name

3. Or you can goto mysql and can drop the table “horde_sessionhandler”. It will show error message some times. If so use the step 2, so that the table gets moved automatically.(Remember that if you are using step2 skip the step 3)

4. Now type in shell “mysql”

5. It will take to mysql prompt . type “use horde”;

6. copy this command and paste there :

CREATE TABLE horde_sessionhandler (session_id VARCHAR(32) NOT NULL, session_lastmodified INT NOT NULL, session_data LONGBLOB, PRIMARY KEY (session_id)) ENGINE = InnoDB;

7. quit from mysql and restart mysql.

8. Try now… Your issue is fixed!!!!!
==================================================



Change current exim configuration
--------------

/scripts/exim_tidydb
---------------

EXIM COMMANDS

The foolowing exim_cheatsheet link help you to learn more.

http://bradthemad.org/tech/notes/exim_cheatsheet.php

Remove frozen message from the queue: exiqgrep -z -i | xargs exim -Mrm

Start exim queue: exim -q -v
EXIM

Exim is a message transfer agent (MTA) developed at the University of Cambridge for use on Unix systems connected to the Internet. It is freely available under the terms of the GNU General Public Licence. In style it is similar to Smail 3, but its facilities are more general. There is a great deal of flexibility in the way mail can be routed, and there are extensive facilities for checking incoming mail. Exim can be installed in place of sendmail, although the configuration of exim is quite different to that of sendmail.

A mail transfer agent (MTA) (also called a mail transport agent, message transfer agent, or smtpd (short for SMTP daemon)), is a computer program or software agent that transfers electronic mail messages from one computer to another.