Default Automatic index page when new account is created in cpanel/WHM

November 29th, 2013 No comments

Default Automatic index page when new account is created in cpanel/WHM

 

We all want to show default index page when new account is setup. Below are the steps:

First of all we have to create below  folder.

mkdir /root/cpanel3-skel

mkdir /root/cpanel3-skel/public_html

Create default index page.

vi /root/cpanel3-skel/public_html/index.html

save and quit the file.

 

If you want user have a customized .bashrc file for their SSH sessions then you can create it.

/root/cpanel3-skel/.bashrc

 

 

 

 

Categories: CPanel / WHM Tags:

How to Configure Multiple shared IP’s in WHM

November 29th, 2013 No comments

How to Configure Multiple shared IP’s in WHM

 

It is not possible to add multiple shared IP’s from WHM but it is possible to do it from SSH.

First of all we need to create a /var/cpanel/mainips/ directory if it is not present.

mkdir /var/cpanel/mainips/

Then we have to create a file.

vi /var/cpanel/mainips/root

Add all IP’s into it. save the file and quit.

121.127.250.152
121.127.250.153
121.127.250.154

Now login to WHM and check the IP’s

Home>>IP Functions>>Show/Edit Reserved IPs

 

Categories: CPanel / WHM Tags:

how to install whmsonic in cpanel

November 29th, 2013 No comments

How to install WHMSonic in cpanel

 

Login to your server root SSH and copy/paste the following command fully and run it.

cd /root/; rm -f installr.sh; wget http://www.whmsonic.com/setupr/installr.sh; chmod +x installr.sh; ./installr.sh

 

Sample installation output:

***********************************************************************
* WHMSonic Setup v2.1.11 *
***********************************************************************
WHMSonic installer is now installing the latest version. This may take a few minutes, please wait…
–2013-11-29 00:55:15– http://www.whmsonic.com/v2/setup/whmsonic.zip
Resolving www.whmsonic.com… 67.228.53.90
Connecting to www.whmsonic.com|67.228.53.90|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 10530510 (10M) [application/zip]
Saving to: `whmsonic.zip’

 

 

WHMSonic installer is now installing the latest version. This may take a few minutes, please wait…
Dear valued customer, WHMSonic v2.1.12 has been successfully installed, you can now access to WHMSonic at your WHM Root at the bottom of your left menu.
If you have the CSF firewall installed on your server, it is updated for the radio ports by WHMSonic.

Manuals – Tutorials: http://help.sonicpanel.com
Technical Support: http://www.whmsonic.com/support/

Best Regards
SonicPanel INC

 

Categories: CPanel / WHM Tags:

Uninstall Cloudlinux from cpanel

November 29th, 2013 No comments

You can always uninstall CloudLinux. In this case, we will ‘convert’ the system

back to CentOS. Even if the original system was RHEL — we will still convert to

‘CentOS’ state.

To uninstall CloudLinux follow below steps:

wget -O cldeploy http://repo.cloudlinux.com/cloudlinux/sources/cln/cldeploy

sh cldeploy -c

Please, note that some of the packages from CloudLinux repo will still be present. They are same as CentOS packages, and don’t have to be removed. They will be updated in the future from CentOS repositories, as new versions come out.

 

You can use below steps further:

Check if your server is Cloudlinux installed in it using below command.

/usr/local/cpanel/bin/cloudlinux_system_install -c

Update your CentOS-provided RPMs

yum upgrade -y

Rebuild Apache

/usr/local/cpanel/scripts/easyapache –build

or

/scripts/easyapache –build

Reinstall a non-CloudLinux kernel.

yum –disableexcludes=all install kernel

Remove CloudLinux Kernel

rpm -qa |awk ‘/^kernel.*lve/ {print $1|”xargs yum -y erase”}’

Reinstall any CloudLinux-provided RPMs that are also provided by CentOS

rpm -qa –qf “[%{VENDOR} %{NAME}\n]”|awk ‘/CloudLinux/ {print $2|”xargs yum reinstall -y”}’

Downgrade any CloudLinux provided RPMs to the CentOS version

rpm -qa –qf “[%{VENDOR} %{NAME}\n]”|awk ‘/CloudLinux/ {print $2|”xargs yum downgrade -y”}’

Remove any remaining CloudLinux specific RPMs

rpm -qa –qf “[%{VENDOR} %{NAME}\n]”|awk ‘/CloudLinux/ {print $2|”xargs yum erase -y”}’

Upgrade any downgraded CentOS provided RPMs

yum upgrade -y

Reboot the server to use the new non-CloudLinux kernel

reboot

 

Categories: Cloud Linux, CPanel / WHM Tags:

How to install ioping in linux server

September 9th, 2013 No comments

How to install ioping in linux server

This tool lets you monitor I/O latency in real time. It shows disk latency in the same way as ping shows network latency.

Login to SSH.

Go to the folder where you want to download it.

cd /usr/local/src

Download the installation file.

https://ioping.googlecode.com/files/ioping-0.6.tar.gz

Extract that file using below command.

tar -xzvf ioping-0.6.tar.gz

Go inside that folder.

cd ioping-0.6

compile it using below command.

make ioping

 

Examples

Show disk I/O latency using the default values and the current directory, until interrupted

$ ioping .
4096 bytes from . (ext4 /dev/sda3): request=1 time=0.5 ms
4096 bytes from . (ext4 /dev/sda3): request=2 time=0.4 ms
4096 bytes from . (ext4 /dev/sda3): request=3 time=0.5 ms
4096 bytes from . (ext4 /dev/sda3): request=4 time=12.7 ms
4096 bytes from . (ext4 /dev/sda3): request=5 time=0.4 ms
^C
— . (ext4 /dev/sda3) ioping statistics —
5 requests completed in 4794.0 ms, 364 iops, 1.4 mb/s
min/avg/max/mdev = 0.2/2.8/12.7/5.0 ms

Measure disk seek rate (iops)

ioping -R /dev/sda

— /dev/sda (device 465.8 Gb) ioping statistics —
186 requests completed in 3004.6 ms, 62 iops, 0.2 mb/s
min/avg/max/mdev = 6.4/16.0/26.8/4.7 ms

Measure disk sequential speed (mb/s)

ioping -RL /dev/sda

— /dev/sda (device 465.8 Gb) ioping statistics —
837 requests completed in 3004.1 ms, 292 iops, 72.9 mb/s
min/avg/max/mdev = 2.0/3.4/28.9/2.0 ms

For VPS’s also it will work.

4096 bytes from / (simfs /dev/simfs): request=1 time=8.2 ms
4096 bytes from / (simfs /dev/simfs): request=2 time=0.2 ms
4096 bytes from / (simfs /dev/simfs): request=3 time=0.2 ms
4096 bytes from / (simfs /dev/simfs): request=4 time=0.2 ms
4096 bytes from / (simfs /dev/simfs): request=5 time=0.2 ms

 

Categories: Installation, Uncategorized Tags:

How to recover directadmin server from crash drive.

August 24th, 2013 No comments

How to recover direct admin server from crash drive.

First of all mount the crash disk. In my case I am mounting it in /mnt

Now, you have to copy the data from old disk to new disk using below commands

cp -avprf /mnt/etc/passwd /etc/
cp -avprf /mnt/etc/group /etc/
cp -avprf /mnt/etc/shadow /etc/
cp -avprf /mnt/etc/gshadow /etc/
cp -avprf /mnt/etc/my.cnf /etc/
cp -avprf /mnt/etc/exim* /etc/
cp -avprf /mnt/etc/hosts /etc/
cp -avprf /mnt/etc/httpd/conf/* /etc/httpd/conf/
cp -avprf /mnt/etc/named.conf /etc/
cp -avprf /mnt/etc/proftpd.conf /etc/
cp -avprf /mnt/etc/proftpd.passwd /etc/
cp -avprf /mnt/etc/proftpd.vhosts.conf /etc/
cp -avprf /mnt/etc/resolv.conf /etc/
cp -avprf /mnt/etc/system_filter.exim /etc/
cp -avprf /mnt/usr/local/directadmin/conf /usr/local/directadmin/
cp -avprf /mnt/usr/local/directadmin/plugins /usr/local/directadmin/
cp -avprf /mnt/etc/mail /etc/
cp -avprf /mnt/etc/virtual /etc/
cp -avprf /mnt/var/named /var/
cp -avprf /mnt/var/spool/cron /var/spool/
cp -avprf /mnt/var/spool/virtual /var/spool/
cp -avprf /mnt/var/www /var/
cp -avprf /mnt/usr/local/directadmin/data /usr/local/directadmin/
cp -avprf /mnt/var/lib/mysql /var/lib/
cp -avprf /mnt/home/* /home/

 

Once data has been copied from old disk to new disk you have to compile apache and php using direct admin custom script. After successful compilation sites will start working fine.

 

 

Categories: DirectAdmin Tags:

How to tweak linux server harddisk using hdparm

August 24th, 2013 No comments

Tune your hard disk for high performance Using hdparm

First of all you have to install hdparm in linux.

apt-get install hdparm

#hdparm /dev/sda

/dev/sda:
readonly = 0 (off)
readahead = 120 (on)
geometry = 8850/255/63, sectors = 142182912, start = 0

 

Hard disk Performance Information

# hdparm -tT /dev/hda

/dev/hdd:
Timing cached reads: 496 MB in 2.00 seconds = 247.42 MB/sec
Timing buffered disk reads: 60 MB in 3.03 seconds = 19.81 MB/sec

 

Hard drive set to low, slow settings

# hdparm -cuda /dev/hda

/dev/hda:
IO_support = 0 (default 16-bit)
unmaskirq = 0 (off)
using_dma = 0 (off)
readahead = 256 (on)

Use below tweaks to increase disk read write performance.

For sda drive

~]# hdparm -a 2048 /dev/sda

/dev/sda:
setting fs readahead to 2048
readahead = 2048 (on)

For sdb drive

[[email protected] ~]# hdparm -a 2048 /dev/sdb

/dev/sdb:
setting fs readahead to 2048
readahead = 2048 (on)

 

]# echo “anticipatory” > /sys/block/sdb/queue/scheduler

]# echo “anticipatory” > /sys/block/sda/queue/scheduler

 

 

Categories: Tweaks, Uncategorized Tags:

DDOS attack check

August 3rd, 2013 No comments

DDOS attack

Whenever the load in the server increases due to a particular user in the server. Check the following:

You can check the user in top.

Find the domain owned by the user:

grep username /etc/userdomains

use the following command after you get the domain name:

less /usr/local/apache/domlogs/domain.com | awk ‘{print $1}’ | sort | uniq -c | sort -n

This will give the ip and number of connections in the descending order. For example:

13832 65.51.111.143
19112 66.250.68.289
208262 157.55.16.77

In the above case we can see too many connections from those ips. This is surely abnormal. Immediately block such ips in the server using csf or block that ips in hosts.deny.

 

 

Categories: Uncategorized Tags:

vi and vim cheat sheet for Linux

April 10th, 2013 No comments

vi and vim cheat sheet for Linux

 

Cursor movement

h – move left
j – move down
k – move up
l – move right
w – jump by start of words (punctuation considered words)
W – jump by words (spaces separate words)
e – jump to end of words (punctuation considered words)
E – jump to end of words (no punctuation)
b – jump backward by words (punctuation considered words)
B – jump backward by words (no punctuation)
0 – (zero) start of line
^ – first non-blank character of line
$ – end of line
G – Go To command (prefix with number – 5G goes to line 5)
Note: Prefix a cursor movement command with a number to repeat it. For example, 4j moves down 4 lines.

 

Insert Mode – Inserting/Appending text

i – start insert mode at cursor
I – insert at the beginning of the line
a – append after the cursor
A – append at the end of the line
o – open (append) blank line below current line (no need to press return)
O – open blank line above current line
ea – append at end of word
Esc – exit insert mode

Editing

r – replace a single character (does not use insert mode)
J – join line below to the current one
cc – change (replace) an entire line
cw – change (replace) to the end of word
c$ – change (replace) to the end of line
s – delete character at cursor and subsitute text
S – delete line at cursor and substitute text (same as cc)
xp – transpose two letters (delete and paste, technically)
u – undo
. – repeat last command

Marking text (visual mode)

v – start visual mode, mark lines, then do command (such as y-yank)
V – start Linewise visual mode
o – move to other end of marked area
Ctrl+v – start visual block mode
O – move to Other corner of block
aw – mark a word
ab – a () block (with braces)
aB – a {} block (with brackets)
ib – inner () block
iB – inner {} block
Esc – exit visual mode

Visual commands

> – shift right
< – shift left
y – yank (copy) marked text
d – delete marked text
~ – switch case

Cut and Paste

yy – yank (copy) a line
2yy – yank 2 lines
yw – yank word
y$ – yank to end of line
p – put (paste) the clipboard after cursor
P – put (paste) before cursor
dd – delete (cut) a line
dw – delete (cut) the current word
x – delete (cut) current character

Exiting

:w – write (save) the file, but don’t exit
:wq – write (save) and quit
:q – quit (fails if anything has changed)
:q! – quit and throw away changes

Search/Replace

/pattern – search for pattern
?pattern – search backward for pattern
n – repeat search in same direction
N – repeat search in opposite direction
:%s/old/new/g – replace all old with new throughout file
:%s/old/new/gc – replace all old with new throughout file with confirmations

Working with multiple files

:e filename – Edit a file in a new buffer
:bnext (or :bn) – go to next buffer
:bprev (of :bp) – go to previous buffer
:bd – delete a buffer (close a file)
:sp filename – Open a file in a new buffer and split window
ctrl+ws – Split windows
ctrl+ww – switch between windows
ctrl+wq – Quit a window
ctrl+wv – Split windows vertically
Another good vim commands cheatsheet and a vi introduction using the “cheat sheet” method

 

Categories: Uncategorized Tags:

rpm command cheat sheet for Linux

April 10th, 2013 No comments

rpm command cheat sheet for Linux

rpm is a powerful Package Manager for Red Hat, Suse and Fedora Linux. It can be used to build, install, query, verify, update, and remove/erase individual software packages. A Package consists of an archive of files, and package information, including name, version, and description:

Syntax Description Example(s)
rpm -ivh {rpm-file} Install the package rpm -ivh mozilla-mail-1.7.5-17.i586.rpm
rpm -ivh –test mozilla-mail-1.7.5-17.i586.rpm
rpm -Uvh {rpm-file} Upgrade package rpm -Uvh mozilla-mail-1.7.6-12.i586.rpm
rpm -Uvh –test mozilla-mail-1.7.6-12.i586.rpm
rpm -ev {package} Erase/remove/ an installed package rpm -ev mozilla-mail
rpm -ev –nodeps {package} Erase/remove/ an installed package without checking for dependencies rpm -ev –nodeps mozilla-mail
rpm -qa Display list all installed packages rpm -qa
rpm -qa | less
rpm -qi {package} Display installed information along with package version and short description rpm -qi mozilla-mail
rpm -qf {/path/to/file} Find out what package a file belongs to i.e. find what package owns the file rpm -qf /etc/passwd
rpm -qf /bin/bash
rpm -qc {pacakge-name} Display list of configuration file(s) for a package rpm -qc httpd
rpm -qcf {/path/to/file} Display list of configuration files for a command rpm -qcf /usr/X11R6/bin/xeyes
rpm -qa –last Display list of all recently installed RPMs rpm -qa –last
rpm -qa –last | less
rpm -qpR {.rpm-file}
rpm -qR {package}
Find out what dependencies a rpm file has rpm -qpR mediawiki-1.4rc1-4.i586.rpm
rpm -qR bash
Categories: Installation Tags: