从源码编译安装sipx4.0(CENTOS 操作系统)

 前提: 安装centos5操作系统。

一.关闭防火墙

二.Disable SELinux

File: /etc/selinux/config
SELINUX=disabled

三.安装开发工具

   yum install gcc gcc-c++ autoconf automake libtool subversion doxygen rpm-build zip /
httpd-devel openssl-devel jpackage-utils which unzip /
pcre-devel expat-devel unixODBC-devel createrepo /
jakarta-commons-beanutils jakarta-commons-collections jakarta-commons-net /
ant log4j junit ant-commons-logging ant-junit ant-trax ant-nodeps /
mod_ssl postgresql-server libXp zlib-devel postgresql-devel ruby ruby-devel

yum install libpng-devel libart_lgpl-devel freetype freetype-devel oro scons

 

wget ftp://mirror.switch.ch/pool/1/mirror/epel/5/x86_64/scons-0.98.1-1.el5.noarch.rpm
rpm -i scons-0.98.1-1.el5.noarch.rpm

yum install rpmdevtools redhat-rpm-config

yum install alsa-lib-devel curl-devel gnutls-devel lzo-devel gdbm-devel /
mysql-devel ncurses-devel python-devel perl-devel perl-ExtUtils-Embed termcap

 yum install rubygems rubygem-rake ruby-postgres w3c-libwww-devel cppunit-devel /
   xerces-c-devel
gem install file-tail     # Run this twice if it fails the first time.

 wget -P /etc/yum.repos.d http://sipxecs.sipfoundry.org/temp/sipXecs/sipxecs-unstable-centos.repo
yum install cgicc-devel java-1.6.0-sun-devel ruby-dbi rubygems w3c-libwww-devel cppunit /
    ruby-postgres xerces-c-devel jakarta-commons-net nsis sipx-freeswitch
gem install rake
gem install file-tail

yum install bind

四.配置DHCP和DNS

1.配置域名

File: /etc/hosts
A host that was assigned a fixed IP address:
127.0.0.1               localhost.localdomain localhost
192.168.5.145           sipx.example.com sipx
2.安装DHCP
yum install dhcp
3.配置DHCP服务器
rndc-confgen -a
File: Generated /etc/rndc.key file
 key "rndckey" {
        algorithm hmac-md5;
        secret "JIjUPfT2GZZ172o5IdcK1Q==";#这里的key每个人是不同的
 }; 
 
          
File: /etc/dhcpd.conf
 authoritative;              # No other DHCP servers on this subnet
 ddns-update-style interim;  # Supported update method - see man dhcpd.conf
# ddns-update-style ad-hoc;  # Add this instead of "interim" if not using ddns
 ignore client-updates;      # Overwrite client configured FQHNs
 ddns-domainname "domain.com.";
 ddns-rev-domainname "in-addr.arpa.";



 key rndckey {               # Key for DNS updates
    algorithm hmac-md5;
    secret "JIjUPfT2GZZ172o5IdcK1Q=="; # 同上边 /etc/rndc.key中的内容
 };

 zone domain.com. {          # Forward zone to be updated
    primary 127.0.0.1;
    key rndckey;
 }

 zone 5.168.192.in-addr.arpa. { # Backward zone to be updated
    primary 127.0.0.1;
    key rndckey;
 }

subnet 192.168.5.0 netmask 255.255.255.0 {

  range                         192.168.5.200 192.168.5.250;
  default-lease-time            21600;
  max-lease-time                43200;

  option routers                192.168.5.1;   # Default gateway
  option subnet-mask            255.255.255.0;
  option domain-name            "example.com";
  option domain-name-servers    192.168.5.145; # loopback address does not work here

#  option nis-domain            "example.com";

  option time-offset            -18000;        # Eastern Standard Time
  option tftp-server-name       "sipx.example.com";  # required for phones to pickup profiles

  option ntp-servers            192.168.5.145;
# option netbios-name-servers   192.168.5.145;
# option netbios-node-type      8; # try WINS servers first, broadcast if necessary

# Example for resource reservations:
#       host xyz {
#               ddns-hostname "host.example.com";  # use for hosts that do not send a hostname
#               hardware ethernet 12:34:56:78:AB:CD;
#               fixed-address 192.168.5.x;
#       }
}
4.启动DHCP
/sbin/service dhcpd start

五.配置DNS服务器

 

1.文件 /etc/named.conf

The following two sections were added automatically when running the rndc-confgen -a command:

controls {
       inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
include "/etc/rndc.key";

The following options section and two zone definitions were added manually:

options {
       directory "/var/named";
       dump-file "/var/named/data/cache_dump.db";
       statistics-file "/var/named/data/named_stats.txt";
};
zone "example.com" IN {
       type master;
       file "example.com.zone";
       allow-update { key "rndckey"; };
       notify yes;
};
zone "5.168.192.in-addr.arpa" {
       type master;
       file "192.168.5.zone";
       allow-update { key "rndckey"; };
       notify yes;
};
2.文件 /var/named/example.com.zone
;
; Zone file for domain.com
;

$TTL 3D
@       IN      SOA    ns1.example.com. root.example.com. (
                       200602132       ; serial#
                       3600            ; refresh, seconds
                       3600            ; retry, seconds
                       3600            ; expire, seconds
                       3600 )          ; minimum TTL, seconds

                NS     ns1.example.com.   ; Inet Address of nameserver
example.com.     MX     10 mail           ; Primary Mail Exchanger
;
localhost       A      127.0.0.1
sipx            A      192.168.5.145     ; Record of class IN by default

_sip._udp       SRV    100     1       5060    sipx
_sip._tcp       SRV    200     1       5060    sipx
_sips._tcp      SRV    300     1       5060    sipx

ns1             CNAME  sipx
mail            CNAME  sipx
3.文件 /var/named/192.168.5.zone
;
; Reverse zone file for domain.com
;

$TTL 3D
@       IN      SOA    ns1.example.com. root.example.com. (
                       200602132       ; serial#
                       3600            ; refresh, seconds
                       3600            ; retry, seconds
                       3600            ; expire, seconds
                       3600 )          ; minimum TTL, seconds

                NS     ns1.example.com.   ; Inet Address of nameserver
;
1               PTR    localhost.
145             PTR    sipx.example.com.

; Don't specify any reverse pointer records for addresses in the
; DHCP range. Dynamic updates will define those as necessary.
4.改变zone文件的拥有权限

In order for the named server to be able to update the zone files as it receives dynamic update requests from the DHCP server, it has to have write permission for all the zone files. If you created your zone files as root, you have to change permissions as follows:

cd /var/named
chown named:named *
5.赋予 named 对Zone 文件的写权限

If SELinux is disabled (required for sipX), then allow named to write its zone files and create files in its $ROOTDIR/var/named directory; this is necessary for dynamic updates (DDNS) and slave zone transfers.

5.赋予 named 对Zone 文件的写权限

If SELinux is disabled (required for sipX), then allow named to write its zone files and create files in its $ROOTDIR/var/named directory; this is necessary for dynamic updates (DDNS) and slave zone transfers.

File: /etc/sysconfig/named
# This line needs to be added 
 ENABLE_ZONE_WRITE=yes
# This line enables the chroot and was configured automatically when installing the chroot jail
 ROOTDIR=/var/named/chroot  

 

6.文件/etc/resolv.conf

search example.com
nameserver 127.0.0.1
7.启动 DNS Server 
 
  
/sbin/service named start

六.建立工作目录

 mkdir WORKING
cd WORKING
七.svn获取源码

   svn co -q http://sipxecs.sipfoundry.org/rep/sipXecs/main/
八.下载编译用的shell脚本,并运行

wget http://sipxecs.sipfoundry.org/rep/sipXecs/main/extras/express_devel/devel_build_install.sh
chmod +x devel_build_install.sh
./devel_build_install.sh

 

#!/bin/bash # # Copyright (C) 2008 Nortel, certain elements licensed under a Contributor Agreement. # Contributors retain copyright to elements licensed under a Contributor Agreement. # Licensed to the User under the LGPL license. # ################################################### # See http://sipx-wiki.calivia.com/index.php/Express_Development_Environment_Setup for instructions. # Clean up the old (which may not even exist...) if test -x /etc/init.d/sipxpbx then sudo /sbin/service sipxpbx stop elif test -x /etc/init.d/sipxecs then sudo /sbin/service sipxecs stop fi sudo killall httpd # You can override the CODE directory, relative to the current directory. INSTALL=INSTALL BUILD=BUILD CODE=main LINKS=links EDE_LOGS=ede_logs if [ $# -gt 0 ] then CODE=$1 fi if [ ! -d $CODE ]; then echo "Error: Directory './$CODE' does not exist." exit 1 fi echo INSTALL=`pwd`/$INSTALL > env echo BUILD=`pwd`/$BUILD >> env echo CODE=`pwd`/$CODE >> env echo LINKS=`pwd`/$LINKS >> env sudo rm -rf $INSTALL $BUILD $LINKS $CODE/lib/freeswitch/dist $EDE_LOGS mkdir $INSTALL mkdir $BUILD mkdir $EDE_LOGS FULL_PATH_EDE_LOGS=`pwd`/$EDE_LOGS # Easy scripts to start, stop, restart, and get status. echo sudo `pwd`/$INSTALL/etc/init.d/sipxecs start > /tmp/sstart sudo mv /tmp/sstart /usr/bin/ sudo chmod a+rx /usr/bin/sstart echo sudo `pwd`/$INSTALL/etc/init.d/sipxecs stop > /tmp/sstop sudo mv /tmp/sstop /usr/bin/ sudo chmod a+rx /usr/bin/sstop echo sudo `pwd`/$INSTALL/etc/init.d/sipxecs status > /tmp/sstatus sudo mv /tmp/sstatus /usr/bin/ sudo chmod a+rx /usr/bin/sstatus echo sudo `pwd`/$INSTALL/etc/init.d/sipxecs stop > /tmp/srestart echo sudo `pwd`/$INSTALL/etc/init.d/sipxecs start >> /tmp/srestart sudo mv /tmp/srestart /usr/bin/ sudo chmod a+rx /usr/bin/srestart # Get ready to build RPMs. mv ~/.rpmmacros ~/.rpmmacros.old 2> /dev/null rpmdev-setuptree # Configure and compile FreeSWITCH RPMs. pushd $CODE/lib/freeswitch rm -rf dist autoreconf -if if [ $? != 0 ] then echo "Error: FreeSWITCH autoreconf failed, see console output." exit 2 fi ./configure SIPXPBXUSER='whoami' &> $FULL_PATH_EDE_LOGS/fs_configure_output.txt if [ $? != 0 ] then echo "Error: FreeSWITCH configure failed, see $EDE_LOGS/fs_configure_output.txt." exit 3 fi sudo make &> $FULL_PATH_EDE_LOGS/fs_make_output.txt if [ $? != 0 ] then echo "Error: FreeSWITCH RPM build failed, see $EDE_LOGS/fs_make_output.txt." exit 4 fi # Uninstall any old FreeSWITCH RPMs. for fs_old_rpm in `rpm -qa | grep sipx-freeswitch` do sudo rpm --erase --nodeps $fs_old_rpm &> $FULL_PATH_EDE_LOGS/fs_install_output.txt if [ $? != 0 ] then echo "Error: FreeSWITCH old RPM uninstall failed, see $EDE_LOGS/fs_install_output.txt" exit 5 fi done # Install the new FreeSWITCH RPMs. sudo yum -y localinstall dist/RPM/*.rpm &> $FULL_PATH_EDE_LOGS/fs_install_output.txt if [ $? != 0 ] then echo "Error: FreeSWITCH RPM install failed, see $EDE_LOGS/fs_install_output.txt." exit 6 fi popd # Configure, compile, test, and installi sipXecs. pushd $INSTALL FULL_INSTALL_PATH=`pwd` popd pushd $CODE FULL_CODE_PATH=`pwd` autoreconf -if if [ $? != 0 ] then echo "Error: sipXecs autoreconf failed, see console output." exit 7 fi popd pushd $BUILD $FULL_CODE_PATH/configure --srcdir=$FULL_CODE_PATH --cache-file=`pwd`/ac-cache-file SIPXPBXUSER=`whoami` JAVAC_DEBUG=on --prefix=$FULL_INSTALL_PATH --enable-reports --enable-agent --enable-cdr --enable-conference &> $FULL_PATH_EDE_LOGS/configure_output.txt if [ $? != 0 ] then echo "Error: sipXecs configure failed, see $EDE_LOGS/configure_output.txt." exit 8 fi make recurse TARGETS="all install" &> $FULL_PATH_EDE_LOGS/make_output.txt if [ $? != 0 ] then echo "Error: sipXecs build/install failed, see $EDE_LOGS/make_output.txt." exit 9 fi popd # This is needed so often, we might as well make it easily available with "sudo /sbin/service sipxecs xxx", # and started automatically after reboot. sudo rm -rf /etc/init.d/sipxecs sudo ln -s $FULL_INSTALL_PATH/etc/init.d/sipxecs /etc/init.d/sipxecs # Cause the logs to be rotated. sudo rm -rf /etc/logrotate.d/sipxchange sudo ln -s $FULL_INSTALL_PATH/etc/logrotate.d/sipxchange /etc/logrotate.d/sipxchange sudo rm -rf /etc/logrotate.d/freeswitch sudo ln -s $FULL_INSTALL_PATH/etc/logrotate.d/freeswitch /etc/logrotate.d/freeswitch # Adjust the TFTP/FTP directory. TFTP_PATH=$FULL_INSTALL_PATH/var/sipxdata/configserver/phone/profile/tftproot ruby -e 'path=""; ARGV[0].split("/").each {|x| path+=x+"/"; `sudo chmod g+x #{path}`}' $TFTP_PATH sudo rm -rf /tftpboot sudo ln -s $TFTP_PATH /tftpboot # Clear any database contents that might be left over from the last install. $FULL_INSTALL_PATH/bin/sipxconfig.sh --database drop create &> $FULL_PATH_EDE_LOGS/sipxconfig_drop_create.log $FULL_INSTALL_PATH/bin/sipxconfig.sh --first-run &> $FULL_PATH_EDE_LOGS/sipxconfig_first-run.log # Fix FreeSWITCH sudo $FULL_INSTALL_PATH/bin/freeswitch.sh --configtest &> $FULL_PATH_EDE_LOGS/freeswitch_configtest.log # Create some helpful links. mkdir $LINKS pushd $LINKS ln -s $FULL_INSTALL_PATH/var/log/sipxpbx log ln -s $FULL_INSTALL_PATH/var/sipxdata/configserver/phone/profile/tftproot tftproot ln -s $FULL_INSTALL_PATH/var/sipxdata/sipdb sipdb ln -s $FULL_INSTALL_PATH/etc/sipxpbx home ln -s $FULL_INSTALL_PATH/bin bin ln -s $FULL_INSTALL_PATH/share/sipxecs/process.d process.d popd # sipxecs-setup $FULL_INSTALL_PATH/bin/sipxecs-setup # Restart sipXecs twice. This gets around the "httpd-sipxchange-common-ssl.conf: No # such file or directory" error on first start, and I've also seen it fix the # a "Resource Required" state for services. echo "" echo "Restarting sipXecs twice...." srestart sleep 10 srestart sstatus echo "" echo "TO START : sstart" echo "TO STOP : sstop" echo "TO RESTART : srestart" echo "TO GET STATUS: sstatus" echo "" echo "ENV:" cat env echo "" echo "DONE!"
九.重新编译源码

make recurse TARGETS="all install"

make build

你可能感兴趣的:(从源码编译安装sipx4.0(CENTOS 操作系统))