Monday, February 1, 2010

Straming Server Linux Red 5 Installation

REyou need to have:
# http://java.com/en/download/linux_manual.jsp
# chmod 755 jdk-1_5_0-linux-i586.bin
#./jdk-1_5_0-linux-i586.bin

Install Apache Ant Ant 1.7:

wget http://apache.mirror.transip.nl/ant/binaries/apache-ant-1.7.0-bin.tar.gz
tar -zxf apache-ant-1.7.0-bin.tar.gz
sudo mv apache-ant-1.7.0 /opt/ant # you don't need this
export ANT_HOME=/opt/ant
sudo ln -s /opt/ant/bin/ant /usr/bin/ant # shortcut - you sould now be able to use ant

now let’s get red5

svn co http://red5.googlecode.com/svn/java/server/trunk red5

#or

wget http://dl.fancycode.com/red5/0.6.3/src/red5-0.6.3.tar.gz
tar -zxf red5-0.6.3.tar.gz
mv red5-0.6.3 red5

now we have red5 directory containing red5 sources.

next step is compilation - before that we might want to provide proper patches to java and ant

export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun/
export ANT_HOME=/opt/ant/ # or other directory if you don't have root

now let’s compile

cd red5
/opt/ant/bin/ant prepare
/opt/ant/bin/ant dist

now directory “dist” contains compiled and ready to run server

cd dist
sh red5.sh

# or
# ant server

red5 should now run http server on port 5080 and rtmp service on port 1935

so let’s navigate to:

http://localhost:5080/demos

Sunday, January 31, 2010

Squid Proxy server

The Squid is a good proxy server. Its configuration is very simple. Please use the following procedures.

1) Most of the standard distributions have squid packages in its repository. If you are using fedora, RHEL or centos please do the following procedurea

# yum install squid -y

If your in debian or Ubundu please use the following,

# apt-get install squid

2) Now open the squid configuration file “squid.conf” . In general it will be in /etc/squid/squid.conf . Now modify/ add the following lines.

visible_hostname machine-name
http_port 3128
cache_dir ufs /var/spool/squid 1000 16 256
access_log /var/log/squid/access.log squid

3) Now add the following in the acl section.

acl our_networks src xxx.xxx.xxx.xxx/xx
http_access allow our_networks

Here the xxx.xxx.xxx.xxx/xx is your local IP /netmask

4) Now start the squid server

# /etc/rc.d/init.d/squid start

5) Now configure your web browser as follows. ( It is my firefox configuration )

Go to Preferences -> connection settings -> manual Proxy configurations
Now configure your proxy server IP and port ( 3128)
Now click Ok.

This is the most simplest proxy server configurations over network.

Saturday, January 30, 2010

What is the difference between "su -" and "su" ?

The main difference between su - and su is that the former makes the shell a login shell. This is very important especially if the user is going to su from a regular user account to a root (superuser) account. Normal users do not usually have /sbin/ and /usr/sbin/ in their search path. Therefore if a normal user wants to execute the command ifconfig, for example, after doing su, he usually gets the error message:

bash: ifconfig: command not found

With su -, on the other hand, root's .bashrc and .bash_profile and other special environment settings get sourced and this puts the sbin directories into the search path. Below is a sample session:

[testuser@localhost ~]$ su
Password:
[root@localhost testuser]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/testuser/bin
[root@localhost testuser]# ifconfig
bash: ifconfig: command not found
[root@localhost testuser]# exit
exit
[testuser@localhost ~]$ su -
Password:
[root@localhost ~]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:A0:CC:39:75:41
inet addr:192.168.44.146 Bcast:172.16.45.255 Mask:255.255.254.0
inet6 addr: fe80::2a0:ccff:fe39:7541/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:21619559 errors:1 dropped:0 overruns:0 frame:87
TX packets:21190195 errors:4 dropped:0 overruns:4 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1509569968 (1.4 GiB) TX bytes:2280347397 (2.1 GiB)
Interrupt:177 Base address:0x6800

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:6159 errors:0 dropped:0 overruns:0 frame:0
TX packets:6159 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3784618 (3.6 MiB) TX bytes:3784618 (3.6 MiB)

Change hostname in Linux without rebooting server

Change hostname in Linux without rebooting server

First you need to find out your hostname, you can do this with

$ hostname
localhost.localdomain
$

Edit /etc/hosts

You need to edit /etc/hosts and add a line for your host name

$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
$

My new server IP is 192.168.1.1, i need to assign it hostname fedora.redhat.com, to do this, i have edited /etc/hosts as follows.

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.1.1 fedora.redhat.com fedora

Edit /etc/sysconfig/network

First lets see what is in the file

$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
$

To change servers hostname to fedora.redhat.com, change the file as follows.

$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=fedora.redhat.com
$

$/bin/hostname fedora.redhat.com

$service syslog restart

after you can logout and login back