Tag Archives: Linux

How to install wine in RHEL and Centos

Description:
Wine enables Linux, Mac, BSD, and Solaris users run Windows applications without a copy of Microsoft Windows.

( lets assume you already enable EPEL REPO )
command:
yum install wine

This will install the wine meta package containing a standard set of dependencies. Expert users that want certain specific wine packages to be installed can choose from the list below:

wine-capi = ISDN support for wine
wine-cms = Color Management for wine
wine-core = Wine core package
wine-devel = Wine development environment
wine-esd = ESD sound support for wine
wine-jack = JACK sound support for wine
wine-ldap = LDAP support for wine
wine-nas = NAS sound support for wine
wine-tools = Additional wine tools
wine-twain = Twain support for wine

Red Hat Enterprise Linux / CentOS Linux Enable EPEL (Extra Packages for Enterprise Linux) Repository

Question: How do I enable EPEL (Extra Packages for Enterprise Linux) repo and install the packages under RHEL / CentOS Linux?

Answer: EPEL (Extra Packages for Enterprise Linux) is a volunteer-based community effort from the Fedora project to create a repository of high-quality add-on packages that complement the Fedora-based Red Hat Enterprise Linux (RHEL) and its compatible spinoffs, such as CentOS and Scientific Linux.

EPEL provide lots of packages for CentOS / RHEL, It is not part of RedHat or CentOS but is designed to work with these major distributions. Please note that EPEL only provides free and open source software unencumbered by patents or any legal issues. In short you will not find mp3, dvd and music / media player under EPEL. However, you will find many programs related to networking, monitoring, sys admin, programming and so on.

Packages are supplied in RPM format and in most cases are ready to use. Beware that some packages may break something and you should not blindly install those packages.

Question: How do I enable EPEL?

Answer: Simply type the following command as root user:
Command: rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

List new repo:
command: yum repolist

Sample output:
Loading "skip-broken" plugin
Loading "fastestmirror" plugin
repo id repo name status
addons CentOS-5 - Addons enabled
base CentOS-5 - Base enabled
epel Extra Packages for Enterprise Linux 5 - enabled
extras CentOS-5 - Extras enabled
updates CentOS-5 - Updates enabled

Using vnstat for simple traffic accounting

vnStat is a network traffic monitor for Linux that keeps a log of daily network traffic for the selected interface(s). vnStat isn’t a packet sniffer. The traffic information is analyzed from the /proc -filesystem, so vnStat can be used without root permissions. However at least a 2.2.x kernel is required.
vnstat

Quick install guide (I have set it up on a Centos 5.3 box):
[user@host] $ wget http://tinyurl.com/mx9yrf
[user@host] $ tar zxvf vnstat-1.7.tar.gz
[user@host] $ cd vnstat-1.7
[user@host] $ make
[user@host] $ su
Password:
[root@host] # make install

#create databases for NICs
[root@host] # vnstat -u -i eth0
[root@host] # vnstat -u -i eth1
[root@host] # crontab -e


Add the following entry in the crontab:
*/5 * * * * /usr/bin/vnstat -u

Install the frontend:
[root@host] # cd /var/www/htdocs
[root@host] # wget -O http://tinyurl.com/kmn3u8
[root@host] # tar zxvf vnstat_php_frontend-1.4.1.tar.gz
[root@host] # mv vnstat_php_frontend-1.4.1 vnstat

Edit vnstat/config.php and adjust the following lines to your preference:
$iface_list = array('eth0', 'eth1');
$iface_title['eth0'] = 'Extern';
$iface_title['eth1'] = 'Intern';
$vnstat_bin = '/usr/bin/vnstat';

That’s all, assuming apache is properly configured with php enabled, you can access the interface at http://your-domain.com/vnstat/

OPEN ports in Windows

Usually, if you want to see all the used and listening ports on your computer, you’d use the NETSTAT command. its about time to blog something related about Windows :) not just linux,

Note: The NETSTAT command will show you whatever ports are open or in use,

Open Command Prompt and type:

netstat -an |find /i "listening"

it will show something like

CP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
TCP 0.0.0.0:1025 0.0.0.0:0 LISTENING
TCP 0.0.0.0:1084 0.0.0.0:0 LISTENING
TCP 0.0.0.0:2094 0.0.0.0:0 LISTENING
TCP 0.0.0.0:3389 0.0.0.0:0 LISTENING
TCP 0.0.0.0:5000 0.0.0.0:0 LISTENING

You can pipe it to a text file by adding > c:openports.txt to the command, if you want to…

command: netstat -an |find /i "listening" > c:openports.txt

You can also change “listening” to “established” to see what ports your computer actually communicates with:

command: netstat -an |find /i "established"

result:
TCP 192.168.0.2:1084 192.168.0.200:1026 ESTABLISHED
TCP 192.168.0.2:2094 192.168.0.200:1166 ESTABLISHED
TCP 192.168.0.2:2305 209.211.250.3:80 ESTABLISHED
TCP 192.168.0.2:2316 212.179.112.230:80 ESTABLISHED
TCP 192.168.0.2:2340 209.211.250.3:110 ESTABLISHED

Note: In Windows XP and Windows Server 2003, you can type NETSTAT -O to get a list of all the owning process ID associated with each connection:

command: netstat -ao |find /i "listening"

TCP pro1:epmap pro1.dpetri.net:0 LISTENING 860
TCP pro1:microsoft-ds pro1.dpetri.net:0 LISTENING 4
TCP pro1:1025 pro1.dpetri.net:0 LISTENING 908
TCP pro1:1084 pro1.dpetri.net:0 LISTENING 596
TCP pro1:2094 pro1.dpetri.net:0 LISTENING 596
TCP pro1:3389 pro1.dpetri.net:0 LISTENING 908
TCP pro1:5000 pro1.dpetri.net:0 LISTENING 1068

To see all open, established, closing and other used ports type:

command: netstat -a

result:

Active Connections

Proto Local Address Foreign Address State
TCP pro1:epmap pro1.dpetri.net:0 LISTENING
TCP pro1:microsoft-ds pro1.dpetri.net:0 LISTENING
TCP pro1:1025 pro1.dpetri.net:0 LISTENING
TCP pro1:1084 pro1.dpetri.net:0 LISTENING
TCP pro1:2094 pro1.dpetri.net:0 LISTENING
TCP pro1:3389 pro1.dpetri.net:0 LISTENING
TCP pro1:5000 pro1.dpetri.net:0 LISTENING
TCP pro1:1084 srv1.dpetri.net:1026 ESTABLISHED
TCP pro1:2094 srv1.dpetri.net:1166 ESTABLISHED
TCP pro1:2365 srv1.dpetri.net:epmap TIME_WAIT
TCP pro1:2366 srv1.dpetri.net:1026 TIME_WAIT
UDP pro1:epmap *:*
UDP pro1:microsoft-ds *:*
UDP pro1:isakmp *:*
UDP pro1:1026 *:*
UDP pro1:1027 *:*
UDP pro1:1028 *:*
UDP pro1:1038 *:*
UDP pro1:1043 *:*
UDP pro1:1085 *:*
UDP pro1:1086 *:*
UDP pro1:1242 *:*
UDP pro1:ntp *:*
UDP pro1:1649 *:*
UDP pro1:1900 *:*
UDP pro1:2095 *:*
UDP pro1:2217 *:*
UDP pro1:ntp *:*
UDP pro1:1900 *:*

Again, in XP/2003 you can use the -O switch:

command: netstat -ao

result:
Active Connections

Proto Local Address Foreign Address State PID
TCP pro1:epmap pro1.dpetri.net:0 LISTENING 860
TCP pro1:microsoft-ds pro1.dpetri.net:0 LISTENING 4
TCP pro1:1025 pro1.dpetri.net:0 LISTENING 908
TCP pro1:1084 pro1.dpetri.net:0 LISTENING 596
TCP pro1:2094 pro1.dpetri.net:0 LISTENING 596
TCP pro1:3389 pro1.dpetri.net:0 LISTENING 908
TCP pro1:5000 pro1.dpetri.net:0 LISTENING 1068
TCP pro1:1084 srv1.dpetri.net:1026 ESTABLISHED 596
TCP pro1:2094 srv1.dpetri.net:1166 ESTABLISHED 596
UDP pro1:epmap *:* 860
UDP pro1:microsoft-ds *:* 4
UDP pro1:isakmp *:* 680
UDP pro1:1026 *:* 1040
UDP pro1:1027 *:* 1040
UDP pro1:1028 *:* 680
UDP pro1:1038 *:* 908
UDP pro1:1043 *:* 624
UDP pro1:1085 *:* 596
UDP pro1:1086 *:* 596
UDP pro1:1242 *:* 1040
UDP pro1:ntp *:* 908
UDP pro1:1649 *:* 596
UDP pro1:1900 *:* 1068
UDP pro1:2095 *:* 976
UDP pro1:2217 *:* 1856
UDP pro1:ntp *:* 908
UDP pro1:1900 *:* 1068

What is the best Webserver

Have you been wondering what is the best Webserver? is it the Famous Apache which almost all Web Host use? or its Tight counterpart Lighthttp or the new comer LiteSpeed

for people who does not know what is a webserver:

A webserver is computer program that is responsible for accepting HTTP requests from clients (user agents such as web browsers), and serving them HTTP responses along with optional data contents, which usually are web pages such as HTML documents and linked objects (images, etc.).

[ Specs of Involved Machines ]

CPU
Quad-Core AMD Opteron(tm) Processor 2350
MemTotal: 1048796 kB

Linux Version
Linux version 2.6.24-23-xen (buildd@crested) (gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)) 0000001 SMP Mon Jan 26 03:09:12 UTC 2009

System
CentOS release 5.3 (Final)

[ HTML Results ]

Apache:
Server Software: Apache/2.2.3
Server Hostname: 174.XXX.XXX.93
Server Port: 80

Document Path: /index2.html
Document Length: 0 bytes

Concurrency Level: 100
Time taken for tests: 1.980113 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 265795 bytes
HTML transferred: 0 bytes
Requests per second: 505.02 [#/sec] (mean)
Time per request: 198.011 [ms] (mean)
Time per request: 1.980 [ms] (mean, across all concurrent requests)
Transfer rate: 130.80 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 5 7.3 4 32
Processing: 4 98 319.1 40 1972
Waiting: 4 96 317.7 40 1972
Total: 8 104 318.9 44 1976

Percentage of the requests served within a certain time (ms)
50% 44
66% 56
75% 56
80% 56
90% 60
95% 60
98% 1976
99% 1976
100% 1976 (longest request)


Server Software: lighttpd/1.4.22
Server Hostname: 174.XXX.XXX.94
Server Port: 80

Document Path: /index2.html
Document Length: 0 bytes

Concurrency Level: 100
Time taken for tests: 4.132235 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 232232 bytes
HTML transferred: 0 bytes
Requests per second: 242.00 [#/sec] (mean)
Time per request: 413.224 [ms] (mean)
Time per request: 4.132 [ms] (mean, across all concurrent requests)
Transfer rate: 54.69 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 94 502.5 0 3000
Processing: 0 40 280.2 12 4092
Waiting: 0 38 278.6 4 4092
Total: 0 134 569.0 20 4092

Percentage of the requests served within a certain time (ms)
50% 20
66% 20
75% 20
80% 20
90% 36
95% 72
98% 3000
99% 3000
100% 4092 (longest request)


Server Software: LiteSpeed
Server Hostname: 67.XXX.XXX.123
Server Port: 8088

Document Path: /index2.html
Document Length: 0 bytes

Concurrency Level: 100
Time taken for tests: 1.388079 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 234864 bytes
HTML transferred: 0 bytes
Requests per second: 720.42 [#/sec] (mean)
Time per request: 138.808 [ms] (mean)
Time per request: 1.388 [ms] (mean, across all concurrent requests)
Transfer rate: 164.98 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 7 9.3 0 36
Processing: 0 34 159.8 20 1384
Waiting: 0 31 151.8 4 1384
Total: 0 41 160.7 20 1384

Percentage of the requests served within a certain time (ms)
50% 20
66% 20
75% 20
80% 20
90% 28
95% 44
98% 240
99% 1260
100% 1384 (longest request)


[ Image Result: ]

Server Software: Apache/2.2.3
Server Hostname: 174.xxx.xxx.93
Server Port: 80

Document Path: /imagetest.jpg
Document Length: 3400412 bytes

Concurrency Level: 10
Time taken for tests: 20.845188 seconds
Complete requests: 10
Failed requests: 0
Write errors: 0
Total transferred: 34006740 bytes
HTML transferred: 34004120 bytes
Requests per second: 0.48 [#/sec] (mean)
Time per request: 20845.188 [ms] (mean)
Time per request: 2084.519 [ms] (mean, across all concurrent requests)
Transfer rate: 1593.13 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 1.3 0 4
Processing: 20141 20595 245.1 20661 20841
Waiting: 0 30 27.1 40 60
Total: 20141 20595 245.4 20661 20841

Percentage of the requests served within a certain time (ms)
50% 20661
66% 20725
75% 20821
80% 20841
90% 20841
95% 20841
98% 20841
99% 20841
100% 20841 (longest request)


Server Software: lighttpd/1.4.22
Server Hostname: 174.xxx.xxx.94
Server Port: 80

Document Path: /imagetest.jpg
Document Length: 3400412 bytes

Concurrency Level: 10
Time taken for tests: 20.209151 seconds
Complete requests: 10
Failed requests: 0
Write errors: 0
Total transferred: 34006500 bytes
HTML transferred: 34004120 bytes
Requests per second: 0.49 [#/sec] (mean)
Time per request: 20209.150 [ms] (mean)
Time per request: 2020.915 [ms] (mean, across all concurrent requests)
Transfer rate: 1643.27 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 18709 19838 527.7 20109 20209
Waiting: 4 24 27.3 20 80
Total: 18709 19838 527.7 20109 20209

Percentage of the requests served within a certain time (ms)
50% 20109
66% 20149
75% 20149
80% 20189
90% 20209
95% 20209
98% 20209
99% 20209
100% 20209 (longest request)


Server Software: LiteSpeed
Server Hostname: 67.xxx.xxx.123
Server Port: 8088

Document Path: /imagetest.jpg
Document Length: 3400412 bytes

Concurrency Level: 10
Time taken for tests: 19.841131 seconds
Complete requests: 10
Failed requests: 0
Write errors: 0
Total transferred: 34007280 bytes
HTML transferred: 34004120 bytes
Requests per second: 0.50 [#/sec] (mean)
Time per request: 19841.131 [ms] (mean)
Time per request: 1984.113 [ms] (mean, across all concurrent requests)
Transfer rate: 1673.80 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 4 4 0.0 4 4
Processing: 18741 19504 340.3 19661 19837
Waiting: 0 10 17.0 0 40
Total: 18745 19508 340.3 19665 19841

Percentage of the requests served within a certain time (ms)
50% 19665
66% 19685
75% 19725
80% 19825
90% 19841
95% 19841
98% 19841
99% 19841
100% 19841 (longest request)

[ PHP Result ]

Server Software: Apache/2.2.3
Server Hostname: 174.xxx.xxx.93
Server Port: 80

Document Path: /phpinfo.php
Document Length: 42914 bytes

Concurrency Level: 100
Time taken for tests: 46.222634 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 43749819 bytes
HTML transferred: 43576083 bytes
Requests per second: 21.63 [#/sec] (mean)
Time per request: 4622.264 [ms] (mean)
Time per request: 46.223 [ms] (mean, across all concurrent requests)
Transfer rate: 924.31 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 691 261.3 780 1380
Processing: 1812 3749 704.6 3880 7868
Waiting: 4 824 495.0 780 3388
Total: 1816 4440 700.3 4700 7872

Percentage of the requests served within a certain time (ms)
50% 4700
66% 4740
75% 4760
80% 4780
90% 4820
95% 5160
98% 5780
99% 7712
100% 7872 (longest request)


Server Software: lighttpd/1.4.22
Server Hostname: 174.xxx.xxx.94
Server Port: 80

Document Path: /phpinfo.php
Document Length: 41967 bytes

Concurrency Level: 100
Time taken for tests: 41.686375 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 42857280 bytes
HTML transferred: 42692397 bytes
Requests per second: 23.99 [#/sec] (mean)
Time per request: 4168.638 [ms] (mean)
Time per request: 41.686 [ms] (mean, across all concurrent requests)
Transfer rate: 1003.97 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1016 947.0 824 5104
Processing: 20 2958 1008.7 3260 5000
Waiting: 0 636 276.1 680 1260
Total: 20 3975 1411.1 4180 8284

Percentage of the requests served within a certain time (ms)
50% 4180
66% 4200
75% 4220
80% 4220
90% 4780
95% 6364
98% 7600
99% 7744
100% 8284 (longest request)


Server Software: LiteSpeed
Server Hostname: 67.xxx.xxx.123
Server Port: 8088

Document Path: /phpinfo.php
Document Length: 23620 bytes

Concurrency Level: 100
Time taken for tests: 24.509397 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 24198400 bytes
HTML transferred: 24049648 bytes
Requests per second: 40.80 [#/sec] (mean)
Time per request: 2450.940 [ms] (mean)
Time per request: 24.509 [ms] (mean, across all concurrent requests)
Transfer rate: 964.16 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 516 283.3 560 3708
Processing: 892 1815 319.6 1768 5092
Waiting: 8 406 178.9 380 1472
Total: 896 2332 324.7 2356 5892

Percentage of the requests served within a certain time (ms)
50% 2356
66% 2440
75% 2480
80% 2500
90% 2520
95% 2560
98% 2676
99% 2760
100% 5892 (longest request)