Tag: Debian & Ubuntu

Debian & Ubuntu

How to create debian (deb) package

How to create debian (deb) package

Introduction –
Packages generally contain all of the files necessary to implement a set of related commands or features. There are two types of Debian packages:
1) Binary packages, which contain executables, configuration files, man/info pages, copyright information, and other documentation.
These packages are distributed in a Debian-specific archive format they are usually distinguished by having a ‘.deb’ file extension.
Binary packages can be unpacked using the Debian utility dpkg (possibly via a frontend like aptitude).

2) Source packages, which consist of a .dsc file describing the source package (including the names of the following files), a .orig.tar.gz file that contains the original unmodified source in gzip-compressed tar format and usually a .diff.gz file that contains the Debian-specific changes to the original source. The utility dpkg-source packs and unpacks Debian source archives.
Installation of software by the package system uses “dependencies” which are carefully designed by the package maintainers.  These dependencies are documented in the control file associated with each package.

Step 1) Please install few deb packages as pre-requirement –

arunb@laptop:~# apt-get install fakeroot build-essential

Step 2) Create directory where you will be putting your build data –

arunb@laptop:~# mkdir /var/create-deb-pkg/
arunb@laptop:~# chown arunb:arunb /var/create-deb-pkg/

Step 3) extract source and manually compile your software –

I compiled my software ie openlsm as shown below…

# cd /var/src/
tar xvfz openlsm-0.99-r51.tar.gz
cd openlsm-0.99-r51/
./configure –prefix=/usr/local/openlsm –with-mysql=/usr/bin/mysql_config –enable-internal-pcre –with-geoip=/usr –with-ldap=/usr
make
make install

Step 4) Create directory structure for creating deb package and copy build code/data –

arunb@laptop:~$ cd  /var/create-deb-pkg/

arunb@laptop:/var/create-deb-pkg$ mkdir openlsm-0.99-r51
arunb@laptop:/var/create-deb-pkg$ mkdir -p openlsm-0.99-r51/usr/local/
arunb@laptop:/var/create-deb-pkg$ mkdir openlsm-0.99-r51/DEBIAN/

** copying my build code here

arunb@laptop:/var/create-deb-pkg$ cp -fr /usr/local/openlsm/  openlsm-0.99-r51/usr/local/

arunb@laptop:/var/create-deb-pkg$ ll openlsm-0.99-r51/
drwxr-xr-x 2 arunb arunb 4096 2012-01-19 16:34 DEBIAN/
drwxr-xr-x 3 arunb arunb 4096 2012-01-19 16:31 usr/

Step 5) Define/Create deb package control files in DEBIAN directory –

arunb@laptop:/var/create-deb-pkg$ ll openlsm-0.99-r51/DEBIAN/
-rw-r–r– 1 arunb arunb   179 2012-01-19 16:34 changelog
-rw-r–r– 1 arunb arunb   139 2012-01-19 16:34 conffiles
-rw-r–r– 1 arunb arunb   419 2012-01-19 16:34 control
-rw-r–r– 1 arunb arunb 17696 2012-01-19 16:34 md5sums
-rwxr-xr-x 1 arunb arunb   535 2012-01-19 16:34 postinst
-rwxr-xr-x 1 arunb arunb   227 2012-01-19 16:34 postrm
-rwxr-xr-x 1 arunb arunb   303 2012-01-19 16:34 preinst
-rw-r–r– 1 arunb arunb     0 2012-01-19 16:34 rules

* DEBIAN/rules – file is empty

* DEBIAN/changelog file –

arunb@laptop:/var/create-deb-pkg$ cat openlsm-0.99-r51/DEBIAN/changelog
openlsm (0.99) stable; urgency=low

* openlsm web server for admin panel
+ 0.99 released – Jun 2009

— Arun Bagul <arunbagul@indiangnu.org>  Tue, 01 Jun 2009 01:31:52 -0530
arunb@laptop:/var/create-deb-pkg$

* DEBIAN/control file –

arunb@laptop:/var/create-deb-pkg$ cat openlsm-0.99-r51/DEBIAN/control
Package: openlsm
Version: 0.99-r51
Architecture: i386
Maintainer: Arun Bagul <arunbagul@indiangnu.org>
Provides: httpd, httpd-cgi
Section: httpd
Priority: optional
Homepage: http://openlsm.sourceforge.net/
Description: openlsm is web-based control panel for Unix/Linux systems
openlsm is web-based control panel for Unix/Linux systems
and Web Hosting! openlsm handles all aspects of administration in its interface.

* DEBIAN/postinst file (perform after installing package) –

arunb@laptop:/var/create-deb-pkg$
arunb@laptop:/var/create-deb-pkg$ cat openlsm-0.99-r51/DEBIAN/postinst
#!/bin/sh

set -e
SOFT=”openlsm”
echo “Copying pam.d/openlsm and init.d/openlsm file”
cp -fv /usr/local/${SOFT}/etc/pam.d/openlsm   /etc/pam.d/openlsm
cp -fv /usr/local/${SOFT}/etc/init.d/openlsm  /etc/init.d/openlsm
test -f /etc/init.d/openlsm && chmod 755 /etc/init.d/openlsm

update-rc.d openlsm defaults

echo “Changing permission of ‘/usr/local/openlsm/'”
chown openlsm:openlsm -R /usr/local/openlsm/
echo “Please run this cmd to generate Certificate for openlsm ~ ‘/usr/local/openlsm/bin/openlsm-create-certificate'”
exit 0

* DEBIAN/postrm file (take action before removing package) –

arunb@laptop:/var/create-deb-pkg$ cat openlsm-0.99-r51/DEBIAN/postrm
#! /bin/sh

set -e

echo “postrm step -”

update-rc.d -f openlsm remove
rm -vf /etc/init.d/openlsm /etc/pam.d/openlsm
echo “Deleting user & group – ‘openlsm’…”
userdel openlsm
getent group openlsm && groupdel openlsm

exit 0
arunb@laptop:/var/create-deb-pkg$

* DEBIAN/md5sums –

arunb@laptop:/var/create-deb-pkg$ head openlsm-0.99-r51/DEBIAN/md5sums
2129ba0e98dd77e8879e0912abe432a3  /usr/local/openlsm/sbin/openlsm-worker
a1dbdafadefd74bac29c8fd229dd1c01  /usr/local/openlsm/bin/openlsm-panic
e57e75853b52caf9569c922b7c404129  /usr/local/openlsm/bin/openlsm-tweak
..

arunb@laptop:/var/create-deb-pkg$

* DEBIAN/conffiles file –

arunb@laptop:/var/create-deb-pkg$ cat openlsm-0.99-r51/DEBIAN/conffiles
/usr/local/openlsm/etc/openlsm/openlsm.conf
/usr/local/openlsm/etc/openlsm/openlsm.conf.perf_sample
arunb@laptop:/var/create-deb-pkg$

Step 6) Create deb package now –

arunb@techops-i-arunb:/var/create-deb-pkg$ ls -l
drwxr-xr-x 4 arunb arunb 4096 2012-01-19 16:43 openlsm-0.99-r51

* creating deb package now…

arunb@techops-i-arunb:/var/create-deb-pkg$ fakeroot dpkg-deb –build openlsm-0.99-r51/
dpkg-deb: building package `openlsm’ in `openlsm-0.99-r51.deb’.

arunb@techops-i-arunb:/var/create-deb-pkg$ ls -l
drwxr-xr-x 4 arunb arunb    4096 2012-01-19 16:43 openlsm-0.99-r51
-rw-r–r– 1 arunb arunb 3491738 2012-01-19 16:52 openlsm-0.99-r51.deb

* rename your package if required like arch etc

arunb@techops-i-arunb:/var/create-deb-pkg$ mv openlsm-0.99-r51.deb openlsm-0.99-r51_i386.deb

arunb@techops-i-arunb:/var/create-deb-pkg$ ls -l
drwxr-xr-x  4 arunb arunb    4096 2012-01-19 16:43 openlsm-0.99-r51/
-rw-r–r–  1 arunb arunb 3491738 2012-01-19 16:52 openlsm-0.99-r51_i386.deb
arunb@techops-i-arunb:/var/create-deb-pkg$

* That’s it, enjoy Debian/Ubuntu!

Thank you,
Arun Bagul

How to Switch (change) from Unity Desktop to GNOME Desktop theme

How to Switch (change) from Unity Desktop to GNOME Desktop theme

Introduction –

For some people (like me) the new default Unity desktop in Ubuntu doesn’t look easy to opertate.  However the Ubuntu is trying to differentiate itself with a distinctive to improve user experience (Ubuntu is rocking!!). Ubuntu 11.04, is using Unity as its default desktop interface instead of the classic GNOME.

If you’re running Ubuntu 11.4 and don’t like to use Unity, you can switch back to the old classic GNOME interface as shown below.

It’s actually pretty simple  to choose between Unity and the classic GNOME user interface…

[1] During login time, Go to your logon screen, select the user you want to log in as.
– At the bottom task bar you can choose between different modes. Select “Ubuntu Classic”.
– Log in as normal.

* Another way to change theme is..

[2] Go to your (click on) “logout” button on top panel, select the “System Settings”..

– This will open “Control Center” then click on “Login Screen” setting tool.
– Where you can choose different themes. Select “Ubuntu Classic”.
NOTE- Please unlock before changing the setting ie provide your password

That’s it.

Regards,
Arun

What’s new in GRUB-2?

What’s new in GRUB-2?

Introduction ~ GRUB is perfect boot loader for Linux/Unix system! GRUB-2 supports several features that are important for every system admin.

* Platform support – GRUB 2 is intended to work across a wider range of architectures.
* Partition tables – GRUB-2 supports MBR partitioning scheme and GUID Partition Table (GPT).
* RAID and LVM – Now GRUB is supports both redundant array of independent disks (RAID) and Logical Volume Manager (LVM).
* File system support – GRUB 2 supports some additional non-Linux file systems, such as Apple’s Hierarchical File System Plus, NTFS  and  ZFS file systems…

* Configuring GRUB 2 –

GRUB 2 configuration file is different from legacy GRUB….

The default location for the GRUB 2 configuration file is /boot/grub/grub.cfg

* Sample GRUB 2 configuration file

root@me:~# cat /boot/grub/grub.cfg

set timeout=10
set default=0

menuentry “Ubuntu, Linux 2.6.31-20-generic” {
set quiet=1
insmod ext2
set root=(hd0,6)
search –no-floppy –fs-uuid –set 7699852c-2a04-4da2-82e8-a69969f16bf2
linux /boot/vmlinuz-2.6.31-20-generic root=UUID=7699852c-2a04-4da2-82e8-a69969f16bf2 ro quiet splash
initrd /boot/initrd.img-2.6.31-20-generic
}

Thanks,
Arun Bagul

Cryptez vos mails avec GPG et Enigmail plugin Thunderbird

Cryptez vos mails avec GPG et Enigmail plugin Thunderbird

Introduction ~

GNU Privacy Guard (GnuPG ou GPG) est open source / logiciel libre de cryptage et un outil de signature, alternative à la Pretty Good Privacy (PGP) La suite de logiciels de cryptographie. Enigmail est une extension pour Mozilla Thunderbird et d’autres applications Mozilla. Elle fournit la clé publique de chiffrement des e-mail. Fonctionnalité cryptographique est gérée par GNU Privacy Guard (GnuPG ou GPG).

Step 1] Installer GnuPG ou GPG —

* Ubuntu / Debian ~

root @ Arun: ~ # apt-get install gnupg gnupg2

* Redhat / Fedora ~

root @ Arun: ~ # yum install gnupg gnupg2

Etape 2] Comment faire pour installer Enigmail?

Je suppose que Mozilla Thunderbird est déjà installé sur votre système. Pour installer “Enigmail” suivre les étapes suivantes

a) Télécharger “Enigmail” de l’URL »http://enigmail.mozdev.org/download/”

Note ~ OS sélectionner et de Thunderbird version correctement.

b) Dans la barre de menu de la fenêtre principale de Thunderbird vous pourrez voir «Outils». Sélectionnez cette option, puis «Add-ons” option. Ceci ouvrira une nouvelle fenêtre répertoriant tous vos plug-ins Thunderbird. Dans le coin inférieur main de cette nouvelle fenêtre vous verrez un bouton “Installer”. Cliquez sur ce bouton. Dites Thunderbird où vous avez enregistré le Enigmail. Fichier XPI. et dire simplement “Installer” that’s it!!

* Once “Enigmail est installé redémarrer le Thunderbird. Ensuite, vous verrez “OpenPGP onglet” dans le menu principal de Thunderbird.

Etape 3] Configuration privée / clé publique ~

Enigmail utilise la cryptographie à clé publique pour assurer l’intimité entre vous et vos correspondants. Pour générer les Clés publiques / privées, il ya deux méthodes, soit les créer avec l’aide de “gpg” outil de ligne de commande ou utilisez “Enigmail” ….

* Nous produirons privé / public des clés cryptographiques, avec l’aide de «Enigmail», comme indiqué ci-dessous ….

a) Cliquez sur “OpenPGP” dans la barre de menus de la fenêtre principale de Thunderbird. Sélectionnez “Key Management”.
b) Dans Enigmail Key Manager ~ cliquez sur “Générer” onglet dans la barre de menu et sélectionnez “Nouveau paire de clés».
c) Tout en haut de la fenêtre vous verrez une zone de liste déroulante affichant toutes vos adresses e-mail. GnuPG sera associer votre nouvelle clé avec une adresse email.
Enigmail vous demande simplement de quelle adresse vous souhaitez utiliser pour cette clé. Choisir celles qui compte sera de recevoir du courrier crypté.

REMARQUE ~ Nous pouvons utiliser les mêmes touches pour plusieurs comptes.

d) Vous pouvez utiliser une phrase secrète ou il suffit de cocher “Pas de mot de passe” dans la case pour générer des clés sans passphrase.
e) Créer le répertoire pour sauver “La révocation des certificats” …

arunsb arun @: ~ $ mkdir / home / arunsb / .gpg_key /

f) Cliquez sur “Générer clé” pour générer des clés. c’est fait ..

Pour partager facilement les touches, vous pouvez publier vos clés avec serveur de clés.

a) Dans “Key Management” fenêtre Sélectionner vos clés, puis cliquez sur l’onglet ‘serveur de clés “dans le menu principal, puis cliquez sur” Upload clés publiques ”
Note ~ veillez à cocher «Afficher toutes les touches par défaut” case à cocher (à la liste de toutes les touches)

Étape 4] Composez le courrier et signer ~

Composez le mail et dites-Enigmail à le signer. En haut de votre fenêtre de composition, vous verrez un bouton de lecture “OpenPGP”. Cliquez sur cette question. Assurez-vous que le “Sign” option, et seulement cela, est cochée. Enfin “Envoyer” le courrier! (Vous serez invité à fournir votre mot de passe. Une fois que vous y entrer, Enigmail signerez votre e-mail et envoyez-le si vous avez générer des clés avec passphrase sinon il ne sera pas demander)
/ pgp_enigmail-composer

Enjoy!

Observe,
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 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

Subversion – How to configure with Apache WebDAV or svnserve

Subversion – How to configure with Apache WebDAV or svnserve

1] What is Subversion?

Subversion is a beautiful free/open source tool (software) to manage changes made to your information. Subversion manages files and directories, and the changes made to them over time. This allows you to recover older versions of your data or examine the history of how your data changed. Subversion can operate across networks, which allows it to be used by people on different computers.

2] Different methods of accessing subversion (svn) repository ?

There are three different methods of accessing subversion repository…

a) Local filesystem or Network filesystem accessed by client directly
b) Apache HTTP using WebDAV module
c) svnserve tunneled over an SSH (svn + ssh)

For more informatio, please refer the article http://www.indiangnu.org/2006/different-methods-of-accessing-subversion-svn-repository/

3] Subversion architectue –

Subversion provides two backends to store the data in svn repository

a) FSFS – Fast and Secure File Systtem –

FSFS backend provides quite a bit more flexibility in terms of its supported deployment scenarios. More flexibility means you have to work a little harder to find ways to deploy it incorrectly. FSFS is the default backend

b) Berkeley DB File system –

Berkeley DB provides real transaction support—perhaps its most powerful feature. Another great feature of Berkeley DB is hot backups—the ability to backup the database environment without taking it “offline”. But Berkeley DB environments are not portable!!

root@arun:~# ls -l  /var/repos_base/myrepository/
total 28
drwxr-xr-x 2 arunsb www-data 4096 2008-12-27 15:30 conf
drwxr-xr-x 2 arunsb www-data 4096 2008-12-26 16:34 dav
drwxr-sr-x 5 arunsb www-data 4096 2008-12-27 15:27 db
-r–r–r– 1 arunsb www-data    2 2008-12-26 16:34 format
drwxr-xr-x 2 arunsb www-data 4096 2008-12-26 16:34 hooks
drwxr-xr-x 2 arunsb www-data 4096 2008-12-26 16:34 locks
-rw-r–r– 1 arunsb www-data  229 2008-12-26 16:34 README.txt
root@arun:~#

root@arun:~# cat /var/repos_base/myrepository/db/fs-type
fsfs
root@arun:~#

4] How Install Subversion –

Ubuntu –

root@arun:~# apt-get install  subversion  subversion-tools
5] How to configure Subversion with Apache HTTP and WebDAV module –

Step (1) First of all we need to create the subversion repository….

root@arun:~# svnadmin create /var/repos_base/myrepository
root@arun:~#

* Make sure to set/change owership/permission of svn repository for Apache webserver user (www-data is apache user)

root@arun:/var/repos_base# chown arunsb:www-data -R /var/repos_base/
root@arun:~# chmod  775 -R /var/repos_base/
root@arun:~#
root@arun:~# ls -l /var/repos_base/
-rwxrwxr-x 1 arunsb www-data   63 2008-12-03 15:50 common_userdb
drwxrwxr-x 7 arunsb www-data 4096 2008-12-03 15:48 myrepository
root@arun:~#

Step (2) Authentication – common user DB for all repositories –

Let us create a file “/var/repos_base/common_userdb” which will contain users information in file and add few users…

root@arun:/var/repos_base# htpasswd  -c /var/repos_base/common_userdb   arunsb
New password:
Re-type new password:
Adding password for user arunsb

root@arun:/var/repos_base# htpasswd  /var/repos_base/common_userdb  ravi
New password:
Re-type new password:
Adding password for user ravi

root@arun:/var/repos_base# htpasswd  /var/repos_base/common_userdb  santhosh
New password:
Re-type new password:
Adding password for user santhosh

root@arun:/var/repos_base# cat /var/repos_base/common_userdb
arunsb:dXxZU5vmHxFoc
ravi:gGEX.dsWcwqzc
santhosh:Jlzed1almY.SY
root@arun:/var/repos_base#

Step (3) Now install Apache , WebDav module for apache –

Ubuntu –

root@arun:~# apt-get install apache2  apache2.2-common  libapache2-svn

you need to enable to WebDAV svn module for apache using following command on Ubuntu…

root@arun:~# a2enmod dav   dav_svn
root@arun:~#

* Make sure that Apache is running ….

Step (4) Configure svn repository with apache –

root@arun:~# cat /etc/apache2/mods-available/dav_svn.conf
# dav_svn.conf – Subversion/Apache configuration

<Location /myrepository>

DAV svn

#You need either SVNPath and SVNParentPath, but not both.
#use SVNParentPath if you have multiple repositories under one directory

SVNPath /var/repos_base/myrepository
#SVNParentPath /var/repos_base

# Access control is done at 3 levels –
#(1) Apache authentication
#(2) Apache <Limit> and <LimitExcept>
#(3) mod_authz_svn is a svn-specific authorization module

AuthType Basic
AuthName “|| Welcome to Subversion Repository || ”
AuthUserFile /var/repos_base/common_userdb

#To enable authorization via mod_authz_svn
AuthzSVNAccessFile  /var/repos_base/myrepository/conf/authz
Require valid-user

#<LimitExcept GET PROPFIND OPTIONS REPORT>
#Require valid-user
#</LimitExcept>

</Location>

## Add entry for other svn repositories

root@arun:~#

* Once done restart the Apache server and try to access svn repository as …

root@arun:~# svn list http://server_name_or_IP/your_repository_name_mentioned_in_dav_svn.conf_file

please refer the article for more operation http://www.indiangnu.org/2006/different-methods-of-accessing-subversion-svn-repository/

6] How to configure Subversion with svnserve tunneled over an SSH (svn + ssh) –

Step (1) Make sure that subversion is installed and repository is created…

Start up script for svnserve is as shown below (ubuntu), please update this file with proper setting…

root@arun:~# cat /etc/init.d/svnserve
#!/bin/bash

# startup script for svn server!
## svnserve  –daemon  –listen-port   3690  –pid-file /var/run/svn.server

SVN_DAEMON=”/usr/bin/svnserve”
PID_FILE=”/var/run/svn-server.pid”
LOG_FILE=”/var/log/svnserve.log”
SVN_PORT=3690
SVN_ROOT=”/var/repos_base”
case “$1” in

start)
if [ -f  $PID_FILE ];then
check=$(cat $PID_FILE)
echo “Subversion service (svnserve) already running [pid = $check]”
else
echo “Starting the Subversion service (svnserve)..”
$SVN_DAEMON  –daemon –root $SVN_ROOT  –listen-port $SVN_PORT –pid-file $PID_FILE  > $LOG_FILE 2>&1
echo “log file is $LOG_FILE”
echo “…”
echo “Done.”
fi
;;

stop)
echo “killing Subversion service (svnserve)…”
if [ -f  $PID_FILE ];then
#killall svnserve
kill -9 $(cat $PID_FILE)
rm  $PID_FILE
echo “…”
echo “Done.”
else
echo “NOT running…”
fi
;;

status)
if [ -f  $PID_FILE ];then
echo “Subversion service (svnserve) -”
pid_of_svnserve=$(cat $PID_FILE)
echo -e “Running & pid is $pid_of_svnserve”
else
echo “Subversion service (svnserve) NOT running…”
fi
;;

*)
echo “Usage: $0  {start|stop|status}”
exit 1
esac
exit 0
#DONE
root@arun:~#

Step (2) svnserve  configuration –

root@arun:~# cat /var/repos_base/myrepository/conf/svnserve.conf
### This file controls the configuration of the svnserve daemon, if you

[general]
### Authenticated users.  Valid values are “write”, “read”,
### and “none”.  The sample settings below are the defaults.
### The password-db option controls the location of the password file
### The authz-db option controls the location of the authorization
### rules for path-based access control.

realm = || Welcome to Subversion Repository ||
anon-access = none
auth-access = write
authz-db = authz
password-db = passwd

root@arun:~#

Step (3) Authentication for svnserve –

root@arun:~# cat /var/repos_base/myrepository/conf/authz
# single user, to a group of users defined in a special [groups]
# section, or to anyone using the ‘*’ wildcard.  Each definition can
# grant read (‘r’) access, read-write (‘rw’) access, or no access (”)

[groups]
svn_admin = arunsb , ravi

# remember here svn name which you mentioned in “dav_svn.conf” file

[myrepository:/]
@svn_admin= rw

[myrepository:/branches]
@svn_admin = rw
santhosh = r

[myrepository:/trunk]
@svn_admin= rw
santhosh = rw

root@arun:~# cat /var/repos_base/myrepository/conf/passwd
### Below it contains one section labelled [users].
### The name and password for each user follow, one account per line.

[users]

arunsb = 1234
ravi   = 1234
santhosh = 12345
root@arun:~#

Step (4) Start svnserve with following command –

root@arun:~# /etc/init.d/svnserve
Usage: /etc/init.d/svnserve  {start|stop|status}
root@arun:~#
root@arun:~# /etc/init.d/svnserve  start
Starting the Subversion service (svnserve)..
log file is /var/log/svnserve.log

Done.
root@arun:~# /etc/init.d/svnserve  status
Subversion service (svnserve) –
Running & pid is 11346
root@arun:~#

root@arun:~# netstat -nlp |  grep svnserve
tcp        0      0 0.0.0.0:3690            0.0.0.0:*               LISTEN      11346/svnserve
root@arun:~#

** HELP ?

root@arun:~# svnserve  –help
usage: svnserve [options]

Valid options:
-d [–daemon]            : daemon mode
–listen-port arg        : listen port (for daemon mode)
–listen-host arg        : listen hostname or IP address (for daemon mode)
–foreground             : run in foreground (useful for debugging)
-h [–help]              : display this help
–version                : show program version information
-i [–inetd]             : inetd mode
-r [–root] arg          : root of directory to serve
-R [–read-only]         : force read only, overriding repository config file
-t [–tunnel]            : tunnel mode
–tunnel-user arg        : tunnel username (default is current uid’s name)
-T [–threads]           : use threads instead of fork
-X [–listen-once]       : listen once (useful for debugging)
–pid-file arg           : write server process ID to file arg

root@arun:~#

Troubleshooting –

arunsb@arun:~$ svn co svn://192.168.0.1/myrepository/trunk/  /tmp/12345
svn: Not authorized to open root of edit operation
arunsb@arun:~$

* please add “anon-access = none” to ‘svnserve.conf’ conf file of your repository…

root@arun:~# vi /var/repos_base/myrepository/conf/svnserve.conf

arunsb@arun:~$ svn co svn://192.168.0.1/myrepository/trunk/   /home/arunsb/working_svn
Authentication realm: <svn://192.168.0.1:3690> ” || Welcome to Subversion Repository ||”
Password for ‘arunsb’:
Checked out revision 2.
arunsb@arun:~$

Thank you,

Arun Bagul

How to convert nero image to iso image and extract iso image

How to convert nero image to iso image and extract iso image

Introduction –

nrg2iso is handy tool to convert Nero Image to ISO image

* How to install nrg2iso on Ubuntu Linux –

root@arun:~# apt-get  install   nrg2iso
root@arun:~/oracle-setup# nrg2iso -h
Nrg2Iso v0.4 by G. Kokanosky
released under the GNU GPL v2 or later

Usage :
nrg2iso image.nrg   image.iso

–version    display version number
–help       display this notice

root@arun:~/oracle-setup#

* How to use it ? –

root@arun:~/oracle-setup# ls
ora92linux.nrg
root@arun:~/oracle-setup#

root@arun:~/oracle-setup# nrg2iso ora92linux.nrg  ora92linux.iso
|==============================>[100%]
ora92linux.iso written : 680659100 bytes
root@arun:~/oracle-setup#

root@arun:~/oracle-setup# ls *.iso
ora92linux.iso
root@arun:~/oracle-setup#

* Now ISO image is ready, we can mount ISO image to extract the data as shown below….
root@arun:~/oracle-setup# mount -o loop  ora92linux.iso   /tmp/mount-iso/
root@arun:~/oracle-setup#

root@arun:~/oracle-setup# cd  /tmp/mount-iso/
root@arun:/tmp/mount-iso# ls
doc  index.htm  install  lgto  response  runInstaller  stage
root@arun:/tmp/mount-iso#

root@arun:/tmp/mount-iso# ls
doc  index.htm  install  lgto  response  runInstaller  stage

* Enjoy!! – you can copy the extracted data where ever you want!!

root@arun:/tmp/mount-iso# cp -fr * /root/oracle-setup/oracle-1/
root@arun:/tmp/mount-iso#

root@arun:~/oracle-setup# mount
/root/oracle-setup/ora92linux2.iso  on  /tmp/mount-iso type iso9660 (rw,loop=/dev/loop0)
root@arun:~/oracle-setup#

* Un-mount to ISO image –

root@arun:/tmp/mount-iso# cd  /
root@arun:/# umount /tmp/mount-iso/
root@arun:/#

Thank you,

Arun Bagul