Category: Debian & Ubuntu

Debian & Ubuntu

How to install GNOME themes in Ubuntu

How to install GNOME themes in Ubuntu

Introduction – There are many beautiful GNOME desktop themes available for Ubuntu and other linux….

Step 1] Add repository –

root@me:~# add-apt-repository ppa:bisigi/ppa

*** Add following two lines in “/etc/apt/sources.list” file.

root@me:~# vi  /etc/apt/sources.list

deb http://ppa.launchpad.net/bisigi/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/bisigi/ppa/ubuntu karmic main

Step 2] Add the gpg key of repository –

root@me:~# gpg –keyserver hkp://keyserver.ubuntu.com:11371 –recv-key 881574DE && gpg -a –export 881574DE | apt-key add –

Step 3] Update the repo list and install the themes….

root@me:~# apt-get update

* To install all available themes plz run  this command….

root@me:~# apt-get install bisigi-themes

* To install indivisual themes.. (few best themes)

root@me:~# apt-get install showtime-theme

root@me:~# apt-get install balanzan-theme
root@me:~# apt-get install infinity-theme
root@me:~# apt-get install wild-shine-theme
root@me:~# apt-get install tropical-theme
root@me:~# apt-get install ubuntu-sunrise-theme
root@me:~# apt-get install aquadreams-theme

Step 4] How to activate/select theme.

Go to “System” –> “Preferences” –> “Appearance”  and select  your theme!!

** Enjoy

Thank you,
Arun Bagul

Good practices for apache & php

Good practices for apache & php

Introduction –

To conclude the discussion about session management, here are some best practices to demonstrate that a robust scheme requires serious thinking:
•    Create a session token upon first visit.
•    When performing authentication, destroy the old session and create a new one.
•    Limit session lifetime to a short period (a few hours).
•    Destroy inactive sessions regularly.
•    Destroy sessions after users log out.
•    Ask users to re-authenticate before an important task is performed (e.g., an order is placed).
•    Do not use the same session for a non-SSL part of the site as for the SSL part of the site because non-SSL traffic can be intercepted and the session token obtained from it. Treat them as two different servers.
•    If cookies are used to transport session tokens in an SSL application, they should be marked “secure.” Secure cookies are never sent over a non-SSL connection.
•    Regenerate session tokens from time to time.
•    Monitor client parameters (IP address, the User-Agent request header) and send warnings to the error log when they change. Some information (e.g., the contents of the User-Agent header) should not change for the lifetime of a session. Invalidate the session if it does.
•    If you know where your users are coming from, attach each session to a single IP address, and do not allow the address to change.
•    If you can, do not accept users coming through web proxies. This will be difficult to do for most public sites but easier for internal applications.
•    If you can, do not accept users coming through open web proxies. Open proxies are used when users want to stay anonymous or otherwise hide their tracks. You can detect which proxies are open by extracting the IP address of the proxy from each proxied request and having a script automatically test whether the proxy is open or not.
•    If you do allow web proxies, consider using Java applets or Flash movies (probably a better choice since such movies can pretend to be regular animations) to detect the users’ real IP addresses. It’s a long shot but may work in some cases.
•    Web users can upload only jpeg, gif, png files not php extension
•    We can place a blank index page in each directory in question and users can not execute php etc scripts from the image folders or image/document upload folders.
•    Upgrade apache current version (2.0) to newer version (2.2)

Thanks
Manoj Chauhan

How to configure multi master MySQL replication

How to configure multi master MySQL replication

Introduction ~

I was planning to write article on Multi Master MySQL replication since long time; Finally started now!. Please refer the the article on “How to configure MySQL replication with one Master” URL ~ http://www.indiangnu.org/2007/mysql-replication-one-master-multiple-slave/

* Let me inform you all that Multi Master replication in MySQL is purely based on following two variables. It has nothing to do with replication technology used in MySQL replication….

mysql> show variables  like  ‘%increment_%’;

+—————————————+——-+
| Variable_name                                   | Value |
+—————————————+——-+
| auto_increment_increment    |  1    |
| auto_increment_offset               |  1    |
+—————————————+—–+
2 rows in set (0.00 sec)

mysql>

** Requirements ~

a) Master Hosts (2 master in my case) ~

master-1 => 10.66.66.194
master-2 => 10.66.90.135
b) Replication Slave (1 slave) ~
slave => 10.66.75.137

c) MySQL server (with replication support)

** Let us understand how it works ?


* Master-1 Server =>

Set following variables…

mysql> set auto_increment_increment=5;
mysql> set auto_increment_offset=1;

mysql> show variables like ‘%increment_%’;
+————————–+——-+
| Variable_name            | Value |
+————————–+——-+
| auto_increment_increment | 2     |
| auto_increment_offset    | 1     |
+————————–+——-+
2 rows in set (0.00 sec)

mysql>

** Create Table ~

mysql> create table class ( rollno INT(5) NOT NULL PRIMARY KEY AUTO_INCREMENT , name VARCHAR(30) );

** Add Record now ~

mysql> INSERT INTO class VALUES (”,’Arun Bagul’);
mysql> INSERT INTO class VALUES (”,’Ravi Bhure’);
mysql> INSERT INTO class VALUES (”,’Karthik Appigita’);
mysql> INSERT INTO class VALUES (”,’Ameya Pandit’);

mysql> SELECT * FROM class;
+——–+——————+
| rollno | name             |
+——–+——————+
|      1 | Arun Bagul       |
|      3 | Ravi Bhure       |
|      5 | Karthik Appigita |
|      7 | Ameya Pandit     |
+——–+——————+
4 rows in set (0.00 sec)

mysql>

* Master-2 Server =>

Set following variables…

mysql> set auto_increment_increment=2;
mysql> set auto_increment_offset=2;

mysql> show variables like ‘%increment_%’;
+————————–+——-+
| Variable_name            | Value |
+————————–+——-+
| auto_increment_increment | 2     |
| auto_increment_offset    | 2     |
+————————–+——-+
2 rows in set (0.00 sec)

mysql>

** Create Table ~

mysql> create table class ( rollno INT(5) NOT NULL PRIMARY KEY AUTO_INCREMENT , name VARCHAR(30) );

** Add Record now ~

mysql> INSERT INTO class VALUES (”,’Nilkanth Parab’);
mysql> INSERT INTO class VALUES (”,’Nishit Shah’);
mysql> INSERT INTO class VALUES (”,’Ram Krishna’);
mysql> INSERT INTO class VALUES (”,’Suhail Thakur’);

mysql> SELECT * FROM class;
+——–+——————+
| rollno | name             |
+——–+——————+
|      2 | Nilkanth Parab   |
|      4 | Nishit Shah      |
|      6 | Ram Krishna      |
|      8 | Suhail Thakur    |
+——–+——————+
4 rows in set (0.00 sec)

mysql>

** What is the importance of “auto_increment_increment” and “auto_increment_offset” ~

mysql> desc class;
+——–+————-+——+—–+———+—————-+
| Field  | Type        | Null | Key | Default | Extra          |
+——–+————-+——+—–+———+—————-+
| rollno | int(5)      | NO   | PRI | NULL    | auto_increment |
| name   | varchar(30) | YES  |     | NULL    |                |
+——–+————-+——+—–+———+—————-+

auto_increment_offset => This is BASE value for column with “auto_increment” attribute (please refer the above example)
auto_increment_increment => This is the increment value for column with “auto_increment” attribute

** If you combine the both tables (master-1 and master-2) the final table will look like this ~

mysql> SELECT * FROM class;
+——–+——————+
| rollno | name             |
+——–+——————+
|      1 | Arun Bagul       |
|      2 | Nilkanth Parab   |
|      3 | Ravi Bhure       |
|      4 | Nishit Shah      |
|      5 | Karthik Appigita |
|      6 | Ram Krishna      |
|      7 | Ameya Pandit     |
|      8 | Suhail Thakur    |
+——–+——————+
8 rows in set (0.00 sec)

mysql>

** This is how Multi master replication works….

auto_increment_offset=Nth master server
auto_increment_increment=M

Where –
N => nth number of master server (on master-1 keep it 1 and on master-2 keep it 2 and so on..)
M => Total number of Master Server (2 in our case but better to keep this value high so that we can add new master server easily)

log-slave-updates => Slave server does not log to its own binary log any updates that are received from a Master server. This option tells the slave to log the updates performed by its SQL thread to its own binary log.

** Make sure that MySQL is running and up on all master servers and slave server-

How to setup Multi Master MySQL replication ? –

Step 1] Create Database/Tables on  Master  & Slave Servers –

You can create DB on all master & slave server or  create on one server and export that DB on  rest of all servers…

Master-1 => Create DB and Table

mysql> create database student;

mysql> use student;

mysql> create table class ( rollno INT(5) NOT NULL PRIMARY KEY AUTO_INCREMENT , name VARCHAR(30) );

mysql> show tables;
+——————-+
| Tables_in_student |
+——————-+
| class             |
+——————-+
1 row in set (0.00 sec)

mysql> desc class;
+——–+————-+——+—–+———+—————-+
| Field  | Type        | Null | Key | Default         |      Extra          |
+——–+————-+——+—–+———+—————-+
| rollno | int(5)      | NO   | PRI | NULL    | auto_increment |
| name   | varchar(30) | YES  |     | NULL    |                |
+——–+————-+——+—–+———+—————-+
2 rows in set (0.00 sec)

mysql> SELECT * FROM class;
Empty set (0.00 sec)
mysql>

* Now take dump of “student” DB and export it on all master and Slave server…

[root@master-1~]# mysqldump -u root -p  -d student > /home/arunsb/student.sql

* SCP the dump file on master-2 and slave server ~
[root@master-1~]# scp /home/arunsb/student.sql arunsb@10.66.90.135:/tmp/student.sql
[root@master-1~]# scp /home/arunsb/student.sql arunsb@10.66.75.137:/tmp/student.sql

Login on master-2 and slave ~

mysql> create database student;

[root@master-2~]# mysql -u root -p student < /tmp/student.sql
Enter password:
[root@master-2~]#

[root@master-2~]# mysql -u root -p
Enter password:

mysql> use student

mysql> SELECT * FROM class;
Empty set (0.00 sec)
mysql>

** Please repeat the same steps on Slave server as well…

Step 2] Update “my.cnf” config file on master-1,master-2 and slave server –

[root@master-1~]# cat /etc/my.cnf

###########################
##MySQL replication setting

#Master setting(1)
server-id = 1
log-bin = /var/log/mysql/binary/mysql-bin.log
binlog-do-db = student
binlog-ignore-db = mysql
log = /var/log/mysql/mysql.log
auto_increment_offset=1
auto_increment_increment=5
log-slave-updates

##slave setting
master-port=3306
master-host=10.66.90.135
master-user=replication
master-password=mypwd
master-connect-retry=60
replicate-do-db=student
###########################

[root@master-1~]#

[root@master-2~]# cat /etc/mysql/my.cnf

###########################
##MySQL replication setting

#Master setting(2)
server-id = 2
log-bin = /var/log/mysql/binary/mysql-bin.log
binlog-do-db=student
binlog-ignore-db = mysql
log = /var/log/mysql/mysql.log
auto_increment_offset=2
auto_increment_increment=5
log-slave-updates

##slave setting
master-port=3306
master-host=10.66.66.194
master-user=replication
master-password=mypwd
master-connect-retry=60
replicate-do-db=student
###########################

[root@master-2~]#

* please create directory for binary log and set permission…

[root@master-1~]# mkdir -p /var/log/mysql/binary/
[root@master-1~]# chown mysql:adm  /var/log/mysql/ /var/log/mysql/binary/

[root@master-2~]# mkdir -p /var/log/mysql/binary/
[root@master-2~]# chown mysql:adm  /var/log/mysql/ /var/log/mysql/binary/

** MySQL Replication Slave ~

[root@slave~]# cat  /etc/my.cnf

[mysqld]

########################################
##slave setting
server-id=4
master-port=3306
master-host=10.66.90.135
master-user=replication
master-password=mypwd
master-connect-retry=60
replicate-do-db=student
########################################

[root@slave~]#


Step 3] Give Replication permission on both masters ~


** Master (1 & 2) ~

mysql> GRANT REPLICATION SLAVE ON *.* TO ‘replication’@’10.66.%.%’ IDENTIFIED BY ‘mypwd’;
Query OK, 0 rows affected (0.00 sec)

mysql>

Step 4] Restart MySQL on both master as well as replication slave server ~

** Please verify setting on master-1 and master-2 server…

* Master-1

mysql> show variables like ‘%increment_%’;
+————————–+——-+
| Variable_name            | Value |
+————————–+——-+
| auto_increment_increment | 5     |
| auto_increment_offset    | 1     |
+————————–+——-+
2 rows in set (0.00 sec)

* Master-2

mysql> show variables like ‘%increment_%’;
+————————–+——-+
| Variable_name            | Value |
+————————–+——-+
| auto_increment_increment | 5     |
| auto_increment_offset    | 2     |
+————————–+——-+
2 rows in set (0.00 sec)

** Please verify ‘master’ & ‘slave’ status on both masters(1 & 2) and slave –

mysql> show master status;
mysql> show slave status;

** Multi Master replication is started…

Step 5] Add few records on Master-1 & Master-2 server at same time ~

Add records on both master server at same time and check master and replication slave status as shown above….

** Add following on master-1

mysql> INSERT INTO class VALUES (”,’Arun Bagul’);
mysql> INSERT INTO class VALUES (”,’Ravi Bhure’);
mysql> INSERT INTO class VALUES (”,’Karthik Appigita’);
mysql> INSERT INTO class VALUES (”,’Ameya Pandit’);

** Add following on master-2

mysql> INSERT INTO class VALUES (”,’Nilkanth Parab’);
mysql> INSERT INTO class VALUES (”,’Nishit Shah’);
mysql> INSERT INTO class VALUES (”,’Ram Krishna’);
mysql> INSERT INTO class VALUES (”,’Suhail Thakur’);

** Please verify the numbers of records on both masters and slave….

mysql> SELECT * FROM class;
+——–+——————+
| rollno | name             |
+——–+——————+
|      1 | Arun Bagul       |
|      2 | Nilkanth Parab   |
|      6 | Ravi Bhure       |
|     11 | Karthik Appigita |
|     16 | Ameya Pandit     |
|     17 | Nishit Shah      |
|     22 | Ram Krishna      |
|     27 | Suhail Thakur    |
+——–+——————+
8 rows in set (0.00 sec)

mysql>

* So we all learned to configure multi-master MySQL replication. Enjoy!!

Regards,
Arun Bagul

Multi User Conferencing (MU-Conference) for Jabber (Jabberd2)

Multi User Conferencing (MU-Conference) for Jabber (Jabberd2)

Introduction ~

Please refer the following article to install/configure Jabberd2…

http://www.indiangnu.org/2009/how-to-configure-jabber-jabberd2-with-mysqlpam-as-auth-database/

Requirement ~

*  Following packages are require to compile MU-Conference

root@laptop:~# apt-get install  libglib2.0-0  libglib2.0-dev
root@laptop:~# apt-get install  libidn11  libidn11-dev
root@laptop:~# apt-get install  expat  lib64expat1  lib64expat1-dev libexpat1-dev  liblua5.1-expat-dev  liblua5.1-expat0

Step 1] How compile “MU-Conference” –

* Download “MU-Conference” from following URL – https://gna.org/projects/mu-conference/

root@laptop:/var/src# wget -c http://download.gna.org/mu-conference/mu-conference_0.8.tar.gz
root@laptop:/var/src# tar xvfz mu-conference_0.8.tar.gz
root@laptop:/var/src# cd mu-conference_0.8/
root@laptop:/var/src/mu-conference_0.8#

* compile MU-Conference

root@laptop:/var/src/mu-conference_0.8# make
cd src/ ; make
make[1]: Entering directory `/var/src/mu-conference_0.8/src’
cd jabberd ; make
make[2]: Entering directory `/var/src/mu-conference_0.8/src/jabberd’

…..

root@laptop:/var/src/mu-conference_0.8# echo $?
0
root@laptop:/var/src/mu-conference_0.8#

Step 2] Configure MU-Conference –

* Now copy the “MU-Conference” binary to Jabberd2 installation directory –

root@laptop:~# cp /var/src/mu-conference_0.8/src/mu-conference  /usr/local/jabberd-2.2.9/bin/
root@laptop:~# chown jabber:jabber /usr/local/jabberd-2.2.9/bin/mu-conference
root@laptop:~# ls -l /usr/local/jabberd-2.2.9/bin/mu-conference
-rwxr-xr-x 1 jabber jabber 191904 2009-10-12 18:59 /usr/local/jabberd-2.2.9/bin/mu-conference
root@laptop:~#

root@laptop:~# /usr/local/jabberd-2.2.9/bin/mu-conference –help
Jabber Component Runtime — 0.2.4
(c) 2003-2004 Paul Curtis

/usr/local/jabberd-2.2.9/bin/mu-conference: invalid option — ‘-‘
Usage: mu-conference [-B] [-s] [-h] [-d LEVEL] -c FILE
-B         Put the daemon in background
-s         Show debug messages on stderr
-h         Print this help
-d LEVEL   Set the level of debug output
-c FILE    Set the config file, mandatory argument
root@laptop:~#

* Create spool directory for “MU-Conference”. The mu-conference component requires a spool directory to in which to store conference room information.

root@laptop:~# mkdir /usr/local/jabberd-2.2.9/var/spool
root@laptop:~# chown jabber:jabber /usr/local/jabberd-2.2.9/var/spool

NOTE ~  “jabber:jabber” user/group name of Jabberd2 server.

* Copy the config file of “MU-Conference” to Jabberd2  installation directory and edit the setting –

root@laptop:~# cp /var/src/mu-conference_0.8/muc-default.xml  /usr/local/jabberd-2.2.9/etc/mu-conference.xml
root@laptop:~# chown jabber:jabber /usr/local/jabberd-2.2.9/etc/mu-conference.xml
root@laptop:~#

root@laptop:~# vi /usr/local/jabberd-2.2.9/etc/mu-conference.xml

<name>conf.laptop.ubuntu.me</name>
<host>conf.laptop.ubuntu.me</host>
<ip>localhost</ip>
<port>5347</port>
<secret>secret</secret>

<spool>/usr/local/jabberd-2.2.9/var/spool</spool>
<logdir>/usr/local/jabberd-2.2.9/var/log</logdir>
<pidfile>/usr/local/jabberd-2.2.9/var/run/mu-conference.pid</pidfile>


<loglevel>255</loglevel>

<sadmin>
<user>admin@laptop.ubuntu.me</user>
</sadmin>


…..
root@laptop:~#


* Now restart the Jabberd2 server and then  start “MU-Conference”…

root@laptop:~# su -l jabber -s /bin/bash -c “/usr/local/jabberd-2.2.9/bin/mu-conference  -B -c /usr/local/jabberd-2.2.9/etc/mu-conference.xml”
root@laptop:~#

* Please check above article, init startup script ie ‘/etc/init.d/jabberd2’ will start mu-conference.

root@laptop:~# tail -f /usr/local/jabberd-2.2.9/var/log/mu-conference.log
Mon Oct 12 19:19:40 2009 main.c:168 (main): Jabber Component Runtime — 0.2.4  starting.
Mon Oct 12 19:19:40 2009 MU-Conference: [conference.c:1076 (conference)] mu-conference loading  – Service ID: conf.laptop.ubuntu.me

Mon Oct 12 19:19:40 2009 MU-Conference: [conference.c:1157 (conference)] Adding sadmin admin@laptop.ubuntu.me
Mon Oct 12 19:19:40 2009 MU-Conference: [xdb.c:319 (xdb_rooms_get)] asked to get rooms from xdb
Mon Oct 12 19:19:40 2009 MU-Conference: [xdb.c:418 (xdb_rooms_get)] skipping .. no results
Mon Oct 12 19:19:40 2009 main.c:219 (main): Main loop starting.
Mon Oct 12 19:19:40 2009 jcr_base_connect.c:34 (jcr_socket_connect): Attempting connection to localhost:5347
Mon Oct 12 19:19:40 2009 jcr_base_connect.c:87 (jcr_send_start_stream): Opening XML stream: sent 173 bytes
Mon Oct 12 19:19:40 2009 jcr_main_stream_error.c:50 (jcr_main_new_stream): Server stream connected.
Mon Oct 12 19:19:40 2009 jcr_deliver.c:51 (jcr_queue_deliver): packet delivery thread starting.

done!!

Step 3] Test “MU-Conference” –

* In “PSI” IM client , goto ‘General’ menu and then click on ‘Service Discovery’ and check the room list…
* In “Pidgin” IM client, goto ‘Tools’ and then click on ‘Room List’ section.

Once you detected the ‘mu-conference’ server. Please click on  ‘+ Add Chat’ from ‘Buddies’ menu of pidgin. In case of PSI click on ‘Join Groupchat’ from ‘General’ menu to add “Conference/Room” and then join the ‘Confernece Room’.

Enjoy,
Arun Bagul

How to configure Jabber (jabberd2) with MySQL,PAM as auth database

How to configure Jabber (jabberd2) with MySQL,PAM as auth database

Introduction –

Jabberd2 is XMPP protocol based Instants Messaging (IM) server. Jabberd2 is highly scalable,high performance jabber server. The beauty of the Jabberd2 architecture lies in the fact that its component architecture distributes services across six components, each of which communicates over TCP/IP.

1) Router – is the backbone of Jabber server. It accepts connections from Jabberd components and passes XML packets between components
2) Server to Server (S2S) – component handles communications with external servers. S2S passes packets between other components and external servers, and it performs dial-back to authenticate remote Jabber servers.

3) Resolver  – acts in support of the S2S component. It resolves hostnames for S2S as part of dialback authentication.
4) Session Manager (SM)  – component implements instant messaging features like message passing,presence,roster and subscription etc. + DB connection
5) Client to Server (C2S) – component handles communication with Jabber clients like connection,passing packets to SM, authenticate and register users.
6) Jabber core  – logging and third party plugin communication.

** To compile/install Jabberd-2.2.9 we need following packages on Debian/Ubuntu (similar on Redhat/Fedora or other OS)

libpam0g  libpam0g-dev (PAM support)
openssl libssl-dev (TLS/SSL support)
libudns0 libudns-dev (DNS Resolver Library)
libidn11  libidn11-dev libnet-libidn-perl (libidn provides necessary string manipulation functionality for Jabberd2)
mysql-common libdbd-mysql-perl  mysql-server-5.1  mysql-client-5.1 libmysqlclient16-dev (MySQL DB authentication)

**  Jabberd2 supports five authentication (user) mechanism –

* PAM
* MySQL Database
* Berkeley DB
* PostgreSQL Database
* SQLite DB
* OpenLDAP

** Following ports are used by jabberd2 –
* port 5222 – non-SSL client connection
* port 5223 – SSL client connection
* port 5269 – server to server connection
* port 5347 – jabberd2 router

Step 1] Create system User and Group for Jabberd 2  Server (http://codex.xiaoka.com/wiki/jabberd2:start) –

root@laptop:~# addgroup  –system  jabber
Adding group `jabber’ (GID 61) …
Done.
root@laptop:~#

root@laptop:~# adduser  –system  –home /usr/local/jabberd-2.2.9/ –shell /bin/false  –gid 61 jabber

* Verify system User and Group…  (steps for Ubuntu)

root@laptop:~# id jabber
uid=125(jabber) gid=61(jabber) groups=61(jabber)
root@laptop:~#

Step 2] Download the latest version of  Jabberd2 –

* Extract the source then compile/install it as shown below with PAM/MYSQL DB for authentication with SSL

root@laptop:/var/src/# wget -c http://codex.xiaoka.com/pub/jabberd2/releases/jabberd-2.2.9.tar.bz2

root@laptop:/var/src# tar xvfj  jabberd-2.2.9.tar.bz2

root@laptop:/var/src# cd jabberd-2.2.9

root@laptop:/var/src/jabberd-2.2.9# ./configure –prefix=/usr/local/jabberd-2.2.9/ –enable-debug  –enable-mysql  –enable-ssl –enable-pam  –enable-ssl

…..
checking for Libidn version >= 0.3.0… yes
checking for dns_init in -ludns… yes
checking gsasl.h usability… yes
checking gsasl.h presence… yes
checking for gsasl.h… yes
checking for gsasl_check_version in -lgsasl… yes
checking for GnuSASL version >= 0.2.27… no
configure: error: no SASL backend available out of: gsasl

root@laptop:/var/src/jabberd-2.2.9#

Step 3] Facing problem  like “configure: error: no SASL backend available out of: gsasl” ~

Don’t worry download latest version of gsasl library from URL ~ http://alpha.gnu.org/gnu/gsasl/

* Download latest version of GNU SASL (gsasl)

root@laptop:/var/src/# wget -c  http://alpha.gnu.org/gnu/gsasl/gsasl-0.2.29.tar.gz

* Extract the source then compile/install it …

root@laptop:/var/src# tar xvfz  gsasl-0.2.29.tar.gz
root@laptop:/var/src# cd gsasl-0.2.29/
root@laptop:/var/src/gsasl-0.2.29# ./configure –prefix=/usr/local/gsasl/
root@laptop:/var/src/gsasl-0.2.29# make
root@laptop:/var/src/gsasl-0.2.29# make  install
root@laptop:/var/src/gsasl-0.2.29#

* Verify the “gsasl” version

root@laptop:/var/src/gsasl-0.2.29# /usr/local/gsasl/bin/gsasl –version
gsasl (GNU SASL) 0.2.29

Copyright (C) 2008 Simon Josefsson.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Simon Josefsson.
root@laptop:/var/src/gsasl-0.2.29#

Step 4]  Go back to Jabberd2  source and start compiling/installing as shown in below –

root@laptop:/var/src/jabberd-2.2.9# ./configure –prefix=/usr/local/jabberd-2.2.9/  –enable-debug  –enable-mysql  –enable-ssl –enable-pam  –enable-ssl  –with-extra-include-path=/usr/local/gsasl/include/ –with-extra-library-path=/usr/local/gsasl/lib/
root@laptop:/var/src/jabberd-2.2.9# make
root@laptop:/var/src/jabberd-2.2.9# make install

**  Create log and runtime directories ~

root@laptop:/usr/local/jabberd-2.2.9# mkdir /usr/local/jabberd-2.2.9/var
root@laptop:/usr/local/jabberd-2.2.9# mkdir /usr/local/jabberd-2.2.9/var/run

root@laptop:/usr/local/jabberd-2.2.9# ls -l
total 20
drwxr-xr-x 2 jabber jabber 4096 2009-10-11 18:21 bin
drwxr-xr-x 3 jabber jabber 4096 2009-10-11 18:21 etc
drwxr-xr-x 3 jabber jabber 4096 2009-10-11 18:21 lib
drwxr-xr-x 3 jabber jabber 4096 2009-10-11 18:21 share
drwxr-xr-x 3 jabber jabber 4096 2009-10-11 18:42 var
root@laptop:/usr/local/jabberd-2.2.9#

Step 5] Configure jabberd-2.2.9 ~

* Setup (jabberid@laptop.ubuntu.me) Domain Name (hostname of server),IP address,port and log setting in client (c2s.xml) & server (sm.xml) configuration file –

NOTE ~ Domain Name not necessary to be hostname of server. But it should be resolvable (DNS) to one of the IP of server.

root@laptop:/usr/local/jabberd-2.2.9# hostname
laptop.ubuntu.me
root@laptop:/usr/local/jabberd-2.2.9#

root@laptop:/usr/local/jabberd-2.2.9# vi /usr/local/jabberd-2.2.9/etc/sm.xml

<pidfile>/usr/local/jabberd-2.2.9/var/run/sm.pid</pidfile>

<id>laptop.ubuntu.me</id>

<ip>0.0.0.0</ip>            <!– default: 127.0.0.1 –>
<port>5347</port>             <!– default: 5347 –>

<log type=’file’>
<file>/usr/local/jabberd-2.2.9/var/log/sm.log</file>

root@laptop:/usr/local/jabberd-2.2.9# vi /usr/local/jabberd-2.2.9/etc/c2s.xml

<pidfile>/usr/local/jabberd-2.2.9/var/run/c2s.pid</pidfile>

** To auto enable registration (in c2s.xml file ‘register-enable=’true’ is required)
<id register-enable=’true’>laptop.ubuntu.me</id>

<ip>0.0.0.0</ip>
<port>5222</port>

<log type=’file’>
<file>/usr/local/jabberd-2.2.9/var/log/c2s.log</file>

root@laptop:/usr/local/jabberd-2.2.9# vi /usr/local/jabberd-2.2.9/etc/s2s.xml

<pidfile>/usr/local/jabberd-2.2.9/var/run/s2s.pid</pidfile>
<log type=’file’>
<file>/usr/local/jabberd-2.2.9/var/log/s2s.log</file>

Step 6 ] Configure Jabberd-2.2.9 for Storage and Authentication 9using MySQL DB) –

* Make sure that database “Jabberd2” doesn’t exist (if exist either drop db or change DB name in db-setup.mysql file). If not export MySQL DB dump from Jabberd2 source…..

root@laptop:/usr/local/jabberd-2.2.9# mysql -u root -p  <  /var/src/jabberd-2.2.9/tools/db-setup.mysql
Enter password:
root@laptop:/usr/local/jabberd-2.2.9# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 176
Server version: 5.1.31-1ubuntu2 (Ubuntu)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> show databases;
+———————————-+
| Database                         |
+———————————-+
| information_schema                |
| jabberd2                                    |
| mysql                                             |
+———————————-+
3 rows in set (0.00 sec)

mysql> use jabberd2;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+——————–+
| Tables_in_jabberd2 |
+——————–+
| active             |
| authreg            |
| disco-items        |
| logout             |
| motd-message       |
| motd-times         |
| privacy-default    |
| privacy-items      |
| private            |
| queue              |
| roster-groups      |
| roster-items       |
| status             |
| vacation-settings  |
| vcard              |
+——————–+
15 rows in set (0.00 sec)

mysql>

*  Creating mysql user for jabberd2 ie ‘jabberd2’ with access to DB “jabberd2” –

mysql> GRANT select,insert,delete,update ON jabberd2.* to ‘jabber’@’localhost’ IDENTIFIED by ‘mypassword’;
Query OK, 0 rows affected (0.00 sec)

mysql>quit
Bye
root@laptop:/usr/local/jabberd-2.2.9#

* Now verify access to DB ~

root@laptop:/usr/local/jabberd-2.2.9# mysql -u jabberd2 -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 178
Server version: 5.1.31-1ubuntu2 (Ubuntu)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| jabberd2           |
+——————–+
2 rows in set (0.00 sec)

mysql> quit
Bye
root@laptop:/usr/local/jabberd-2.2.9#

Step 7] Change c2s.xml and sm.xml config file for MySQL DB support –

root@laptop:/usr/local/jabberd-2.2.9# vi /usr/local/jabberd-2.2.9/etc/c2s.xml

<!– Authentication/registration database configuration –>
<authreg>

<!– Backend module to use –>
<module>mysql</module>

<!– MySQL module configuration –>
<mysql>
<!– Database server host and port –>
<host>localhost</host>
<port>3306</port>

<!– Database name –>
<dbname>jabberd2</dbname>
<!– Database username and password –>
<user>jabberd2</user>
<pass>mypassword</pass>

root@laptop:/usr/local/jabberd-2.2.9# vi /usr/local/jabberd-2.2.9/etc/sm.xml

<!– Storage database configuration –>
<storage>
<!– Dynamic storage modules path –>
<path>/usr/local/jabberd-2.2.9/lib/jabberd</path>

<!– By default, we use the SQLite driver for all storage –>
<driver>mysql</driver>

<!– MySQL driver configuration –>
<mysql>
<!– Database server host and port –>
<host>localhost</host>
<port>3306</port>

<!– Database name –>
<dbname>jabberd2</dbname>
<!– Database username and password –>
<user>jabberd2</user>
<pass>mypassword</pass>

** To auto enable registration (in sm.xml file)

<auto-create/>

———————————-

NOTE ~ It is not enough to add users to the ‘authreg’ table because this only introduces users to the c2s component, but not to the sm component. Correct entries are required in the ‘active’ table as well. It is best to use a Jabber client to register users.

Step 8] Let’s start Jabberd-2 server (Test configuration) –

root@laptop:~# su -l jabber -s /bin/bash -c “/usr/local/jabberd-2.2.9/bin/jabberd -b”
root@laptop:~#

* check whether ports are open or not

root@laptop:~# netstat -nlp

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:5347            0.0.0.0:*               LISTEN      31662/router
tcp        0      0 0.0.0.0:5222            0.0.0.0:*               LISTEN      13883/c2s
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      2892/mysqld
tcp        0      0 0.0.0.0:5269            0.0.0.0:*               LISTEN      13886/s2s

…..

root@laptop:~#

** Now Register the user “jabberd@laptop.ubuntu.me” and password “secret” using Jabber IM client

root@laptop:/usr/local/jabberd-2.2.9# tail -f var/log/c2s.log

Mon Oct 12 00:43:15 2009 [notice] [8] registration succeeded, requesting user creation: jid=jabberd@laptop.ubuntu.me
Mon Oct 12 00:43:15 2009 [notice] [8] SASL authentication succeeded: mechanism=DIGEST-MD5; authzid=jabberd@laptop.ubuntu.me
Mon Oct 12 00:43:15 2009 [notice] [8] bound: jid=jabberd@laptop.ubuntu.me/Telepathy
Mon Oct 12 00:44:20 2009 [notice] [9] [192.168.0.1, port=48307] connect

* Checking DB entry –

mysql> SELECT * FROM  active;
+————————–+—————–+————+
| collection-owner         | object-sequence | time       |
+————————–+—————–+————+
| jabberd@laptop.ubuntu.me |               1 | 1255288395 |
+————————–+—————–+————+
1 row in set (0.00 sec)

mysql> SELECT * FROM  authreg;
+———-+——————+———-+
| username | realm            | password |
+———-+——————+———-+
| jabberd  | laptop.ubuntu.me | secret   |
+———-+——————+———-+
1 row in set (0.00 sec)

mysql>

=> Testing completed successfully….

Step 9] Configuring Jabberd2 for SSL/TLS Connections –

Let’s configure jabberd2 for SSL/TLS connection. Jabberd2 is designed to provide for SSL/TLS connections not only between Jabber clients and the server, but also between the Jabberd server components (sm, s2s and c2s) and the Jabberd router. A single SSL certificate may be used for these two functions (Jabber client to Jabberd and Jabberd component to router), or two separate keys may be used.

* Generate Self signed SSL Certificate…

root@laptop:/usr/local/jabberd-2.2.9# openssl req -new -x509 -newkey rsa:1024 -days 365 -keyout privkey.pem -out server.pem
Generating a 1024 bit RSA private key
.++++++
…..++++++
writing new private key to ‘privkey.pem’
Enter PEM pass phrase:
….
Common Name (eg, YOUR name) []:laptop.ubuntu.me
root@laptop:/usr/local/jabberd-2.2.9#

* Remove Passphrase from private key

root@laptop:/usr/local/jabberd-2.2.9# openssl rsa -in privkey.pem -out privkey.pem

** Combine the Private and Public Key and delete private key

root@laptop:/usr/local/jabberd-2.2.9# cat privkey.pem >> server.pem

root@laptop:/usr/local/jabberd-2.2.9# rm privkey.pem

* Change permission…

root@laptop:/usr/local/jabberd-2.2.9# chown jabber:jabber /usr/local/jabberd-2.2.9/server.pem
root@laptop:/usr/local/jabberd-2.2.9# ls  -l   /usr/local/jabberd-2.2.9
total 24
drwxr-xr-x 2 jabber jabber 4096 2009-10-11 22:17 bin
drwxr-xr-x 3 jabber jabber 4096 2009-10-12 01:03 etc
drwxr-xr-x 3 jabber jabber 4096 2009-10-11 20:16 lib
-rw-r–r– 1 jabber jabber 2217 2009-10-12 01:17 server.pem
drwxr-xr-x 3 jabber jabber 4096 2009-10-11 20:16 share
drwxr-xr-x 4 jabber jabber 4096 2009-10-12 00:20 var
root@laptop:/usr/local/jabberd-2.2.9#

root@laptop:/usr/local/jabberd-2.2.9# vi /usr/local/jabberd-2.2.9/etc/c2s.xml
<ssl-port>5223</ssl-port>
<pemfile>/usr/local/jabberd-2.2.9/server.pem</pemfile>

root@laptop:/usr/local/jabberd-2.2.9# vi /usr/local/jabberd-2.2.9/etc/s2s.xml

<pemfile>/usr/local/jabberd-2.2.9/server.pem</pemfile>

root@laptop:/usr/local/jabberd-2.2.9# vi /usr/local/jabberd-2.2.9/etc/sm.xml

<pemfile>/usr/local/jabberd-2.2.9/server.pem</pemfile>

<pemfile>/usr/local/jabberd-2.2.9/server.pem</pemfile>

** Now restart the server and check log …

root@laptop:/usr/local/jabberd-2.2.9# tail -f var/log/c2s.log

Mon Oct 12 01:28:57 2009 [notice] connection to router established
Mon Oct 12 01:28:57 2009 [notice] [0.0.0.0, port=5222] listening for connections
Mon Oct 12 01:28:57 2009 [notice] [0.0.0.0, port=5223] listening for SSL connections

* While registering user ~

1) Required SSL/TLS
2) Force old SSL (5223 port)

Please enable above two setting and uncheck “Allow plaintext auth unecrypted streams”

NOTE ~ While login first time (auto registration mode) make sure to check “Create this new account on the server” checkbox in pidgin (bottom)

** It works !!

Step 10] Init.d startup script for Jabberd2 and Mu-Conference –

root@laptop:~# /etc/init.d/jabberd2 start
Starting the Jabberd2 IM Server…
router 11095 | sm 11099 | s2s 11102 | c2s 11106 |mu-conf 11149

Done.
root@laptop:~# /etc/init.d/jabberd2 status
Jabberd2 IM Server status –
router – 11095 | sm – 11099 | s2s – 11102 | c2s – 11106 | mu-conf 11149
root@laptop:~#

* Now check network setting…

root@laptop:~# netstat -nlp

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:5347            0.0.0.0:*               LISTEN      11095/router
tcp        0      0 0.0.0.0:5222            0.0.0.0:*               LISTEN      11106/c2s
tcp        0      0 0.0.0.0:5223            0.0.0.0:*               LISTEN      11106/c2s
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      2899/mysqld
tcp        0      0 0.0.0.0:5269            0.0.0.0:*               LISTEN      11102/s2s

root@laptop:~# /etc/init.d/jabberd2 stop
Stoping the Jabberd2 IM Server…
Done.
root@laptop:~#

** Want to see the script ~

root@laptop:~# cat /etc/init.d/jabberd2
#!/bin/bash

## Jabberd2 IM Server
## Jabber User/Group – jabber/jabber
## command to srart ~ su -l jabber -s /bin/bash -c “${BASE_PATH}/bin/jabberd -b”
##
#c2s
BASE_PATH=”/usr/local/jabberd-2.2.9″
c2s_pid=”${BASE_PATH}/var/run/c2s.pid”
#s2s
s2s_pid=”${BASE_PATH}/var/run/s2s.pid”
#sm
sm_pid=”${BASE_PATH}/var/run/sm.pid”
#router
router_pid=”${BASE_PATH}/var/run/router.pid”
#Mu-Conference
mu_conf_pid=”${BASE_PATH}/var/run/mu-conference.pid”

case “$1” in

start)
## checking whether Jabberd2 is running or not
if [ -f ${c2s_pid} ];then
c2spid=$(cat ${c2s_pid})
echo “Jabberd2 IM Server ~ ‘c2s’ is running (pid ${c2spid})”
elif [ -f ${s2s_pid} ];then
s2spid=$(cat ${s2s_pid})
echo “Jabberd2 IM Server ~ ‘s2s’ is running (pid ${s2spid})”
elif [ -f ${sm_pid} ];then
smpid=$(cat ${sm_pid})
echo “Jabberd2 IM Server ~ ‘sm’ is running (pid ${smpid})”
elif [ -f ${router_pid} ];then
routerpid=$(cat ${router_pid})
echo “Jabberd2 IM Server ~ ‘router’ is running (pid ${routerpid})”
else
echo “Starting the Jabberd2 IM Server…”
su -l jabber -s /bin/bash -c “${BASE_PATH}/bin/jabberd -b”
su -l jabber -s /bin/bash -c “${BASE_PATH}/bin/mu-conference  -B -c ${BASE_PATH}/etc/mu-conference.xml” > /dev/null 2>&1
echo “router $(cat ${router_pid}) | sm $(cat ${sm_pid}) | s2s $(cat ${s2s_pid}) | c2s $(cat ${c2s_pid}) |mu-conf $(cat ${mu_conf_pid})”
echo “…”
echo “Done.”
fi
;;

stop)
echo “Stoping the Jabberd2 IM Server…”
if [ -f ${sm_pid} ];then
kill -9 $(cat ${sm_pid})
fi
if [ -f ${router_pid} ];then
kill -9 $(cat ${router_pid})
fi
if [ -f ${c2s_pid} ];then
kill -9 $(cat ${c2s_pid}) > /dev/null 2>&1
fi
if [ -f ${s2s_pid} ];then
kill -9 $(cat ${s2s_pid}) $(cat ${mu_conf_pid})  > /dev/null 2>&1
fi
##
killall -9  -u jabber
rm -f ${router_pid} ${sm_pid} ${s2s_pid} ${c2s_pid} ${mu_conf_pid}  > /dev/null  2>&1
echo “Done.”
;;

status)
echo “Jabberd2 IM Server status -”
if [ -f ${c2s_pid} ];then
c2spid=$(cat ${c2s_pid})
fi
if [ -f ${s2s_pid} ];then
s2spid=$(cat ${s2s_pid})
fi
if [ -f ${sm_pid} ];then
smpid=$(cat ${sm_pid})
fi
if [ -f ${router_pid} ];then
routerpid=$(cat ${router_pid})
fi
if [ -f ${router_pid} ];then
mupid=$(cat ${mu_conf_pid})
fi
echo “router – ${routerpid} | sm – ${smpid} | s2s – ${s2spid} | c2s – ${c2spid} | mu-conf ${mupid}”
;;
*)
echo “Usage: $0 {start|stop|status}”
exit 1
esac
exit 0
#DONE
root@laptop:~#

Thank you,
Arun Bagul

How to install Network Driver in Linux system

How to install Network Driver in Linux system

Introduction –

“Attansic Technology Corp. L1 Gigabit Ethernet Adapte” network (NIC) card or Adapter was not detected by RHEL4 (redhat) system. I tried running kudzu and other commands to detect device, but no use. So finally I have to install drivers for my network card…

Step 1] Device status (network card) –

* See below device status from hardware conf file ~ “/etc/sysconfig/hwconf”
* Attansic Technology Corp. L1 Gigabit Ethernet Adapter  not detected – Unknown device 8226

03:00.0 Ethernet controller: Attansic Technology Corp. L1 Gigabit Ethernet Adapter (rev b0)
Subsystem: ASUSTeK Computer Inc.: Unknown device 8226
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR+ <PERR-
Latency: 0, Cache Line Size 10
Interrupt: pin A routed to IRQ 201

…..

[root@desktop ~]# lspci

03:00.0 Ethernet controller: Attansic Technology Corp. L1 Gigabit Ethernet Adapter (rev b0)

…..
[root@desktop ~]# lspci -n

03:00.0 Class 0200: 1969:1048 (rev b0)

…..
[root@desktop ~]#

* Make sure to download drivers for above  venderID & deviceId “1969:1048″….

Step 2] download and extract the source  –

First, download vendor* driver from here

ftp://ftp.hogchain.net/pub/linux/attansic/vendor_driver/l1-linux-v1.2.40.3.tar.gz

OR
open-source (http://atl1.sourceforge.net/)

[root@desktop ~]# tar xvfz l1-linux-v1.2.40.3.tar.gz

[root@desktop ~]# cd  l1-linux-v1.2.40.3

[root@desktop src]# ls
at_ethtool.c  at.h  at_hw.c  at_hw.h  at_main.c  at_osdep.h  at_param.c  kcompat.c  kcompat_ethtool.c  kcompat.h  Makefile
[root@desktop src]#

* Now compile and install the drivers

[root@desktop src]# make
make -C /lib/modules/2.6.9-78.ELsmp/build SUBDIRS=/root/l1-linux-v1.2.40.3/src modules
make[1]: Entering directory `/usr/src/kernels/2.6.9-78.EL-smp-i686′

…..
make[1]: Leaving directory `/usr/src/kernels/2.6.9-78.EL-smp-i686′
[root@desktop src]# echo $?
0

[root@desktop src]# make install
make -C /lib/modules/2.6.9-78.ELsmp/build SUBDIRS=/root/l1-linux-v1.2.40.3/src modules

…..
man -c -P’cat > /dev/null’ atl1 || true
[root@desktop src]# echo $?
0

* Now load the kernel module….

[root@desktop src]# modprobe   atl1

Step 3] Now verify whether kernel driver is working or not  –

[root@desktop src]# modinfo   atl1
filename:       /lib/modules/2.6.9-78.ELsmp/kernel/drivers/net/atl1/atl1.ko
author:         Atheros Corporation, <xiong.huang@atheros.com>
description:    Atheros 1000M Ethernet Network Driver
license:        GPL
version:        1.2.40.3 1FC4E58EBDF31F49BFD33E8
parm:           TxDescriptors:Number of transmit descriptors
parm:           RxDescriptors:Number of receive descriptors
parm:           MediaType:MediaType Select
parm:           IntModTimer:Interrupt Moderator Timer
parm:           FlashVendor:SPI Flash Vendor
vermagic:       2.6.9-78.ELsmp SMP 686 REGPARM 4KSTACKS gcc-3.4
depends:
alias:          pci:v00001969d00001048sv*sd*bc*sc*i*
[root@desktop src]#

[root@desktop src]# netconfig
[root@desktop src]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:AD:54:0A:XX:WW
inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
inet6 addr: fe80::223:54ff:fe0a:616b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b)  TX bytes:498 (498.0 b)
Memory:feac0000-feb00000

…..

[root@desktop src]#

[root@desktop ~]# vi /etc/sysconfig/hwconf

class: NETWORK
bus: PCI
detached: 0
device: eth0
driver: atl1
desc: “Attansic Technology Corp. L1 Gigabit Ethernet Adapter”
network.hwaddr: 00:AD:54:0A:XX:WW
vendorId: 1969
deviceId: 1048

subVendorId: 1043
subDeviceId: 8226
pciType: 1
pcidom:    0
pcibus:  3
pcidev:  0
pcifn:  0
[root@desktop ~]#

Enjoy,
Arun Bagul

How to configure TATA Indicom/BSNL/Reliance Broadband+ Netconnect ( EDVO usb modem ) on Ubuntu Linux

How to configure TATA Indicom/BSNL/Reliance Broadband+ Netconnect ( EDVO usb modem ) on Ubuntu Linux

Introduction ~

This article is about how to configure TATA Indicom,BSNL and Reliance Broadband+ Netconnect ( EDVO usb modem ) on Ubuntu Linux.

To configure Reliance,BSNL and Tataindicom epi valley usb modem please refer the following article ~

http://www.indiangnu.org/2008/tata-indicom-usb-modem-epi-valley-on-ubuntu-linux/

To configure Tataindicom,Reliance Huawei datacard refer the following article ~

http://www.indiangnu.org/2008/tata-indicom-datacard-huawei-cdma-on-linuxubuntu/

** EVDO ?

EVolution-Data Optimized (EVDO) is a telecommunications standard for the wireless transmission of data through radio signals, typically for broadband Internet access. It uses multiplexing techniques including code division multiple access (CDMA) as well as time division multiple access (TDMA)
to maximize both individual user’s throughput and the overall system throughput. It is standardized by (3G) 3rd Generation Partnership Project 2 (3GPP2) as part of the CDMA2000 family of standards and has been adopted by many mobile phone service providers around the world – particularly those previously employing CDMA networks.

How to configure Reliance Broadband+ Netconnect –

Step 1] Mount USB file system to “/proc/bus/usb” –

root@laptop:~# ls  /proc/bus/usb/
root@laptop:~#

* It shows that usbfs is not mounted on “/proc/bus/usb”. To mount run following command….

root@laptop:/var/src/usb_modeswitch-1.0.5# mount -t usbfs  none /proc/bus/usb
root@laptop:/var/src/usb_modeswitch-1.0.5# ls /proc/bus/usb/
001  002  003  004  005  006  007  devices
root@laptop:/var/src/usb_modeswitch-1.0.5#

Step 2] Get the status of Reliance Broadband+ USB device ~

* lsusb list USB devices connected to PC as well as information about USB buses in the system and the devices connected to them.

* Output before connecting Reliance Broadband+ Netconnect usb modem –

root@laptop:~# lsusb
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
…..
root@laptop:~#

* Let’s connect Reliance Broadband+ Netconnect! usb modem –

root@laptop:~# lsusb
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 004: ID 19d2:fff5
Bus 005 Device 003: ID 08ff:2580 AuthenTec, Inc. AES2501 Fingerprint Sensor
…..
root@laptop:~#

* Bus 005 Device 004: ID 19d2:fff5  – This shows that the Reliance (EVDO) usb device is detected with Vendor_id  19d2  and product_id fff5

root@laptop:~# cat /proc/bus/usb/devices

T:  Bus=07 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 23 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=19d2 ProdID=fff5 Rev= 0.00
S:  Manufacturer=ZTE, Incorporated
S:  Product=USB Storage
S:  SerialNumber=000000000002
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usbserial_generic
E:  Ad=89(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=0a(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

root@laptop:~# dmesg | tail
[15035.656075] usb 7-2: new full speed USB device using uhci_hcd and address 24
[15035.814188] usb 7-2: configuration #1 chosen from 1 choice
[15035.827708] scsi10 : SCSI emulation for USB Mass Storage devices
[15035.828851] usb-storage: device found at 24
[15035.828856] usb-storage: waiting for device to settle before scanning
[15040.831095] usb-storage: device scan complete
[15040.834105] scsi 10:0:0:0: Direct-Access     ZTE      USB Storage FFF1 2.31 PQ: 0 ANSI: 2
[15040.839233] sd 10:0:0:0: [sdb] Attached SCSI removable disk
[15040.839378] sd 10:0:0:0: Attached scsi generic sg2 type 0
root@laptop:~#

*** Reliance Broadband+ EVDO USB is detected as “USB storage device” as shown above…

Step 3] How to use Reliance Broadband+ Netconnect as USB Modem –

To use Reliance Broadband+ usb as USB Modem. We need to switch the usb mode of this device with the help of “usb_modeswitch” tool.

Download ~ http://www.draisberghof.de/usb_modeswitch/usb_modeswitch-1.0.5.tar.bz2

Help – http://www.draisberghof.de/usb_modeswitch/

* Download and extract the “usb_modeswitch” –

root@laptop:/var/src# wget -c  http://www.draisberghof.de/usb_modeswitch/usb_modeswitch-1.0.5.tar.bz2

root@laptop:/var/src# tar xvfj usb_modeswitch-1.0.5.tar.bz2

* Now compile and install –

root@laptop:/var/src/usb_modeswitch-1.0.5# gcc -l usb -o usb_modeswitch usb_modeswitch.c
root@laptop:/var/src/usb_modeswitch-1.0.5# make install
mkdir -p /usr/sbin
install ./usb_modeswitch /usr/sbin
mkdir -p /etc
install –mode=644 ./usb_modeswitch.conf /etc
root@laptop:/var/src/usb_modeswitch-1.0.5#

**** Now configure USB mode switching –

a) Edit configuration file “/etc/usb_modeswitch.conf” –

Just search for vendor and product id eg (19d2 and fff5) in config “/etc/usb_modeswitch.conf” file….
This file contains most of the details. I choose following setting and that work’s for me

root@laptop:~# cat  /etc/usb_modeswitch.conf

###################
# ZTE AC8710
#

DefaultVendor=  0x19d2
DefaultProduct= 0xfff5

TargetVendor=   0x19d2
TargetProduct=  0xfff1

MessageContent=”5553424312345678c00000008000069f030000000000000000000000000000″

root@laptop:~#

b) Now run “usb_modeswitch” command to switch the mode of USB device

root@laptop:~# usb_modeswitch -c /etc/usb_modeswitch.conf

Step 4] Load “usbserial” module

* Remember in Ubuntu 09.04 the “usbserial” is buildin kernel. To load that module we need to modify “grub.conf” or “menu.lst” GRUB config file

root@laptop:~# cat /boot/grub/menu.lst

title        Ubuntu 9.04, kernel 2.6.28-11-generic
uuid        c98db8a7-0a2e-4cea-b9d5-43a30c892fb0
kernel        /vmlinuz-2.6.28-11-generic root=/dev/sda5  ro quiet splash  usbserial.vendor=0x19d2  usbserial.product=0xfff1
initrd        /initrd.img-2.6.28-11-generic
quiet
….
……
root@laptop:~#

**** Reboot the machine and run the following command

* Output before switch….

root@laptop:~# lsusb
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 023: ID 19d2:fff5
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
…..
root@laptop:~#

root@laptop:~# usb_modeswitch -c /etc/usb_modeswitch.conf

* Output after switch….

root@laptop:~# lsusb
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 024: ID 19d2:fff1
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
…..
root@laptop:~#

root@laptop:~# usb_modeswitch  -v 19d2 -p fff1

Looking for default devices …
Found default devices (1)
Accessing device 004 on bus 005 …
Using endpoints 0x02 (out) and 0x82 (in)
Not a storage device, skipping SCSI inquiry

Device description data (identification)
————————-
Manufacturer: ZTE, Incorporated
Product: ZTE CDMA Tech
Serial No.: not provided
————————-
Warning: no switching method given.
-> Run lsusb to note any changes. Bye.

root@laptop:~#

root@laptop:~# cat /proc/bus/usb/devices

T:  Bus=07 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 24 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=19d2 ProdID=fff1 Rev= 0.00
S:  Manufacturer=ZTE, Incorporated
S:  Product=ZTE CDMA Tech

C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=128ms

root@laptop:~# dmesg  | tail
[   70.985075] usbserial_generic 5-1:1.1: generic converter detected
[   70.985109] usb 5-1: generic converter now attached to ttyUSB1
[   70.987028] usbserial_generic 5-1:1.2: generic converter detected
[   70.987064] usb 5-1: generic converter now attached to ttyUSB2
[   70.989589] usbserial_generic 5-1:1.3: generic converter detected
[   70.989623] usb 5-1: generic converter now attached to ttyUSB3
[   70.991023] usbserial_generic 5-1:1.4: generic converter detected
[   70.991061] usb 5-1: generic converter now attached to ttyUSB4
[   70.993066] usbserial_generic 5-1:1.5: generic converter detected
[   70.993109] usb 5-1: generic converter now attached to ttyUSB5
root@laptop:~#

*** It shows that Reliance Broadband+ EVDO usb  is detected as CDMA modem

Step 5] Configure wvdail –

* Run “wvdialconf” to detect and edit “/etc/wvdial.conf” confile

root@laptop:~# wvdialconf
Editing `/etc/wvdial.conf’.
Scanning your serial ports for a modem.
Modem Port Scan<*1>: S0   S1

root@laptop:~# cat /etc/wvdial.conf

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Password = your_mobile_no
Username = your_mobile_no
Phone = #777
PPPP Path = /usr/sbin/pppd
Modem Type = Analog Modem
Stupid Mode = 1
Tonline = 0
Baud = 9600
New PPPD = 1
Modem = /dev/ttyUSB0
ISDN = 0
root@laptop:~#

* Now it’s time to start surfing…..

root@laptop:~# wvdial &
[1] 21710
root@laptop:~#

root@laptop:~# ifconfig

ppp0 Link encap:Point-to-Point Protocol
inet addr:115.184.XX.BB  P-t-P:220.224.CC.DD  Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
RX packets:4310 errors:0 dropped:0 overruns:0 frame:0
TX packets:4347 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:2268618 (2.2 MB)  TX bytes:445276 (445.2 KB)

Enjoy,
Arun Bagul

How to disable core(s) of CPU

How to disable core(s) of CPU

Introduction ~

The question is why we  need to disable few core of CPU? Sometime it is necessary to run certain applications, which are not compatible with multi core processing.  Disabling core will not affect physically your hardware. Linux OS will simply ignore the core(s) you selected to disable.

Steps 1] How to do it?

Debian/Ubuntu ~

root@laptop:/home/arunsb# cat /boot/grub/menu.lst

title        Ubuntu 9.04, kernel 2.6.28-11-generic
kernel        /vmlinuz-2.6.28-11-generic root=UUID=55d33e45-75c7-54sc-b204-97b44e1d6a39 ro quiet splash maxcpus=1
initrd        /initrd.img-2.6.28-11-generic

Redhat/Fedora based system ~

root@laptop:/home/arunsb# cat /boot/grub/grub.conf

title Red Hat Enterprise Linux ES (2.6.9-78.ELsmp)
root (hd0,4)
kernel /boot/vmlinuz-2.6.9-78.ELsmp ro root=LABEL=/    maxcpus=1
initrd /boot/initrd-2.6.9-78.ELsmp.img

Note ~ after changing grub config file please reboot the system to apply changes!

As shown above “maxcpus=1” indicates that Linux will use only one CPU core. you can change this value as per your requirement and hardware available.

You can  also change this value during  starting of system from GRUB menu but it is temporary setting. To make it permanent you need to modify the  grub.conf (Redhat/Fedora) or menu.lst (debian/Ubuntu) GRUB config file.

Step 2] How to verify ~

I have dual core CPU as shown below and I have disable 1 core so After reboot I should get only one CPU core active

** Before above setting!

root@laptop:/home/arunsb# cat /proc/cpuinfo   | grep processor
processor    : 0
processor    : 1
root@laptop:/home/arunsb#

* Verify after above setting ~

root@laptop:/home/arunsb# cat /proc/cpuinfo   | grep processor
processor       : 0

root@laptop:/home/arunsb#

* How to Disable CPU without Reboot?
root@arunb:~# echo 0 > /sys/devices/system/cpu/cpu1/online

* Confirm ?
root@arunb:~# cat /proc/cpuinfo | grep -i ‘Processor’
processor : 0
root@arunb:~#

Thank you,
Arun Bagul

How to create edit/extract initrd in Ubuntu/Debian and Redhat/Fedora Linux ?

How to create edit/extract initrd in Ubuntu/Debian and Redhat/Fedora Linux ?

Introduction ~

Long back I edited initrd as  old linux (Ubuntu 6.06) box was not able to boot with SCSI hard disk? One of my friend wanted to do the same for other purpose. So got a chance to write article on the same? Let’s start with what is initrd?

What is initrd ?

initrd (Initial Ram Disk) is a temporary file system ( used as /) commonly used in the boot process of the Linux kernel. It is typically used for making preparations before the real root file system can be mounted.

Why someone want to edit/modify initrd ?

I assume that you all are familier with Linux booting process? Once Linux kernel loaded in to memory (RAM) it start init (father/mother of all  process) process. is that true? Let me ask you one question. Before loading actual physical root file system (/) how kernel access /sbin/init script? what is the use by specifying “initrd” file in GRUB ?  hold on!!

Suppose your root partion resides on some SCSI device and driver for this SCSI devices is compiled as a kernel module. Of course this module is required at boot time to have access to the root partion — but it is not in the kernel. Thus the need for an initrd image. Additionally after udev subsystem become common, somebody has to start udev to create device nodes. This is initrd’s duty too.

See the GRUB menu as shown below ~

title        Ubuntu 9.04, kernel 2.6.28-11-generic
kernel        /vmlinuz-2.6.28-11-generic root=/dev/sda3  ro quiet splash
initrd        /initrd.img-2.6.28-11-generic

GRUB loads  kernel and initrd image in to memory(RAM). When kernel boots  it checks for initrd image, and if it exists starts init script that resides on this image. init script is usually written in bash. When init script on initrd image is finished, kernel usually start standard init process ie /sbin/init

Step 1] Copy original initrd image file to temp location  ~

** Create temporary directory and copy initrd file in that temp directory

arunsb@laptop:~$ cp /boot/initrd.img-2.6.28-11-generic  /tmp/

arunsb@laptop:~$ mkdir /tmp/initrd-src

** Now extract “initrd” image –

arunsb@laptop:~$ cd /tmp/initrd-src

arunsb@laptop:/tmp/initrd-src$ gzip -dc  /tmp/initrd.img-2.6.28-11-generic  | cpio -id
38791 blocks
arunsb@laptop:/tmp/initrd-src$ ls -l
total 36
drwxr-xr-x 2 arunsb arunsb 4096 2009-07-12 16:32 bin
drwxr-xr-x 3 arunsb arunsb 4096 2009-07-12 16:32 conf
drwxr-xr-x 6 arunsb arunsb 4096 2009-07-12 16:32 etc
-rwxr-xr-x 1 arunsb arunsb 4825 2009-07-12 16:32 init
drwxr-xr-x 5 arunsb arunsb 4096 2009-07-12 16:32 lib
drwxr-xr-x 2 arunsb arunsb 4096 2009-07-12 16:32 sbin
drwxr-xr-x 8 arunsb arunsb 4096 2009-07-12 16:32 scripts
drwxr-xr-x 3 arunsb arunsb 4096 2009-07-12 16:32 usr
arunsb@laptop:/tmp/initrd-src$

** Check how “init” looks like ~

arunsb@laptop:/tmp/initrd-src$ head init
#!/bin/sh

echo “Loading, please wait…”

[ -d /dev ] || mkdir -m 0755 /dev
[ -d /root ] || mkdir -m 0700 /root
[ -d /sys ] || mkdir /sys
[ -d /proc ] || mkdir /proc
[ -d /tmp ] || mkdir /tmp
mkdir -p /var/lock
arunsb@laptop:/tmp/initrd-src$

Step 2] Edit/Modify as per your requirement

Step 3] How to create initrd image  ~

Create initrd image from scratch –

root@laptop:/home/arunsb# mkinitramfs  -v -o  /tmp/initrd-arun-$(uname -r)

root@laptop:/home/arunsb# ls -l /tmp/initrd-arun-2.6.28-11-generic
-rw-r–r– 1 root root 7536506 2009-07-12 17:11 /tmp/initrd-arun-2.6.28-11-generic

root@laptop:/home/arunsb# du -sh /tmp/initrd-arun-2.6.28-11-generic
7.2M    /tmp/initrd-arun-2.6.28-11-generic
root@laptop:/home/arunsb#

mkinitramfs ~ is the tool used to create initrd image. “initrd” image is a gzipped cpio archive.

** After all modifcation create initrd image as shown below…

arunsb@laptop:/tmp/initrd-src$ find . | cpio –quiet –dereference -o -H newc | gzip -9 > /tmp/initrd.img-2.6.28-11-arun
arunsb@laptop:/tmp/initrd-src$ ls -l /tmp/initrd.img-2.6.28-11-arun
-rw-r–r– 1 arunsb arunsb 7505955 2009-07-12 16:56 /tmp/initrd.img-2.6.28-11-arun
arunsb@laptop:/tmp/initrd-src$

* Enjoy !!

Regards,
Arun Bagul

openlsm-0.99 released

openlsm-0.99 released

Dear All,

We are pleased to announce that the openslm-0.99 development platform released on 10th Jun 2009. We are sure that  all contributor’s of openlsm and IndianGNU.org community will start coding for openlsm…

* Please don’t forget to test openlsm and give your valuable feedback/suggestion!

community Blog – http://www.indiangnu.org/

Download openlsm ~

* http://openlsm.sourceforge.net/
http://sourceforge.net/project/showfiles.php?group_id=211420

What is openLSM?

openLSM is web-based control panel designed to make administration of website, GNU/Linux and Unix based operating system easy! openLSM handles all aspects of administration in its interface. It is free/open source software under GPL.

How to install openlsm ~

step 1) cd to the source directory

   ./configure --prefix=/usr/local/openlsm
    OR
    ./configure --prefix=/usr/local/openlsm --with-mysql=/usr/bin/mysql_config --enable-internal-pcre
    --with-geoip=/usr --with-ldap=/usr 	

   make
   make install
step 2) openLSM is using 'openlsm' user and group. please create system user and group and set homedir
    /usr/local/openlsm or 'prefix' value. Confirm ownership/permission of '/usr/local/openlsm'
     directory after installation.

  addgroup --system openlsm
  adduser --system  --home /usr/local/openlsm --shell /bin/false --gid <gid_of_openlsm_group>  openlsm

step 3) How to create a self signed certificate for SSL/TLS

 dd if=/dev/random  of=/tmp/random.dat bs=1024 count=1

 $ openssl genrsa   -out  /usr/local/openlsm/etc/openlsm/ssl/openlsm-certificate.key
    -rand /tmp/random.dat 2048
 $ openssl req -new -key /usr/local/openlsm/etc/openlsm/ssl/openlsm-certificate.key
   -out /usr/local/openlsm/etc/openlsm/ssl/openlsm-certificate.csr

 #generate certificate
 $ openssl x509 -req -days 365 -set_serial 1 -in
  /usr/local/openlsm/etc/openlsm/ssl/openlsm-certificate.csr
   -signkey /usr/local/openlsm/etc/openlsm/ssl/openlsm-certificate.key
   -out /usr/local/openlsm/etc/openlsm/ssl/openlsm-certificate.crt

step 4) please check permission, ownership of /usr/local/openlsm directory and file
        path in openlsm.conf  configuration file...

start openlsm with script in  contrib directory…

./contrib/openlsm start

URL ~ http://<server_name_or_ip>:4050/ or

http://<server_name_or_ip>:4060/

enjoy !!

Regards,
IndianGNU & openlsm