Kategori: Linux

  • RAID1 array’i yeniden yapılandırma.

    Önceki yazımızda RAID arrayde bulunan bozuk diskin nasıl tespit edileceğini görmüştük. Bu yazımızda bozuk diskin yerine takılan yeni diskin array’e nasıl ekleneceğini göreceğiz. Normalde ubuntu sunucular bu işi yeni disk takılıp sistem açıldıktan sonra otomatik olarak yapmaya başlayabiliyor, ancak zaman zaman sorunlar ile karşılaşmak mümkün oluyor. Örneğin benim vereceğim örnekte md1 array’i nedense inactive durumda. Bu sorunla yüzleştiğimizde neler yapılabilir beraber bakalım:

    (Not: bu işlemleri yaparken, herhangi bir veri kaybı yaşamanızdan sorumlu olmadığımı tekrar belirtmek isterim. Önceki yazıda bulunan kurallar aynen bu yazı için de geçerli.)

    Öncelikle yeni diskte eş bölümleri oluşturmamız gerekmekte. Bunun için elimizde bulunan ikinci diskin bölümlerini ve Boot kaydını aynen yeni diske geçirmemiz gerekiyor. Bu işlemler için sırası ile şunları yapacağız:

    Öncelikle ikinci diskin bölümleme tablosunun bir kopyasını yeni diske çıkartalım.

    Hatırlayacağınız üzere bozulan diskimiz “sda” sağlam olan diskimiz de “sdb” idi. Ancak yanlış işlem yapmamanız için öncelikle dolu ve boş diskin hangisi olduğuna sisteminizden bakın:

    # fdisk -l

    Disk /dev/sda: 750.2 GB, 750156374016 bytes
    255 heads, 63 sectors/track, 91201 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x55555555

    Disk /dev/sda doesn’t contain a valid partition table

    Disk /dev/sdb: 750.2 GB, 750156374016 bytes
    255 heads, 63 sectors/track, 91201 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00088969

    Device Boot Start End Blocks Id System
    /dev/sdb1 1 262 2102562 fd Linux raid autodetect
    /dev/sdb2 263 295 265072+ fd Linux raid autodetect
    /dev/sdb3 296 91201 730202445 fd Linux raid autodetect

    Disk /dev/md0: 2152 MB, 2152923136 bytes
    2 heads, 4 sectors/track, 525616 cylinders
    Units = cylinders of 8 * 512 = 4096 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    Disk /dev/md0 doesn’t contain a valid partition table

    Disk /dev/md2: 747.7 GB, 747727224832 bytes
    2 heads, 4 sectors/track, 182550592 cylinders
    Units = cylinders of 8 * 512 = 4096 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    Disk /dev/md2 doesn’t contain a valid partition table

    Benim sistemimde dolu olan disk “/dev/sdb” boş olan yeni disk ise “/dev/sda” olarak görünmekte. Buna göre sdb’deki bölümleme tablosunu aşağıdaki komut ile “sda”ya kopyalayacağız:

    # sfdisk -d /dev/sdb | sfdisk /dev/sda

    Checking that no-one is using this disk right now …
    OK

    Disk /dev/sda: 91201 cylinders, 255 heads, 63 sectors/track

    sfdisk: ERROR: sector 0 does not have an msdos signature
    /dev/sda: unrecognized partition table type
    Old situation:
    No partitions found
    New situation:
    Units = sectors of 512 bytes, counting from 0

    Device Boot Start End #sectors Id System
    /dev/sda1 3906 4209029 4205124 fd Linux raid autodetect
    /dev/sda2 4209030 4739174 530145 fd Linux raid autodetect
    /dev/sda3 4739175 1465144064 1460404890 fd Linux raid autodetect
    /dev/sda4 0 – 0 0 Empty
    Warning: no primary partition is marked bootable (active)
    This does not matter for LILO, but the DOS MBR will not boot this disk.
    Successfully wrote the new partition table

    Re-reading the partition table …

    If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
    to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1
    (See fdisk(8).)

    İşlemin başarılı olup olmadığını tekrar “fdisk -l” komutu vererek çıktıdan görebilirsiniz. Eğer şöyle bir çıktı ile karşıltıysanız işlem başarılı demektir:

    # fdisk -l

    Disk /dev/sda: 750.2 GB, 750156374016 bytes
    255 heads, 63 sectors/track, 91201 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x55555555

    Device Boot Start End Blocks Id System
    /dev/sda1 1 262 2102562 fd Linux raid autodetect
    /dev/sda2 263 295 265072+ fd Linux raid autodetect
    /dev/sda3 296 91201 730202445 fd Linux raid autodetect

    Disk /dev/sdb: 750.2 GB, 750156374016 bytes
    255 heads, 63 sectors/track, 91201 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00088969

    Device Boot Start End Blocks Id System
    /dev/sdb1 1 262 2102562 fd Linux raid autodetect
    /dev/sdb2 263 295 265072+ fd Linux raid autodetect
    /dev/sdb3 296 91201 730202445 fd Linux raid autodetect

    Disk /dev/md0: 2152 MB, 2152923136 bytes
    2 heads, 4 sectors/track, 525616 cylinders
    Units = cylinders of 8 * 512 = 4096 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    Disk /dev/md0 doesn’t contain a valid partition table

    Disk /dev/md2: 747.7 GB, 747727224832 bytes
    2 heads, 4 sectors/track, 182550592 cylinders
    Units = cylinders of 8 * 512 = 4096 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    Disk /dev/md2 doesn’t contain a valid partition table

     Bu işlemden sonra Boot record’u kopyalayacağız, önce boot recordun kopyasını dosyaya yazıyoruz:

    # dd if=/dev/sdb of=sdb.part bs=1024k count=1
    1+0 records in
    1+0 records out
    1048576 bytes (1.0 MB) copied, 0.0249217 s, 42.1 MB/s

    # dd if=sdb.part of=/dev/sda bs=1024k count=1
    1+0 records in
    1+0 records out
    1048576 bytes (1.0 MB) copied, 0.00123787 s, 847 MB/s

    Bölümleme işlemleri bittikten sonra sda arrayleri sdb’den geri alma işlemine başlayabiliriz:

    # mdadm –manage /dev/md0 –add /dev/sda1
    mdadm: added /dev/sda1

    # mdadm –manage /dev/md1 –add /dev/sda2
    mdadm: added /dev/sda2

    # mdadm –manage /dev/md2 –add /dev/sda3
    mdadm: added /dev/sda3

     Bu mirrorlama işlemleri arka planda devam etmektedir. Durumu görmek için “cat /proc/mdstat” komutunu verebilirsiniz. An be an takip etmek isterseniz şu komut ile konsolun birisinde monitörleme yapabilirsiniz:

    # watch -n .5 cat /proc/mdstat

    .5 rakamı güncellenme sıklığını saniye cinsinden belirtir 0.5 saniye anlamındadır değer 1 yaparak saniyede bir güncellenmesini sağlayabilirsiniz. Mirrorlama işlemi süresi diskin boyutu ve makinenin gücüne ayrıca başka işlem yapılıp yapılmadığına göre değişiklik göstermektedir.

    Every 0.5s: cat /proc/mdstat Tue Jul 23 13:42:47 2013

    Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] [linear] [multipath]
    md1 : active raid1 sda2[0] sdb2[1]
    264960 blocks [2/2] [_U]
    resync=DELAYED

    md2 : active raid1 sda3[2] sdb3[1]
    730202368 blocks [2/1] [_U]
    [=====>……………] recovery = 2.2% (16135936/730202368) finish=151.9min speed=78334K/sec

    md0 : active raid1 sda1[0] sdb1[1]
    2102464 blocks [2/2] [UU]

    unused devices: <none>

    Yukarıdaki görüntüde arrayler görünmekte ve bunların bazılarında ufak tefek farklar bulunmakta, bunları açıklamak gerekirse;

    • [2/2] [2/1] gibi ibareler md arrayine bağlı bölümlerin kaç tanesinin çalışır durumda olduğunu göstermektedir. md0 arrayinde 2 bölümde çalışır durumda.
    • [UU] [_U] gibi ibarelerde ise “U” harfi kullanımda olan bölümlemeleri göstermektedir. “_” ise kullanımda olmayan bölümlemeyi işaret eder.
    • md0 cihazı aktif ve sda1 bölümünün kopyası oluşturulmuş. Şu an sorunsuz bir şekilde çalışmakta.
    • md1 cihazı resync için “DELAYED” durumunda sıra beklemekte. ikinci bölümleme arraye eklenmiş ancak kullanıma açılmamış
    • md2 cihazında şu an resync yapılmakta bu yüzden henüz o da kullanıma açılmamış durumda.

    Sonraki yazımız karşılaşılan sorunlar ile nasıl başa çıkılacağına dair olacak.

  • Ubuntu sunucuda RAID1 array içindeki bozuk diski bulmak.

    RAID1 sistemdeki diskin bir tanesi bozulduğu zaman izlenecek yöntemler:

    Öncelikli işlem sistem henüz açık iken yedek almaktır. Her zaman yedeğinizi alın! Bu işlem sonucunda sisteminizde oluşabilecek sorunlardan tamamen siz sorumlusunuz. Ben yaptım oldu ancak sizin sistemde de aynı sonucu vermeme olasılığı her zaman vardır ve veri kaybı yaşamanız bu olasılık dahilindedir. Bu yüzden bu adımları uygularken yaşayacağını hiçbir kayıptan ben sorumlu değilim. 🙂

    Canlı sistemin yedeğini aldıktan sonra bozuk diskin hangisi olduğunu bilmiyorsanız öncelikle bunu tespit etmemiz gerekir.

    Sistemde root kullanıcı haklarına nail olup (# sudo -s) /var/log/ altındaki messages log dosyasının içine bakarak bozuk diskin hangisi olduğunu anlayabiliriz. Örnek olarak benim messages dosyasının içeriğini aşağıya ekledim:

    kernel: [ 540.541685] ata3.00: configured for UDMA/133
    kernel: [ 540.541698] sd 2:0:0:0: [sda] Unhandled sense code
    kernel: [ 540.541701] sd 2:0:0:0: [sda] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
    kernel: [ 540.541704] sd 2:0:0:0: [sda] Sense Key : Medium Error [current] [descriptor]
    kernel: [ 540.541709] Descriptor sense data with sense descriptors (in hex):
    kernel: [ 540.541711] 72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00
    kernel: [ 540.541721] 00 40 3b 8b
    kernel: [ 540.541725] sd 2:0:0:0: [sda] Add. Sense: Unrecovered read error – auto reallocate failed
    kernel: [ 540.541730] sd 2:0:0:0: [sda] CDB: Read(10): 28 00 00 40 3b 8b 00 00 03 00
    kernel: [ 540.541981] ata3: EH complete

    Yukarıda görüldüğü üzere “sd 2:0:0:0: [sda] Sense Key : Medium Error [current] [descriptor]” ve “sd 2:0:0:0: [sda] Add. Sense: Unrecovered read error – auto reallocate failed” satırları “sda” olarak bağlanmış olan diskte “medya hatası” ve “kurtarılamayan okuma hatası” hatası olduğunu söylemekte.

    Eğer sda diskin kasanın içindeki hangi disk olduğu konusunda bir fikriniz yoksa sistemi kapatıp disk sökmeye başlamadan önce hangi diski sökmeniz gerektiğini diskin seri numarasına bakarak şu şekilde bulabilirsiniz:

    # hdparm -i /dev/sda | grep SerialNo
    Model=SAMSUNG HD753LJ, FwRev=1AA01118, SerialNo=S13UJ90SXXXXXX

    İkinci olarak şu yöntem ile de seri numarasını bulabilirsiniz:

    # /sbin/udevadm info –query=property –name=sda | grep ID_SERIAL
    ID_SERIAL=SAMSUNG_HD753LJ_S13UJ90SXXXXXX
    ID_SERIAL_SHORT=S13UJ90SXXXXXX

    Eğer S.M.A.R.T. verilerini okumayı biliyorsanız mevcut RAID1 yapısındaki iki diskin S.M.A.R.T. verilerine bakarak hangi diskin bozuk olduğunu ve seri numarasını bulabilirsiniz.

    # smartctl -x /dev/sda

    Bu komut çıktısı çok uzun olduğu ve ekstra açıklamalar gerektiği için yazıyı daha uzatmamak adına buraya eklemiyorum. S.M.A.R.T. verisi nasıl okunur bunu başka bir konuda işleyeceğiz.

    Hangi diski sökmemiz gerektiğini öğrendiğimize göre artık sistemi kapatıp doğru diski değiştirebiliriz. Diski değiştirdikten sonra sistemi tekrar yükleyip RAID array’i yapılandırma işine girişeceğiz.

  • Defining Motherboard, CPU and BIOS info in Linux terminal

    In this article, I’m going to explain how to read motherboard, cpu and bios information under linux terminal.

    Reading Motherboard Information:

    # sudo dmidecode -t 2

     

    Reading Motherboard Serial Number:

    # sudo dmidecode -t 2 | grep Serial

     

    And OEM Information:

    # sudo dmidecode -t 11

    (daha&helliip;)

  • Preparing virtual environment for running with apache mod_wsgi & postgresql

    For completing postgresql requirements of virtual environment, install “libpq-dev” and “python-dev” packages, outside of virtual environment.

    $ deactivate (if you are in virtual environment)
    $ sudo apt-get install libpq-dev python-dev

    Re-activate virtual environment and install psycopg2 from pip repo.

    $ pip install psycopg2

    By the way, in the name of  conformist approach install ipython in virtual environment.

    $ pip install ipython

    PostgreSQL engine and python connection libraries are ready.
    Now, lets prepare wsgi file for current project. (I assumed apache and mod_wsgi installed and configured) I’m going to use /var/www/project path for example for environment root in wsgi file.

    ENV_DIR = [‘/var/www/project’]

    import site, os, sys

    base = os.path.dirname(__file__)
    sys.path.insert(0, base)
    sys.path.append(os.path.dirname(base))

    # Remember original path.
    prev_sys_path = list(sys.path)

    # Add each new site-packages directory.

    for directory in ENV_DIR:

    site.addsitedir(directory)

    # For taking new directories to the front reorder path.

    new_sys_path = []
    for item in list(sys.path):

    if item not in prev_sys_path:

    new_sys_path.append(item)
    sys.path.remove(item)

    sys.path[:0] = new_sys_path
    os.environ[‘PYTHON_EGG_CACHE’] = ‘/tmp/project_eggs’
    sys.stdout = sys.stderr
    os.environ[‘DJANGO_SETTINGS_MODULE’] = ‘%s.settings’ % os.path.basename(base)
    from django.core.handlers.wsgi import WSGIHandler
    application = WSGIHandler()

    Place the wsgi file above into root of the django project which created inside of the virtual environment directory (eg. /var/www/project/django/)

    So wsgi file is ready, and we can configure apache to use this wsgi file:

    <VirtualHost *:80>

    WSGIDaemonProcess project_name user=username group=usergroup processes=3 threads=15 inactivity-timeout=120 maximum-requests=50 python-path=/var/www/project/lib/pyton2.7/site-packages
    WSGIProcessGroup project_name
    WSGIApplicationGroup %{GLOBAL}
    WSGIScriptAlias / /var/www/project/django/wsgi
    ServerName project_name.com
    ServerAdmin admin@project_name.com
    CustomLog /var/www/project/django/log/access_log combined
    ErrorLog /var/www/project/django/log/error_log
    Alias /static “/var/www/project/django/static”

    </VirtualHost>

    Save this file under /etc/apace/sites-available as “project.conf”

    Run “$ a2ensite project.conf” command and restart (or reload) the apache service.

    Now you can see the running django installation at “http://www.project_name.com”

  • Installing Django-CMS over Python Virtual Environment on Ubuntu based systems

    Prepare for virtual environment:

    $ sudo apt-get install python-setuptools python-dev build-essential
    $ sudo easy_install pip
    $ sudo pip install virtualenv

    Creating a virtual environment:

    $ virtualenv example_env -p python2.7 –no-site-packages –distribute

    Activating virtual environment:

    $ source example_env/bin/active

    Installing Django and Django-CMS in to virtual environment:

    $ pip install PIL
    $ pip install django-cms

    the command above is also installs those required packages:

    django
    django-mptt
    django-classy-tags
    django-sekizai
    south
    html5lib

    Thats all. Library installation on virtual environment is complete. On the next, how to run django-cms on django with apache…

     

    Note: If you want to exit from virtual environment just type this:

    $ deactivate

  • PyCharm & Linux FS Notifier

    Native file system watcher for Linux

    If you’re an IntelliJ user working under Linux you’ve probably seen that boring “Synchronizing files…” spinning icon in a left corner of a status bar. It is there because for an intelligent IDE it is a must to be in the know about any external changes in files it working with – e.g. changes made by VCS, or build tools, or code generators etc. On Windows and Mac OS X native file system watchers used to facilitate this task but on Linux the only option was to recursively scan directory tree. Now you’re welcome to give a try to native file system watcher for Linux.
    Prerequisites
    File system watcher requires inotify(7) facility. It is in mainstream kernel for more than two years (since 2.6.13, and in glibc since 2.4) so chances are your distribution don’t missing it. The sign of inotify availability in a system is a presence of /proc/sys/fs/inotify/ directory.
    Download and setup
    File system watcher is a single binary executable (fsnotifier) and can be downloaded directly from our Git repository. It should be named ‘fsnotifier’, placed into bin/ directory of your IDE and granted execution rights. Inotify requires a “watch handle” to be set for each directory it monitors. Unfortunately, the default limit of watch handles may not be enough for reasonably sized projects (e.g. IntelliJ IDEA sources contain 30000+ directories). The current limit can be verified by executing:

    cat /proc/sys/fs/inotify/max_user_watches

    It can be raised by adding following line to the /etc/sysctl.conf file:

    fs.inotify.max_user_watches = 524288

    … and issuing this command to apply the change:

    sudo sysctl -p

    64-bit systems
    If your system is strictly 64-bit (i.e. doesn’t contains 32-bit runtime libraries in /lib32 directory) you should download 64-bit version here. Rename downloaded file to “fsnotifier”, rest of setup is same.

  • Resolving Tomboy Ubuntu One issue on Mint 11 Katya

    Mint Linux 11 Katya
    Tomboy & Ubuntu One.

    Tomboy notes… You know,.. In this world, people uses for taking notes and take a look at them from any where, who knows this app.. Because it’s online, ermmm… Any way, this app doesn’t needs to be clearifying about what it is…

    Main problem is:
    I installed Mint Linux 11 Katya and I can’t find ubuntu one service in the tomboy options like before…

    Let’s resolve this problem and make me a hero who saved the DAY one:
    Open tomboy notes from “Menu/Accessories”
    Click to “Preferences” in “Edit” menu and tab to “Synchronization”
    Select “Tomboy Web” from “Services” pulldown
    Add “https://one.ubuntu.com/notes/” address to “Server” line
    Click to “Connect to Server” button.

    Now you must sent to “https://login.ubuntu.com/” over your default web browser when clicked to “Connect to Server”
    Take a login to your account by your mail address and passwd, click to “Continue” and wait a moment for logging in.
    Whe you logged in they asks you to add “this” computer connection list. Give a name for your already configuring computer and continue.
    Then you redirected to your computer “http://localhost:8000/” address you had to be saw “Tomboy Web Authorization Successful” page.

    Congrats, you are connected!

    Now you can return to tomboy notes application preferences and click to “Save” button to make everything permanent.
    It’s synchronizing now…. Aaand Voi’la! All your old notes back and everything setted up for re-use.

  • Yarım kalan SCP kopyalamayı devam ettirmek…

    Secure Copy ile dosya kopyalarken bağlantı sorunlarından kopyalamanın yarım kalmasına gıcık olup el mahkum yeniden kopyalamaya başlayıp bir o kadar daha vakit harcayanlardan mısınız? Artık buna mecbur değilsiniz…

    SCP ile yapılan kopyalamalarda genellikle büyük dosya transferleri yurdum internet distabilitesi yüzünden kıç ağrısı olmakta. Bunun çözümü ise RESUMEable scp kopyalaması başlatmaktan geçmekte. Diyeceksiniz ki SCP’nin resume özelliği yok. Evet yok! Ama Rsync ile kullanınca gayet güzel o işi görmekte =)

    Bunun için kopyalam için sadece SCP değil Rsync’le bileştirilmiş bir komut dizisi ile kopyalamalarınız kesintisiz devam edebilir, kesilse bile rsync sayesinde kaldığınız yerden devam edebilirsiniz. Bunun nasıl yapıldığı ise aşağıdaki komutla örneklenmiştir. Kolay gelsin:

    # rsync –partial –progress –rsh=ssh user@host:remote_file local_file

    Uzak sunucudan devastator boyutlarında dosya almak için bunun tam tersi işlem yapmak da mümkün. Sadece kaynak ve hedef adreslerin yerini değiştirmeniz yeterli.

  • Linux üzerinde USB Bellek ile Windows 7 kurulumu hazırlamak

    Windows 7’yi usb bellekten kurulabilir hale getirmemiz için elimizde minimum 4GB boyutlu bir usb bellek olmalıdır. Çünkü en düşük Win7 kurulum dvd boyutu 2.2GB’tır.

    USB Belleği bootable flag’ini açıyoruz ki usb stick’ten boot edebilsin. Daha sonra USB Belleği NTFS olarak formatlıyoruz. Formatlama işleminden sonra Win7 CD’sindeki tüm dosyaları olduğu gibi USB Belleğin root’una kopyalıyoruz.

    Kopyalama işlemi bittikten sonra şu adresteki kaynak dosyayı indiriyoruz: http://ms-sys.sourceforge.net/#Download

    Ben bu işlemi yaptığımda son stabil sürüm “2.2.1”di. Daha günceli varsa onu indirin.

    indirdiğiniz tar.gz dosyasını açıp aşağıdaki konutlar ile derleyip kurun:

    tar xvf ms-sys-2.1.5.tar.gz
    cd ms-sys
    make
    sudo make install
    Bu işlemden sonra ms-sys komutu ile usb belleğinizin master boot record'unu usb bellekten boot edilebilecek hale getiriyoruz.
    
    
    ms-sys -7 /dev/sdX

    Böylece USB'den Win7 kurabileceğimiz bir belleğimiz oluyor...

    Bundan sonra belleği kurulum yapacağınız bilgisayara takıp, bilgisayarın BIOS ayarlarını değiştirerek ya da BIOS'unuz yeterince marifetliyse, Boot menüsünden seçerek USB'den boot etmesini sağlamak...

  • squeeze/sid'e PostgeSQL entegreli eJabberD kurulumu

    apt-get install ejabberd postgresql

    mkdir ejabberd-modules
    :~$ svn checkout http://svn.process-one.net/ejabberd-modules ejabberd-modules
    :~$ cd ejabberd-modules/pgsql/trunk
    :~/ejabberd-modules/pgsql/trunk$ ./build.sh
    :~/ejabberd-modules/pgsql/trunk$ cd ebin
    :~/ejabberd-modules/pgsql/trunk/ebin$ sudo cp * /usr/lib/ejabberd/ebin/
    :~/ejabberd-modules/pgsql/trunk/ebin$ cd ~/
    :~$ wget http://svn.process-one.net/ejabberd/tags/ejabberd-2.1.2/src/odbc/pg.sql

    :~$ sudo su postgres -c psql template1
    Welcome to psql 8.2.7, the PostgreSQL interactive terminal. Type: copyright for distribution terms h for help with SQL commands ? for help with psql commands g or terminate with semicolon to execute query q to quit
    postgres=# ALTER USER postgres WITH PASSWORD ‘my_postgres_user_password_here’;
    ALTER ROLE
    postgres=# q

    :~$ sudo -u postgres createdb ejabberd
    :~$ sudo su postgres
    postgres@ubuntu:~$ psql ejabberd < pg.sql
    postgres@ubuntu:~$ exit
    :~$ sudo pico /etc/ejabberd/ejabberd.cfg

    Konfigürasyon ayarlarından aşağıdaki satırda ejabberd sunucusunun dns adresi yazılır:
    {hosts, [“my_xmpp_server_dns_here”]}.

    Dahili authentication kontrolünü sağlayan bu satırın başına %% işareti koyarak kapatıyoruz:
    %%{auth_method, internal}.

    Ardından ODBC authentication ayarını açıyoruz:
    {auth_method, odbc}.

    Bu satırda da yönetici tanımlıyoruz:
    {acl, admin, {user, “myadmin_username_here”, “my_xmpp_server_dns_here”}}.

    PostgreSQL Veritabanı erişimini ayarlamayı da unutmayalım:
    {odbc_server, {pgsql, “localhost”, “ejabberd”, “postgres”, “my_postgres_user_password_here”}}.

    Eğer gerekliyse aşağıdaki satırları da değiştirebilirsiniz:
    mod_last <-> mod_last_odbc >>PostgreSQL’de son login tarihi kaydı tutulması için.
    mod_offline <-> mod_offline_odbc >> PostgreSQL’de kullanıcı offline mesajlarını tutabilmesi için.
    mod_roster <-> mod_roster_odbc >>  PostgreSQL’de kontak listesi tutlabilmesi için.
    mod_vcard <-> mod_vcard_odbc >> PostgreSQL’de kullanıcı tanımlaması tutulması için.

    Dosyayı saklayın ve çıkın.