Harry Sukumar's Weblog

Archive for June, 2008

VMWare Reference VI3 Card

Posted by hsukumar on 26/06/2008

I stumbled upon vmreference.com the other day in a VMware Forum post and was pleasantly surprised. The site hosts the author’s “ESX3 vmreference card” document.

The document is a single source for all the most important ESX administration processes and best practices. It’s a lot of real world knowledge transfer crammed into two 8.5 x 11 pages.

The cheat sheet includes everything from general host hardware requirements to specialized console commands for common administration tasks.

Whether you are an experienced virtual infrastructure admin or a newbie, I recommend keeping a copy of this reference card handy. Personally, I am planning on having a copy laminated so I can carry it with me in my bag. It would also make a great poster on a cube wall or the side of data center rack.

Posted in CentOS, General Linux, Redhat MIX, VMWare | Leave a Comment »

Apache Web Server

Posted by hsukumar on 13/06/2008

In this tutorial I will be explaining you how to configure apache (httpd) on redhat distro’s including fedora and CentOS

Apache Web Server
—————–
Packages
——–
httpd-manual-2.0.52-25.ent
httpd-2.0.52-25.ent
httpd-suexec-2.0.52-25.ent
system-config-httpd-1.3.1-1

Daemon
——
httpd

Port
—-
80

Apache User Info
—————-
# grep apache /etc/passwd
apache:x:48:48:Apache:/var/www:/sbin/nologin

Configuration files
——————-
# cd /etc/httpd/
# ll
drwxr-xr-x  7 root root 4096 Feb 15 07:30 conf
drwxr-xr-x  2 root root 4096 Feb 15 07:31 conf.d
lrwxrwxrwx  1 root root   19 Feb 15 07:30 logs -> ../../var/log/httpd
lrwxrwxrwx  1 root root   27 Feb 15 07:30 modules -> ../../usr/lib/httpd/modules
lrwxrwxrwx  1 root root   13 Feb 15 07:30 run -> ../../var/run

# cd /etc/httpd/conf.d/
# ll
-rw-r–r–  1 root root   778 May 24  2006 manual.conf
-rw-r–r–  1 root root  1827 Dec  3  2004 perl.conf
-rw-r–r–  1 root root   448 Jun 26  2006 php.conf
-rw-r–r–  1 root root  1438 Jan 31  2005 python.conf
-rw-r–r–  1 root root   392 May 24  2006 README
-rw-r–r–  1 root root 10919 May 24  2006 ssl.conf
-rw-r–r–  1 root root   352 Aug 19  2004 webalizer.conf
-rw-r–r–  1 root root   299 May 24  2006 welcome.conf

# cd /etc/httpd/conf/
# ll
-rw-r–r–  1 root root 34655 May 24  2006 httpd.conf
-rw-r–r–  1 root root 12959 May 24  2006 magic
lrwxrwxrwx  1 root root    37 Feb 15 07:30 Makefile -> ../../../usr/share/ssl/certs/Makefile
drwx——  2 root root  4096 Feb 15 07:30 ssl.crl
drwx——  2 root root  4096 Feb 15 07:30 ssl.crt
drwx——  2 root root  4096 May 24  2006 ssl.csr
drwx——  2 root root  4096 Feb 15 07:30 ssl.key
drwx——  2 root root  4096 May 24  2006 ssl.prm

Apache Configuration – Normal
—————————–
# vi /etc/httpd/conf/httpd.conf
56 ServerRoot “/etc/httpd”
67 Timeout 120
100 StartServers     8    (1 parent process, 8 child process (handles 4000 ch.p)
125 Listen 80
249 ServerName www.harish.com:80
265 DocumentRoot “/var/www/html”
375 DirectoryIndex index.html index.php index.html.var

Virtual Hosting
—————
Hosting multiple websites in apache server is known as Virtual Hosting.
Two types of virtual hostings are available.
1. Name Based
2. IP Based

1. Name Based
Different website names pointing to a single ipaddress.

2. IP Based
An unique ip address for all web sites. Each websites will have its own ip address.

Apache Configuration – Virtual Hosting (Name Based)
—————————————————
# vi /etc/httpd/conf/httpd.conf
1003 NameVirtualHost 192.168.0.12:80
1004 <VirtualHost 192.168.0.12>
1005 ServerName mail.harish.com
1006 DirectoryIndex index.html index.php
1007 DocumentRoot /var/www/mail
1008 ErrorLog logs/mail.harish.com-error_log
1009 CustomLog logs/mail.harish.com-access_log common
1010 </VirtualHost>

1011 <VirtualHost 192.168.0.12>
1012 ServerName info.harish.com
1013 DirectoryIndex index.html index.php
1014 DocumentRoot /var/www/info
1015 ErrorLog logs/info.harish.com-error_log
1016 CustomLog logs/info.harish.com-access_log common
1017 </VirtualHost>

1018 <VirtualHost 192.168.0.12>
1019 ServerName chat.harish.com
1020 DirectoryIndex index.html index.php
1021 DocumentRoot /var/www/chat
1022 ErrorLog logs/chat.harish.com-error_log
1023 CustomLog logs/chat.harish.com-access_log common
1024 </VirtualHost>

# httpd -t    <— To check the syntax
Syntax OK

Apache Configuration – Virtual Hosting (IP Based)
—————————————————
# vi /etc/httpd/conf/httpd.conf
1003 # NameVirtualHost 192.168.0.12:80
1004 <VirtualHost 192.168.0.12>
1005 ServerName mail.harish.com
1006 DirectoryIndex index.html index.php
1007 DocumentRoot /var/www/mail
1008 ErrorLog logs/mail.harish.com-error_log
1009 CustomLog logs/mail.harish.com-access_log common
1010 </VirtualHost>

1011 <VirtualHost 192.168.0.13>
1012 ServerName info.harish.com
1013 DirectoryIndex index.html index.php
1014 DocumentRoot /var/www/info
1015 ErrorLog logs/info.harish.com-error_log
1016 CustomLog logs/info.harish.com-access_log common
1017 </VirtualHost>

1018 <VirtualHost 192.168.0.14>
1019 ServerName chat.harish.com
1020 DirectoryIndex index.html index.php
1021 DocumentRoot /var/www/chat
1022 ErrorLog logs/chat.harish.com-error_log
1023 CustomLog logs/chat.harish.com-access_log common
1024 </VirtualHost>

# httpd -t
Syntax OK

Apache Security
—————
1. User Based
2. IP Based

1. User Based Security
———————–
Step -1
——-
# vi /etc/httpd/conf/httpd.conf
1016 <Directory /var/www/mail>
1017 authname harishmail
1018 authtype basic
1019 authuserfile /etc/httpd/htusers
1020 require valid-user (or)
1021 require user user1 user2 user3
1022 <Directory>

Step -2
——-
# touch /etc/httpd/htusers

Step -3
——-
# htpasswd -m /etc/httpd/htusers user1
# htpasswd -m /etc/httpd/htusers user2

Step -4
——-
# service httpd restart

Above mentioned authentication is purely visible in apache configuration file.
Instead of that change the entry in httpd.conf file & create a .htaccess file.
That steps is noted below.

Step -1
——-
# vi /etc/httpd/conf/httpd.conf
1016 <Directory /var/www/mail>
1017 allowoverride authconfig     <— This will look 382 .htaccess (hidden file)
1018 </Directory>

Step -2
——-
# cd /var/www/mail/
# vi .htaccess
authname harishmail
authtype basic
authuserfile /etc/httpd/htusers
require valid-user (or)
require user user1 user2
:wq

Step -3
——-
# service httpd restart

IP Based Security
—————–
# vi /etc/httpd/conf/httpd.conf
1016 <Directory /var/www/mail>
1017 order allow, deny
1018 allow from 192.168.0.12
1019 allowoverride authconfig
1020 </Directory>

Posted in Uncategorized | Leave a Comment »

Mp3 Player -Fedora

Posted by hsukumar on 03/06/2008

I am sure you guys are so frustrated after trying all the option to play mp3 files :( I spent ages to get my music going on fedora

This is how i fixed mp3 problem on fedora

I use xmms to play mp3

$ Yum install xmms

Due to patent and licensing concerns, Red Hat Linux 8.0 does not include MP3 support. This isn’t completely terrible as 8.0 includes full support for the OGG Vorbis format. OGG Vorbis is widely regarded as a superior format to MP3. Listen for yourself. You can even find mobile players that support OGG Vorbis. Anyways, back to MP3. To get MP3 support back in XMMS, you simply need to install the xmms-mp3 RPM created here at Guru Labs. This RPM provides the file:

/usr/lib/xmms/Input/libmpg123.so

Also provided is the SRPM from which the binary RPM was built. The SRPM is identical to the XMMS SRPM shipped with Red Hat Linux and Fedora except that it uses the pristine XMMS source (ie, has MP3 support), and the SPEC file was modified to create the xmms-mp3 sub package.

Files for Fedora Core v4:
Download RPM: xmms-mp3-1.2.10-16.i386.rpm
Download SRPM: xmms-1.2.10-16.src.rpm (Not normally needed)

Files for Fedora Core v3:
Download RPM: xmms-mp3-1.2.10-9.i386.rpm
Download SRPM: xmms-1.2.10-9.src.rpm (Not normally needed)

Once the above files are downloaded just install them and start xmms and you can play mp3 now ohhhh finally :)

Posted in CentOS, General Linux, Redhat MIX | 3 Comments »

Securing SSH

Posted by hsukumar on 03/06/2008

Securing SSH

In the /etc/ssh/sshd_config file change the following lines (if it is commented out remove the #):

Protocol 2
PermitRootLogin no
PermitEmptyPasswords no

Save the file and type “service sshd restart”. SSH will restart, enacting these changes. (You will need to SSH into the box with the user account you created from this point on, as root will no longer be accepted. Just “su –“ to the root account)

Enjoy

Posted in CentOS, General Linux, Redhat MIX | Leave a Comment »