MySQL version downgrade in linux cPanel servers

SOP for MySQL version downgrade from 5.1 to 4.0 in cPanel servers
================================================
Pre-installation steps
==============

Before you downgrade the MySQL version you need to do the following steps so as to avoid data loss or file corruption

Check the MySQL version by using the following command

#rpm -qa |grep MySQL

O/P
MySQL-server-5.0.91-0.glibc23
MySQL-client-5.0.91-0.glibc23
MySQL-devel-5.0.91-0.glibc23
MySQL-shared-5.0.91-0.glibc23
MySQL-bench-5.0.91-0.glibc23

check the server OS as below

# cat /etc/issue
or
# cat /etc/redhat-release

O/P
CentOS release 5.5 (Final)

Server architecture check

# arch

O/P
x86_64

Before downgrading we need to backup MySQL databases so as to avoid data corruption so we are copying the mysql database folder by using the following command

#cp -arp /var/lib/mysql /var/lib/mysql.bak

then dump the mysql databases using the following command

#mysqldump -u root -p(password) –all-databases > dumpfilename.sql

You can also take version compatible downgrade dump to check for any missing file restoring by using the following command

#mysqldump -u root -p(password) –all-databases –compatible=mysql40 > versioncompatibledumpfilename.sql

Actual MySQL down-gradation
===================

Then now we can start the down-gradation process

First you need to open the cpanel.conf file and make changes to the MySQL-version line from 5.1 to 4.0 by following the using the command

#vi /var/cpanel/cpanel.config

After changing the MySQL version line from 5.1 to 4.0 in the configuration file we need to run the following command to force the MySQL up-gradation/Down-gradation.

#/scripts/mysqlup –force

Now the MySQL version down-gradation will take place, once the process is completed you can check the version of MySQL which will be

# rpm -qa | grep -i mysql-
O/P

MySQL-shared-4.0.27-0
MySQL-devel-4.0.27-0
MySQL-bench-4.0.27-0
MySQL-client-4.0.27-0
MySQL-embedded-4.0.27-0
MySQL-server-4.0.27-0

Restart MySQL services by using the following command
#/etc/init.d/mysql restart

That’s all the MySQL version has been downgraded successfully.

Thank you for viewing helpinlinux.com

Form mail issue with php script.

If you are getting the following error message

** user@domain.com R=virtual_aliases: No Such User Here

Please remove the domain name from /etc/localdomains

and add the domain to /etc/remotedomains.

This will fix the problem as the domain has MX record outside the server the form mail on the server won’t try to send mail, if you change these two files, it will fix the problem.

If you receive any error as below

2010-10-30 12:19:52 1PCF5s-00037s-3x ** user@anydomain.com R=lookuphost T=remote_s mtp: SMTP error from remote mail server after MAIL FROM: SIZE=1415: host MX.anydomain.com [xxx.xxx.xxx.xxx]: 553 #5.1.8 Domain of sender address does not exist

then

Goto php.ini file and add the following line

“sendmail_path =/usr/sbin/sendmail -t -i -f mailer@yourdomain.com”

Thank you for viewing helpinlinux.com

Installing eAccelerator in linux machine

Follow the steps to install eAccelerator in linux machine

#cd /usr/local/
#wget http://bart.eaccelerator.net/source/0.9.6/eaccelerator-0.9.6-rc1.tar.bz2
#tar -jxvf eaccelerator-0.9.6-rc1.tar.bz2
#cd /usr/local/eaccelerator-0.9.6-rc1/
#phpize
#./configure
#make
#make install

Open a file as eaccelarator.ini in /etc/php.d/ directory

#vi /etc/php.d/eaccelarator.ini

Then add the configuration like :

zend_extension=”path/where/eaccelerator.so/is/locate/eaccelerator.so”
eaccelerator.shm_size=”16″
eaccelerator.cache_dir=”/tmp/eaccelerator”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=””
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”0″
eaccelerator.shm_prune_period=”0″
eaccelerator.shm_only=”1″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″

save and exit.

Make the cache directory

#mkdir /tmp/eaccelerator
#chmod 777 /tmp/eaccelerator/

Restart http service

#/etc/init.d/httpd restart

test the installation using

Testink

#php -v

You should be getting a output like

PHP 5.3.0 (cli) (built: Nov 1 2009 22:38:48)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies
with eAccelerator v0.9.6-rc1, Copyright (c) 2004-2007 eAccelerator, by eAccelerator

That’s it, you have installed eAccelerator on the server.

Steps to add a new domain in Hsphere control panel

Following are the steps to add a domain name to your Hsphere Control panel account.

1. Login to your control panel.

2. Select Domains icon.

3. You will be taken to a page where you will have an option to add a domain, select that option.

4. There you will have three options
a.Domain Name Registration-Can be used when you didn’t register a domain.
b.Host Existing Site-Can be used when you already registered a domain.
c.Third Level Domain Name Registration-Something like a sub domain used in conjunction with service provider’s name as second level domain name(say yourdomain.serviceprovider.com).

5. Fill the required field and select Submit.

6. Now your new domain will be added.

Removing Zombie process in the server

Hi,

I have got a solution for removing zombie process on servers(linux servers). We neither
need to restart the server nor run script to do this all we have to do is
just run the following command.

ps -el | grep 'Z'

The output of the above command will be something like this

F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
4 Z     0   668  4243  0  78   0 -     0 exit   ?        00:09:39 VV
4 Z     0  1403  4243  0  78   0 -     0 exit   ?        00:08:11 VV
4 Z     0  1613  4243  0  78   0 -     0 exit   ?        00:09:43 VV
4 Z     0  2202  4243  0  78   0 -     0 exit   ?        00:09:25 VV
4 Z     0  2382  4243  0  82   0 -     0 exit   ?        00:08:07 VV
4 Z     0  2618  4243  0  78   0 -     0 exit   ?        00:09:52 VV
4 Z     0  2714  4243  0  77   0 -     0 exit   ?        00:09:51 VV
4 Z     0  2741  4243  0  78   0 -     0 exit   ?        00:09:18 VV
4 Z     0  2956  4243  0  76   0 -     0 exit   ?        00:07:41 VV
4 Z     0  3030  4243  0  75   0 -     0 exit   ?        00:00:06 VV
4 Z     0  3125  4243  0  83   0 -     0 exit   ?        00:08:09 VV
4 Z     0  3260  4243  0  83   0 -     0 exit   ?        00:09:02 VV
4 Z     0  3480  4243  0  77   0 -     0 exit   ?        00:09:37 VV
4 Z     0  4151  4243  0  76   0 -     0 exit   ?        00:08:49 VV
4 Z     0  4899  4243  0  76   0 -     0 exit   ?        00:00:04 VV
4 Z     0  5099  4243  0  81   0 -     0 exit   ?        00:09:32 VV
4 Z     0  5667  4243  0  76   0 -     0 exit   ?        00:07:58 VV
4 Z     0  5778  4243  0  78   0 -     0 exit   ?        00:09:40 VV
4 Z     0  5956  4243  0  82   0 -     0 exit   ?        00:10:19 VV
4 Z     0  7035  4243  0  80   0 -     0 exit   ?        00:10:04 VV
4 Z     0  7448  4243  0  83   0 -     0 exit   ?        00:08:23 VV
4 Z     0  7757  4243  0  83   0 -     0 exit   ?        00:10:06 VV
4 Z     0  8219  4243  0  82   0 -     0 exit   ?        00:10:11 VV
4 Z     0  8262  4243  0  76   0 -     0 exit   ?        00:07:55 VV
4 Z     0  8631  4243  0  76   0 -     0 exit   ?        00:05:57 VV
4 Z     0  8728  4243  0  76   0 -     0 exit   ?        00:00:04 VV
4 Z     0  8944  4243  0  76   0 -     0 exit   ?        00:00:04 VV
4 Z     0  9431  4243  0  80   0 -     0 exit   ?        00:09:57 VV
4 Z     0  9577  4243  0  83   0 -     0 exit   ?        00:09:00 VV
4 Z     0  9762  4243  0  76   0 -     0 exit   ?        00:00:04 VV
4 Z     0 10263  4243  0  76   0 -     0 exit   ?        00:07:57 VV
4 Z     0 10960  4243  0  83   0 -     0 exit   ?        00:08:13 VV
4 Z     0 11526  4243  0  78   0 -     0 exit   ?        00:10:08 VV
4 Z     0 11952  4243  0  78   0 -     0 exit   ?        00:08:05 VV
4 Z     0 13339  4243  0  78   0 -     0 exit   ?        00:08:12 VV
4 Z     0 14776  4243  0  76   0 -     0 exit   ?        00:00:04 VV
4 Z     0 15016  4243  0  83   0 -     0 exit   ?        00:08:09 VV
4 Z     0 15163  4243  0  76   0 -     0 exit   ?        00:07:44 VV
4 Z     0 16673  4243  0  76   0 -     0 exit   ?        00:00:04 VV
4 Z     0 17057  4243  0  79   0 -     0 exit   ?        00:09:33 VV
4 Z     0 17095  4243  0  75   0 -     0 exit   ?        00:00:04 VV
4 Z     0 17155  4243  0  81   0 -     0 exit   ?        00:09:44 VV
4 Z     0 17760  4243  0  81   0 -     0 exit   ?        00:09:42 VV
4 Z     0 18088  4243  0  83   0 -     0 exit   ?        00:10:00 VV
4 Z     0 18274  4243  0  76   0 -     0 exit   ?        00:07:45 VV
4 Z     0 18744  4243  0  83   0 -     0 exit   ?        00:09:18 VV
4 Z     0 19227  4243  0  82   0 -     0 exit   ?        00:10:10 VV
4 Z     0 19288  4243  0  79   0 -     0 exit   ?        00:09:23 VV
4 Z     0 19316  4243  0  78   0 -     0 exit   ?        00:09:51 VV
4 Z     0 19654  4243  0  78   0 -     0 exit   ?        00:09:32 VV
4 Z     0 19695  4243  0  77   0 -     0 exit   ?        00:09:51 VV
4 Z     0 20190  4243  0  78   0 -     0 exit   ?        00:08:55 VV
4 Z     0 20602  4243  0  76   0 -     0 exit   ?        00:07:56 VV
4 Z     0 21455  4243  0  76   0 -     0 exit   ?        00:07:54 VV
4 Z     0 21687  4243  0  83   0 -     0 exit   ?        00:09:16 VV
4 Z     0 22785  4243  0  84   0 -     0 exit   ?        00:08:08 VV
4 Z     0 22855  4243  0  78   0 -     0 exit   ?        00:09:39 VV
4 Z     0 23330  4243  0  78   0 -     0 exit   ?        00:09:37 VV
4 Z     0 23405  4243  0  82   0 -     0 exit   ?        00:10:24 VV
4 Z     0 23600  4243  0  83   0 -     0 exit   ?        00:08:45 VV
4 Z     0 24578  4243  0  76   0 -     0 exit   ?        00:07:40 VV
4 Z     0 24846  4243  0  75   0 -     0 exit   ?        00:00:04 VV
4 Z     0 25661  4243  0  78   0 -     0 exit   ?        00:08:04 VV
4 Z     0 26718  4243  0  76   0 -     0 exit   ?        00:07:56 VV
4 Z     0 26908  4243  0  82   0 -     0 exit   ?        00:09:45 VV
4 Z     0 27554  4243  0  77   0 -     0 exit   ?        00:09:27 VV
4 Z     0 28478  4243  0  82   0 -     0 exit   ?        00:08:10 VV
4 Z     0 28553  4243  0  78   0 -     0 exit   ?        00:10:21 VV
4 Z     0 29034  4243  0  76   0 -     0 exit   ?        00:09:24 VV
4 Z     0 29173  4243  0  82   0 -     0 exit   ?        00:09:54 VV
4 Z     0 29193  4243  0  82   0 -     0 exit   ?        00:09:04 VV
4 Z     0 29722  4243  0  78   0 -     0 exit   ?        00:09:34 VV
4 Z     0 30856  4243  0  78   0 -     0 exit   ?        00:09:11 VV
4 Z     0 30999  4243  0  83   0 -     0 exit   ?        00:09:04 VV
4 Z     0 31057  4243  0  78   0 -     0 exit   ?        00:09:51 VV
4 Z     0 31274  4243  0  76   0 -     0 exit   ?        00:07:51 VV
4 Z     0 31735  4243  0  76   0 -     0 exit   ?        00:00:04 VV
4 Z     0 31924  4243  0  81   0 -     0 exit   ?        00:08:01 VV
4 Z     0 32121  4243  9  78   0 -     0 exit   ?        00:10:11 VV 

then we have to look into PPID(parent process i’d) and kill that process,

here the PPID is 4243

so the command to be executed will be

 kill -9 4243

Thank you for viewing helpinlinux.com

Installing SSL for a domain

Installing SSL through WHM for a particular domain
=======================================

1. Login to your WHM panel.
2. Select “SSL/TLS” icon on the WHM panel.
3. You will be taken to a new page there please select “Generate a SSL certificate and Signing request”.
4. Fill all the required fields and select Create.
5. A encrypted version of your CSR and RSA key will be generated and a copy of these two will also be sent to the mentioned email address.
6. Please take these two(CSR and RSA) to your SSL vendor to purchase a SSL certificate for you and come back to proceed further.
7.Select “Install SSL certificate and setup a domain” icon from “SSL/TLS”.
8. Please place the SSL certificate inside the free space and then select Domain name,username and IP address of the particular domain and select “Do it”.
9. That’s all your SSL will be installed on the server.

Installing SSL for a domain through server
===================================

1. Login to your linux system/server and goto /usr/share/ssl.
2. Here you will have all the files/folders required for ssl installation.
3. Copy the crt file at /usr/share/ssl/cert/domain.crt.
4. Copy the key file in /usr/share/ssl/private/domain.key
5. Copy the CA bundle at /usr/share/ssl/cert/domain.ca
6. Sample virtual host entry for ssl at httpd.conf

ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /home/username/public_html
ServerAdmin webmaster@domain.com
UseCanonicalName off
UserDir public_html

suPHP_UserGroup username username

User username
Group usergroup

BytesLog /usr/local/apache/domlogs/domain.com-bytes_log
ScriptAlias /cgi-bin/ /home/username/public_html/cgi-bin/
SSLEngine on
SSLCertificateFile /usr/share/ssl/certs/www.domain.com.crt
SSLCertificateKeyFile /usr/share/ssl/private/www.domain.com.key
SSLCACertificateFile /usr/share/ssl/certs/www.domain.com.cabundle
CustomLog /usr/local/apache/domlogs/domain.com-ssl_log combined
SetEnvIf User-Agent “.*MSIE.*” nokeepalive ssl-unclean-shutdown

Thank you for viewing helpinlinux.com

Telnet in Linux

Telnet is developed focusing on client to server connection for data transfer. Telnet connects to the server in a plain text format. It was developed in 1969, due to security drawbacks it has been replaced by SSH in 1995.

To check whether telnet is active in your system use this following command in RHEL3/4.

[user@linux]# chkconfig telnet on
[user@linux]# service xinetd reload 

For fedora core1

Linux is configured to run the Telnet and FTP server, but by default, these services are not enabled. To enable the telnet these service, login to the server as the root userid and edit the files:

[user@linux]#/etc/xinetd.d/telnet

In this file, find the line for disable and change it from the value “yes” to “no”.

To connect to telnet we use the following command in linux

[user@linux]#telnet

To limit number parallel of telnet connections we shall reduce the following pts connections in the file /etc/securetty.

pts0

pts1

pts2

pts3

pts4

pts5


The above output will have 6 parallel telnet connections.

reference: http://www.idevelopment.info/data/Unix/Linux/LINUX_TelnetFTPAsRoot.shtml

en.wikipedia.org

Commonly used port numbers

The following are the frequently used port numbers.

FTP data transfer mode – 20
FTP control(command) mode – 21
SSH – 22.
Telnet – 23..
WHOIS – 43.
DNS – 53

NNTP(Network news Transfer Protocol)-119

Web service port numbers
======================
http-80
Mysql-3306
https-443

Control panel default port numbers
============================
cPanel – 2082
secure cPanel – 2083
WHM -2086
secure WHM -2087
webmail – 2095
secure webmail – 2096
Plesk – 8443,8087
Webmin-10000

Mail port numbers
==============
IMAP-143
POP2-109
POP3-110
SMTP-25
IMAPS-993
SMTPS-465

Reference -en.wikipedia.org

hotlink protection in apache server

This can be accomplished with a combination of SetEnvIf and the Deny and Allow directives. However, it is important to understand that any access restriction based on the REFERER header is intrinsically problematic due to the fact that browsers can send an incorrect REFERER, either because they want to circumvent your restriction or simply because they don’t send the right thing (or anything at all).

The following configuration will produce the desired effect if the browser passes correct REFERER headers.

SetEnvIf REFERER "www\.mydomain\.com" linked_from_here
SetEnvIf REFERER "^$" linked_from_here

   Order deny,allow
   Deny from all
   Allow from env=linked_from_here

Reference: http.apache.org

Thank you for viewing helpinlinux.com