欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

opensips源代碼安裝與配置的技巧方法

 更新時間:2013年04月19日 09:20:03   作者:  
本篇文章小編為大家介紹,opensips源代碼安裝與配置的技巧方法。需要的朋友參考下

1.源代碼下載

1.1 opensips源碼包下載

  最新的opensips下載位置:http://opensips.org/pub/opensips/latest/src/

  所有版本的opensips下載位置:http://opensips.org/pub/opensips/

1.2 opensips依賴包下載

  源代碼安裝軟件要注意查看README,INSTALL等文件,這些文件里有很重要的說明和安裝信息。

  在INSTALL文件中有opensips所依賴的軟件包的說明,這里僅缺少如下幾個軟件包:

  1) bison or yacc (Berkley yacc)

  2) flex

  3) libncurses5-dev and m4

  缺少什么軟件包可以選擇在線安裝或下載源代碼包安裝。

  $apt-cache search xxxx   搜索軟件包

  $apt-get install xxxxx   安裝軟件包

  ./configure,make,sudo make install  源代碼安裝的一般步驟

1.2.1 bison

    bison的安裝依賴m4, m4 是一個宏處理器,將輸入拷貝到輸出,同時將宏展開。
    m4下載地址為:ftp://ftp.gnu.org/gnu/m4/
    GNU http://www.gnu.org/software/bison/ 中對bison的介紹。
    下載源代碼包地址:http://ftp.gnu.org/gnu/bison/
    安裝bison很簡單:./configure,make,sudo make install

1.2.2 flex

      使用google搜索linux flex,不要用baidu!

  flex是最快的詞法分析器。flex:The Fast Lexical Analyzer,網(wǎng)址:http://flex.sourceforge.net/

  如下鏈接中說明了在ubuntu系統(tǒng)中安裝flex的具體過程。flex也依賴m4宏處理包,同上。

http://www.geeksww.com/tutorials/operating_systems/linux/installation/installing_flex_fast_lexical_analyzer_ubuntu_linux.php

  選擇一個版本下載后,解壓安裝,./configure,make,sudo make install

  以上就是我安裝opensips的過程中缺少的包,如果還缺少什么包都會提示的,下載安裝即可。

2.opensips安裝

2.1 安裝

   INSTALL文件中有關(guān)于opensips安裝的說明:

  最簡單的安裝方法:

  $make all

  $sudo make install

   注意事項:如果在安裝的過程中使用了prefix選項,那就必須要在前面的編譯中也使用prefix選項,并且使用的目錄

也是相同的。如果沒有按照這樣做的話,那就會導(dǎo)致opensips找不到默認(rèn)的配置文件,也就是說opensips會在錯誤的

目錄中尋找配置文件。因為中編譯階段,默認(rèn)的配置文件目錄已經(jīng)被硬編碼到opensips中。

   默認(rèn)安裝的位置為/usr/local,而使用了prefix則指定了安裝目錄。

  1)一個錯誤的例子:  make all  make prefix=/ install  2)正確的使用方法:  make prefix=/ all  make prefix=/ install 2.2 卸載方法(個人想法)

  如果將opensips安裝在/usr/local下,則與opensips相關(guān)的文件所在的位置如下所示:  /usr/local/etc/opensips   /usr/local/sbin/opensips*   /usr/local/lib/opensips   此時如果想把opensips安裝在根目錄下 / ,則需要卸載opensips,方法是刪除以上目錄中的文件。2.3 安裝后目錄結(jié)構(gòu)

       opensips安裝之后的文件目錄:

       /sbin/中的可執(zhí)行命令有如下:opensips 、opensipsctl  、  opensipsdbctl  、 opensipsunix

       /etc/opensips/中的配置文件有:opensips.cfg、opensipsctlrc和osipsconsolerc

       /lib/opensips/中的庫文件有:modules/ 和 opensipsctl/兩個目錄。modules/ 為當(dāng)前opensips所支持的模塊,

opensipsctl/中是/sbin中啟動命令要使用到的文件。

3.opensips啟動

3.1 opensips命令啟動

  $sudo opensips3.2 opensipsctl命令啟動

  啟動opensips命令: $sudo opensipsctl start

  如果出現(xiàn)一下錯誤:

  INFO: Starting OpenSIPS :

  ERROR: PID file /var/run/opensips.pid does not exist -- OpenSIPS start failed

  可以查看系統(tǒng)日志來檢查失敗的原因:

  $tail –n 20 /var/log/syslog

  1) 錯誤一:ERROR:core:daemonize: unable to create pid file /var/run/opensips.pid: Permission denied

   解決方法:這個問題就是權(quán)限問題,在命令前加上sudo。

  2)  錯誤二:ERROR:core:main:loading config file(/usr/local/etc/opensips/opensips.cfg):No such file or directory

   分析:這個問題就是啟動配置文件找不到。經(jīng)過分析發(fā)現(xiàn)opensips從/usr/local/中讀取默認(rèn)配置文件,原因是

犯了2.1節(jié)中的錯誤,在編譯時使用默認(rèn)的路徑/usr/local/,而在安裝時使用prefix=/選項,這就導(dǎo)致了配置文件找不到。

   解決方法:make clean, make prefix=/ all, sudo make prefix=/ install重新編譯安裝,然后啟動opensips。

4.opensips配置文件

  opensips的配置文件都在/etc/opensips/中,分別為opensips.cfg、opensipsctlrc和osipsconsolerc。

  opensips.cfg文件主要用于opensips啟動的配置,所有應(yīng)用功能的配置都在這個文件中說明。該配置文件主要由

三個部分組成:

       第一部分是全局變量,如:

       listen=udp:127.0.0.1:5060

       disable_tcp=yes

       disable_tls=yes等。

       第二部分主要用來加載模塊,并設(shè)置相應(yīng)參數(shù),如:

       loadmodule "db_mysql.so"

       loadmodule "auth.so"

       loadmodule "auth_db.so"

       modparam("auth", "calculate_ha1", yes)

       modparam("auth_db", "password_column", "password")等。

       第三部分主要是路由策略和功能應(yīng)用,如:

       route[relay] {

              # for INVITEs enable some additional helper routes

              if (is_method("INVITE")) {

              t_on_branch("per_branch_ops");

              t_on_reply("handle_nat");

              t_on_failure("missed_call");

       }

       ……

}

       opensipsctlrc文件中包含了數(shù)據(jù)庫配置的信息。

相關(guān)文章

最新評論