再下面之前   我用測試用  所以用最小安裝   開啟網路後   應該不用我教吧   CENTOS 6 預設裝完是不開啟網路的

請至  /etc/sysconfig/neteork-script  下   

vi   cfg-eth0 

將boot = no 改成   yes

然後  service network restart

網路就通了

以下是實現過    最小安裝   然後裝起來的範例

因為裡面有缺一點東西      所以先裝一裝吧

 

執行 

yum -y install   git   

yum -y  install  gcc  

yum -y install  flex

yum -y install  bison  

yum -y install libmysqlclient-dev  

yum -y install make  

yum -y install libssl  

yum -y install libcurl 

yum -y install  libxml2 

 

 

  1. 安裝wget.
    yum install wget
    
  2. r建立  更新清單
    cd /etc/yum.repos.d/
    wget http://download.opensuse.org/repositories/home:/kamailio:/v4.4.x-rpms/CentOS_6/home:kamailio:v4.4.x-rpms.repo
    
  3.  更新所有.()  不過我並沒有更新   我先跳過這塊
    yum update
    
  4. 用YUM搜尋 kam相關元件:
    yum search kam
    

Install Kamailio and Required Database Modules(安裝 kamailio  與相關資料模組)

  1. 執行安裝.
    yum install -y kamailio kamailio-mysql kamailio-debuginfo kamailio-unixodbc kamailio-utils gdb
    
  2. 確認kamailio開機啟動.
    chkconfig kamailio on
    
  3. 變更資料權限.
    chown kamailio:kamailio /etc/default/kamailio
    chown -R kamailio:kamailio /etc/kamailio/
    mkdir /var/run/kamailio        (原廠並沒有產生   請自行開資料夾)
    chown -R kamailio:kamailio /var/run/kamailio
    

YUM安裝 MySQL

  1. YUM安裝MYSQL.
    yum install -y mysql-server mysql
    
  2. 服務啟動MYSQL:
    service mysqld start
    
  3. 設定MYSQL開機啟動.
    chkconfig mysqld on
    
  4. 然後設定MYSQL密碼:
  5.  輸入  /usr/bin/mysql_secure_installation

  6. 都按Y  就對了   

You can hit yes to all the options. There is no root password as of yet, so the first question will be blank. Be sure to use a secure unique password for your root user.

[root@localhost yum.repos.d]# sudo /usr/bin/mysql_secure_installation




NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n]
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
 ... Success!

Cleaning up...



All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

設定 Kamailio 支援 MySQL

  • 編輯 Kamailio支援MYSQL.
vi /etc/kamailio/kamctlrc
  1. 把 DBENGINE =MYSQL的  #拿掉:
    DBENGINE=MYSQL
    
  2. T把以下4個設定  都 # 拿掉
    ## database read/write user
    DBRWUSER="kamailio"
    
    ## password for database read/write user
    DBRWPW="kamailiorw"
    
    ## database read only user
    DBROUSER="kamailioro"
    
    ## password for database read only user
    DBROPW="kamailioro"
    

Create the Kamailio Database Schema

  • The Command will create all the users and tables needed by Kamailio. You will be prompted to put in the MySQL root password that you created in the Install MySQL section of this document. You will be asked if you want to install different tables – just say “yes” to all the questions.
    /usr/sbin/kamdbctl create
    
  • Below are all the prompts you will be presented:
    MySQL password for root: ''
    Install presence related tables? (y/n):
    Install tables for imc cpl siptrace domainpolicy carrierroute userblacklist htable purple uac pipelimit mtree sca mohqueue rtpproxy?
    (y/n):
    Install tables for uid_auth_db uid_avp_db uid_domain uid_gflags uid_uri_db? (y/n):
    
  • The following MySQL users and passwords are created (please change these in a production environment).

     

  • kamailio – (With default password ‘kamailiorw’) – user which has full access rights to ‘kamailio’ database.

  • kamailioro – (with default password ‘kamailioro’) – user which has read-only access rights to ‘kamailio’ database.

Enable the mysql and auth modules.

Add the following to the beginning of the kamailio.cfg after #!KAMAILIO

#!define WITH_MYSQL
#!define WITH_AUTH

Update the DBURL line to match the username and password you set in kamctlrc before running kamdbctl

#!define DBURL "mysql://kamailio:kamailioro@localhost/kamailio"

Start the Kamailio Server

service kamailio start
We also need to edit /etc/default/kamailio to notify Kamailio that is is configured and ready to go.

Uncomment the following:

RUN_KAMAILIO=yes

Test Kamailio

  • In order to test that Kamailio is working correctly, I’m going to create a SIP user account and register that account using a softphone such as X-Lite, Linphone, or Zoiper.

Create SIP User Accounts

  • The following command will create a new SIP User. Note, that hte domain portion has to be specified unltess you export hte SIP_DOMAIN environment variable.
    kamctl add <extension@domain> 
    
  • Here is what I created
    kamctl add 1001@dopensource.com opensourceisneat
    

Registering a SIP Softphone

  • configure whichever softphone you choose with the following options:
    User ID: 1001
    Domain:
    Password: opensourceisneat
    
  • Once you are registered, you can view all the registered extensions in kamailio with the following command.
    kamctl ul show
arrow
arrow
    全站熱搜

    安德森 發表在 痞客邦 留言(0) 人氣()