HowTo install sipX 3.8 on Gentoo

From SIPfoundry sipx, The Open Source SIP PBX for Linux - Calivia

Jump to: navigation, search
Important note: Work in progress : Not ready for production use

Contents

Overlay

To install the sipXecs overlay, the easiest way is to use layman. Layman is a tool designed to help overlay's managment. More informations on the website. Start with layman and his companion, subversion (should be enabled by dependencies).

Code: Install Layman
emerge -av layman subversion

Fetch a fresh copy of overlays listed :

Code: Get a list of overlays
layman --fetch

And now add sipXecs

Code: Add sipX
layman --add sipx

To let portage know about your new overlay, add a line at the end of make.conf :

Code: Configure portage
echo "source /usr/portage/local/layman/make.conf" >> /etc/make.conf

Now, you are ready to process with the sipXECS installation.

Install sipX

sipXecs are marked as developpement packages, and your system should not allow to pull sipX as is. You have to unmask them.

Unmask Masked Packages

File: /etc/portage/package.keywords - Enable Masked Packages
 =net-misc/sipxportlib-3.8.1 ~x86
 =net-misc/sipxtacklib-3.8.1 ~x86
 =net-misc/sipxcommserverlib-3.8.1 ~x86
 =net-misc/sipxmedialib-3.8.1 ~x86
 =net-misc/sipxmediaadapterlib-3.8.1 ~x86
 =net-misc/sipxcalllib-3.8.1 ~x86
 =net-misc/sipxvxml-3.8.1 ~x86
 =net-misc/sipxpublisher-3.8.1 ~x86
 =net-misc/sipxproxy-3.8.1 ~x86
 =net-misc/sipxregistry-3.8.1 ~x86
 =net-misc/sipxconfig-3.8.1 ~x86
 =net-misc/sipxpbx-3.8.1 ~x86

Emerge sipXpbx

Now you are ready to emerge the sipXpbx package. This will emerge all required packages. This can be a very long list, depending on what you already have installed on your machine.

All SIPfoundry sipXpbx development ebuilds are masked with the ~x86 keyword. Make sure they are unmasked (see above).

Code: Emerge sipXpbx
 emerge -av net-misc/sipxpbx

 # or, if you're re-emerging without unmerging first
 emerge -av sipxportlib sipxtacklib sipxmedialib sipxmediaadapterlib sipxcalllib sipxcommserverlib
 emerge -av sipxvxml sipxregistry sipxproxy sipxpublisher sipxconfig sipxpbx

Create self-signed SSL Server Key and Certificate

The sipX Configuration Server requires a certificate for authentication purposes. The following describes how to generate a self signed cert - the easiest way and for test purposes secure enough.

Code: Generate valid SSL certificate
mkdir /etc/sipxpbx/sslkeys && cd /etc/sipxpbx/sslkeys
/usr/bin/ssl-cert/gen-ssl-keys.sh
  enter the data as requested (anything works):
     - CA Common Name (DNS name for CA): Enter anything but NOT the DNS name of your server, e.g. ca.domain.tld
     - SIP Domain Name: Enter your domain name for which DNS SRV is setup for SIP
     - Server Common Name (DNS name for Server): Enter fully qualified hostname of your sipX server
/usr/bin/ssl-cert/install-cert.sh

NOTE: You may need to specify the hostname when executing install-cert.sh.


Initialize and Configure the PostgreSQL Database

If this is a brand new installation of PostgreSQL, then the database cluster needs to be initialised as follows:

Code: Initial Setup
emerge --config dev-db/postgresql

Start and add PostgreSQL to the default runlevel

In order to start Postgres anytime when the system is booted execute the following:

Code: Start and add Postgres to the startup script
/etc/init.d/postgresql start
rc-update add postgresql default

Creating the database and starting sipX

To drop an existing database do the following:

Code: Drop the database
# make sure sipxpbx is not currently running
/etc/init.d/sipxpbx stop
/usr/bin/sipxconfig.sh --database drop

To create the database do the following:

Code: Create the database
/usr/bin/sipxconfig.sh --setup

Update the environment:

Code: Update the environment
env-update && source /etc/profile

To start sipXpbx do the following:

Option 1: using the sipXpbx init script

Code: Starting sipX
/etc/init.d/sipxpbx start

Option 2: using the preliminary Gentoo runscript

The preliminary Gentoo runscript takes care of the runtime dependency with postgresql and the configured TFTP server (if any). It will start both postgresql and in.tftpd (if configured to do so in /etc/conf.d/sipxpbx).

NOTE: The paths below are not standard 'layman' paths. They should be more like /usr/portage/local/layman/sipx/net-misc/sipxpbx... Also, the example conf.d/sipxpbx file seems to be missing from the overlay. --sj

Note: Messages on startup are not yet finished. You will see less output by the script than with the original one.

Code: Starting sipX
# move the original script away for reference
mv /etc/init.d/sipxpbx /etc/init.d/sipxpbx.orig

# create links for the preliminary runscript and config file
ln -s /usr/local/portage/net-misc/sipxpbx/files/conf.d/sipxpbx /etc/conf.d/sipxpbx
ln -s /usr/local/portage/net-misc/sipxpbx/files/init.d/sipxpbx /etc/init.d/sipxpbx

/etc/init.d/sipxpbx start

There should be no errors reported during startup.

Alternatively you can only start configServer:

Code: Start sipXconfig only
su sipx
/usr/bin/sipxconfig.sh

Login to the sipXconfig Web interface: Point your Web browser to http://sipx.your.domain. Set a password for user superadmin and log in.

OpenBSD TFTP server

To provision your phones automatically via sipXpbx configserver you need to setup a tftp server.

Code: Emerge OpenBSD TFTP server
emerge -av net-ftp/tftp-hpa

Make sure the path is set to the configserver tftproot directory before you start the tftp server.

File: /etc/conf.d/in.tftpd
# set tftproot to sipxconfig tftproot directory
INTFTPD_PATH="/var/sipxdata/configserver/phone/profile/tftproot/"

The Gentoo initscript will eventually take care of this (check for in.tftpd and start it if not running). For now, make sure in.tftpd gets started at boot.

Code: Start OpenBSD TFTP server
/etc/init.d/in.tftpd start
# add in.tftpd to the default runlevel
rc-update add in.tftpd default


Proposal: use system apache vhosting

I much cleaner approch for the apache configuration is to use the virtal hosting capabilities, to let your server serve other web pages as well (and make the webserver less sipX centric).

recompile apache

First, you have to modify your apache webserver to use suEXEC :

Code: Emerge apache
 USE=suexec SUEXEC_MINUID=100 SUEXEC_DOCROOT=/usr/share/webapps emerge apache
  • SUEXEC_MINUID (default 1000) : define the minimum UID allowed for su into. This is needed because sipx uid is arroud 100 on most gentoo servers
  • SUEXEC_DOCROOT (default /var/www) : Because we use default config, they are in /usr/share/webapps/

Then change the ownership of CGI scripts and let the sipx user update the dialplan :

Code: Correct ownership
chown -R sipx:sipx /usr/share/webapps/sipxpbx/3.8.1/cgi-bin/
chown sipx:sipx /usr/share/webapps/sipxpbx/3.8.1/doc/aa_vxml -R

Troubleshooting

Personal tools