Archive for the Category »Uncategorized «

How to install Webmin?

You can install webmin by using following steps.

root@gunjan[~]#cd /usr/local/src

root@gunjan[~]#wget http://sourceforge.net/projects/webadmin/files/webmin/1.500/webmin-1.500-1.noarch.rpm/download

root@gunjan[~]#rpm -Uvh webmin-1.500-1.noarch.rpm

warning: webmin-1.500-1.noarch.rpm: Header V3 DSA signature: NOKEY, key ID xxxxx
Preparing… ########################################### [100%]
Operating system is CentOS Linux
1:webmin ########################################### [100%]
Webmin install complete. You can now login to http://server.domain.com:10000/
as root with your root password.

Stop hotlinking from outside domains by using .htaccess?

How to stop hotlinking from outsides domains.

You can stop the hotlinking from outsider domain by using following rule in .htaccess

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(.+.)?domain.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+.)?domain1.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+.)?domain2.com/ [NC]
RewriteRule .*.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpe [L]

You can also display a 403 Forbidden Error page instead of an image (nohotlink.jpe)

Replace last line on above code with the following code

RewriteRule .*.(jpe?g|gif|bmp|png)$ – [F]

Wordpress default .htaccess file?

The default wordpress .htaccess file code is as follows

# BEGIN wordpress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_fileNAME} !-f
RewriteCond %{REQUEST_fileNAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END wordpress

How to patch openssl version?

You can patch openssl version by using following steps but make sure that you are able to SSH server as root user user.

root@gunjan[/usr/local/src]#cd /usr/local/src
root@gunjan[/usr/local/src]#wget http://www.openssl.org/source/openssl-0.9.8h.tar.gz
root@gunjan[/usr/local/src]#tar -zxf openssl-0.9.8h.tar.gz
root@gunjan[/usr/local/src]#cd openssl-0.9.8h
root@gunjan[/usr/local/src]#./Configure –prefix=/usr debug-linux-pentium (or choose right os)
root@gunjan[/usr/local/src]#make
root@gunjan[/usr/local/src]#make install

To check openssl version simply run openssl version

root@gunjan[/usr/local/src]#openssl version

Simple cgi script to check the Server uptime?

The following script you can use to check the Server uptime?

root@Gunjan [/usr/local/apache/cgi-bin]# nano loads
#!/bin/bash

echo Content-type: text/plain
echo

echo $(hostname)
echo “=>”
echo $(uptime)

Three command to check Servers uptime?

Yes its always good to know uptime for Server.You can check Server uptime by using following commands.

root@gunjan [~]# uptime
04:34:25 up 20 days, 14:31,  1 user,  load average: 0.15,07.33,0.76

root@gunjan [~]# w
04:34:20 up 20 days, 14:31,  1 user,  load average: 0.15,07.33,0.76
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT

root@gunjan [~]#top

top – 04:36:17 up 20 days, 14:33,  1 user,  load average: 0.15,07.33,0.76
Tasks: 290 total,   1 running, 283 sleeping,   0 stopped,   6 zombie
Cpu(s):  2.6%us,  1.4%sy,  0.0%ni, 78.9%id, 16.9%wa,  0.0%hi,  0.2%si,  0.0%st

What is Core Files in Linux?

A core file created when ever a program terminates unexpectedly and its also useful for determining what caused the termination. In many Linux server by default they do not produce core files when programs crash or terminates unexpectedly.

On  most of the Linux server core file size limitation is set to 0.You can check the core file size limit set in server by using following command.

root@gunjan [~]# ulimit -c
1000000

In above command core file size limit is 1000000 if output occur empty then it means core file size limit haven’t set on server and you can set it as

root@gunjan [~]# ulimit -c 1000000

or

root@gunjan [~]# ulimit -c unlimited

If you want to test core file limit is working on your server or not? then run following command

kill -s SIGSEGV $$

This above command will crashes your shell and produces core file in the current directory. as core.*

If core file is taking lots of disk space on server and you want to disable it then follow the steps one by one.

root@gunjan [~]#which httpd

/usr/sbin/httpd

root@gunjan [~]#pico /usr/sbin/httpd

And following line in /usr/sbin/httpd

ulimit -c 0

And then restart the Apache server

Options FollowSymLinks or SymLinksIfOwnerMatch forbidden error?

If you receive following error message after browsing the domain/website

[Sat Oct 31 04:28:39 2009] [error] [client x.x.x.x] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /home/xxx/public_html/xxx/403.shtml
[Sat Oct 31 04:29:47 2009] [error] [client x.x.x.x] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /home/xxx/public_html/xxx.co.uk/Bracelets/Stencil-Heart-Bracelet.html

To avoid above error you can add following codes in .htaccess file.

root@gunjan[#]vi .htaccess

RewriteEngine On
Options +FollowSymLinks
:wq!

How to Open Passive FTP in iptable?

To Open Passive FTP in iptable root login is require.

If you want to open port range from 30000:64000 then run the following command from shell.

iptables -A INPUT -p tcp -m tcp –dport 30000:64000 -j ACCEPT

Similarly you can open passive post range as per your requirement.

How to install ssl on default services(http, exim, imap, pop3, cpanel/WHM)?

You can install SSL on default services(http, exim, imap, pop3, cpanel/WHM) from your WHM but you require root login details to

The all cert information save in following path

/var/cpanel/ssl/cpanel

You can install the certificate from your WHM >>  Main >> Service Configuration >> Manage Service SSL Certificates