Detailed instructions for SargeBuild
From SIPfoundry sipx, The Open Source SIP PBX for Linux - Calivia
--Gwh 16:43, 3 Jun 2005 (CEST)
I seem to have over-formatted the README so I've wrapped it in a PRE-tag ... I will be splitting this into several pages later (unless someone does it for me :-) anyway.
--gh
Scripts to support SIPfoundry sipX PBX (on Debian Sarge).
--------
Version: 0.1
This stuff is not ready yet but as there are people reporting
trouble on the mailing list I am releasing it as-is.
It is somewhat over-complex as it has the following aims:
- build on any system (linux, or any unix)
- can be used to build packages (.deb - rpm already done)
- can be used by a developer who doesn't know anything
about the system or application except what is in the
source code
It will be split into separate pages eventually.
--------
Pre-requisites (just for the build tools):
Sarge installation including: 'make' (# apt-get install make)
An account in the 'staff' group. (# usermod -G staff user)
Text editor.
You will also need to install 'sudo' and copy the contents of
the sudoers file here into /etc/sudoers using 'visudo'.
Accounts:
sipxdata runs apache and the daemons (SIPXPBXUSER)
sipxadm runs the builds
These are variables in env-sipx.sh so you can change them
but you will have to change the corresponding sudoers entries.
I assume you want to build 2.8.1 but I have not built it without
building 2.6.2 which satisfies some of the pre-requisites - you
can just skip the jboss step for 2.6.2 and everything should
work.
--------
Install:
Edit: env-sipx.sh
Type: make
--------
Usage:
Type: bldSipx
If you have not already 'source'd env-sipx.sh it will spit out a line
which you can cut-and-paste.
If you are using version 2.8.1 (default is 2.6.2 unless you change it)
you will need to do:
V=2.8.1 . /usr/local/lib/sipx/env-sipx.sh
--------
Assumptions:
0. Start from debian-installer CD
http://www.debian.org/devel/debian-installer/
pick "business-card CD image" for i386 - 3 minute download,
2 minute burn
1. Base installation. Install from a mirror (I make a local mirror
of only the files I will use but that is another project and
is not documented sufficiently for release ... but it works
better than apt-move :-).
When asked for a user: "Admin HOSTNAME" (you don't have to do this).
The user name will return 'admin' (see below).
DONT Install ANY PACKAGES (you don't really have to do this):
Choose "Manual Selection" at the end of the install.
Aptitude will start but just quit (type q or Q).
2. System setup. Quick Version:
I do as much as I can from a comfortable work-station. See the
notes at the end (Using SSH and SUDO) for a guide.
apt-get install sudo [ must be done as root ]
sudo apt-get install ssh [ or omit 'sudo' and do it as root ]
From here, I assume you will use sudo or not as you see fit.
Run 'apt-get install' on the following lists. It will pull in
all the pre-requisites for these.
# personal EXAMPLE (what i need)
rcs emacs21 less perl-doc rsync
# required tools
perl-modules make
# sipx documented tools (make is above)
gcc g++ apache2 apache2-dev postgresql cppunit expat
automake1.9 libtool patch
# sipx documented libraries
libssl-dev libpcre3-dev libglib2.0-dev libcgicc1-dev libwww-ssl-dev
libxerces25-dev
# sipx UNdocumented (failed compiles will tell you these are needed)
libxp-dev libxtst6
# sipx UNdocumented (probably in minimum install for fedora)
bzip2 unzip
3. Setup System and Get Build pre-requisites and Source code.
Create file systems for the install (example below).
Create the sipxadm user (or redefine it as your account).
Create the sipxdata user.
Here is the example:
This layout is just for my convenience and agrees with what
is presently in env-sipx.sh.
hostname: womp
partitions: /womp01/
/womp02/
filesystems: /womp01/home
/womp02/apps
apps: /womp02/apps/java
/womp02/apps/sipx
Also I like to control UIDs with -u but you don't need to do that.
sudo mkdir /womp01/home
sudo useradd -D -s /bin/bash -b /womp01/home
sudo groupadd -g 2001 sipx
sudo useradd -g sipx -u 2001 -m sipxadm
sudo mkdir /womp02/apps
sudo useradd -d /womp02/apps/sipx -g sipx -u 2002 -m sipxdata
sudo useradd -g sipx -u 1001 -m guy
sudo usermod -G staff guy
sudo passwd guy
EDITOR=vi sudo visudo
Put 'guy' in the sudoers file. Add other stuff from ./sudoers
Copy authorized_hosts file to .ssh directories (guy, sipxadm)
[ See ssh setup below ]
Install the build scripts:
scp Makefile bldSipx env-sipx.sh wGet rc.sipx guy@womp:
ssh guy@womp
mkdir sipx
mv Makefile bldSipx env-sipx.sh wGet rc.sipx sipx
cd sipx
make
To get the SipX code (i ran wGet on my other box so this is fake):
chmod 755 wGet
sudo su - sipxadm
mkdir ar
mkdir ar/v2.8.1
cd ar/v2.8.2
~guy/sipx/wGet
The directory name must be the same as MY_SIPX_ARCHIVE in env-sipx.sh
You will also need to get the following (directory names don't matter)
~sipxadm/ar/d262
apache-ant-1.6.2-bin.tar.bz2
mod_cplusplus-1.5.1.tar.gz
sipx-jboss-configure.patch
ssl.pkcs12
JBoss-2.4.4_Tomcat-4.0.1.zip
tomcat_401.patch
j2sdk-1_4_2_08-linux-i586.bin
~sipxadm/ar/d280
jboss-4.0.1sp1.tar.gz
junit.jar
ssl.pkcs12
junit3.8.1.zip
sipx-jboss4-configure.patch
tomcat_401.patch
Some of these are not used until the configuration stage so they
are not mentioned below. The file "junit.jar" is extracted
from "junit3.8.1.zip". The zip file comes from the junit.org
web site (or whatever).
I also created:
mcpp-151-patch.tgz
which contains replacements:
src/
env_hash.cpp
env_value.cpp
example/handler/
test_handler.cpp
the original files generate warnings from gcc which abort the
build. The modifications required to turn off the warnings
are trivial but I have not sent them to the creator of
mod_cplusplus yet. Also "make check" fails with "interesting"
errors.
The script mkModCPP will install mod_cplusplus on your system
properly (and clean-up) but you need the patch tar-file so
I will attach it with this stuff.
4. Build pre-requisites.
Install Mod_cplusplus
# Easy :-)
cd ~/sipx
./mkModCPP
Type your own password for sudo when the script asks.
It installs the module as:
/usr/lib/apache2/modules/mod_cplusplus.so
NOT 'libmod_cplusplus.so'. You can edit the script if you like.
It also installs the header files in /usr/include/apache2/
(you need this).
Java, Ant, JBoss as documented.
sudo mkdir /womp02/apps/java/
sudo chown sipxdata:sipx /womp02/apps/java
sudo su - sipxadm
--- now we are sipxadm ( does not matter for java and ant )
cd /womp02/apps/java
~sipxadm/ar/d262/j2sdk-1_4_2_08-linux-i586.bin
tar jxf ~sipxadm/ar/d262/apache-ant-1.6.2-bin.tar.bz
Patch JBoss: 2.6.2 (can skip if you are doing 2.8.1)
# By this time you must have installed the build tool with
# the paths as you want them.
. /usr/local/lib/sipx/env-sipx.sh
unzip $MY_SIPX_ARCHIVE/d262/JBoss-2.4.4_Tomcat-4.0.1.zip
patch -d ${JBOSS_HOME} -p1 < \
$MY_SIPX_ARCHIVE/d262/sipx-jboss-configure.patch
# patch line above is broken using '\' (too long to fit).
You should see the output documented by sipfoundry.
Patch JBoss: 2.8.x ( since we are logged in as 'sipxadm', ~/ar
is the same as $MY_SIPX_ARCHIVE ).
tar zxf ~/ar/d280/jboss-4.0.1sp1.tar.gz
V=2.8.0 . /usr/local/lib/sipx/env-sipx.sh
cd $JBOSS_HOME
/womp02/apps/java/jboss-4.0.1sp1
cp -rp server/default server/sipx
echo $JBOSS_SERVER_CONF
patch -d ${JBOSS_HOME}/server/${JBOSS_SERVER_CONF} -p0 <
~/ar/d280/sipx-jboss4-configure.patch
You should see the output documented by sipfoundry.
cp ~/ar/d280/ssl.pkcs12 ${JBOSS_HOME}/server/${JBOSS_SERVER_CONF}/conf
One last thing. The "tack" lib will break if you try to install the
sipviewer. I think the "config" application will also break.
cp ~/ar/d280/junit.jar $ANT_HOME/lib
That seems to fix it.
5. Build Sipx
You should now be logged in as sipxadm.
. /usr/local/lib/sipx/env-sipx.sh
mkdir ~/bld
mkdir ~/log
If you neglect any of these steps above bldSipx will nag you.
bldSipx
Should output the version you are building and critical paths.
bldSipx -a
Will start building things and spitting out how long it takes.
If there is an error it will spit out the full path name of the
log file in which the error occurs and you can cut-and-paste
the name to 'tail' to see what the problem was.
If you forgot to set up sudoers, the build will abort on 'config'
because it needs sudo to do the install.
As configured this will build 2.6.2.
V=2.8.0 . /usr/local/lib/sipx/env-sipx.sh
bldSipx -a
and
V=2.8.1 . /usr/local/lib/sipx/env-sipx.sh
bldSipx -a
build the other versions.
Once they are done, you will definitely need to do the following:
# MAKE SURE MY_SIPX_HOME is set properly :-).
# AS sipxadm:
cd $MY_SIPX_HOME
chmod 2775 etc/sipxpbx var/log/sipxpbx var/run/sipxpbx \
var/sipxdata/sipdb var/tmp
# AS someone who can use sudo: [ these are root:sipx ]
cd $MY_SIPX_HOME/share/www/doc
sudo chmod 2775 vm_vxml aa_vxml
Configuration documentation will be produced once I've re-done
it (took weeks the first time :-).
--------
Using SSH and SUDO:
Substitute your personal user for 'admin' if you want.
Run all the stuff as 'root' instead of using sudo if you want.
Log in as root:
apt-get install sudo
EDITOR=vi visudo
If you omit 'EDITOR=vi ' you will be using 'nano' ...
Change the last line:
FROM: 'root ALL=(ALL) ALL'
TO: 'admin ALL=(ALL) ALL'
In vi that is: Gcwadmin<ESC>:wq
Log in as admin:
sudo apt-get install ssh
Backup the ssh-keys:
cd /etc
sudo tar zcf ~/ssh-HOST.tgz
cd
scp ssh-HOST.tgz USER@HOST:PATH/TO/ARCHIVE
Give yourself remote access:
mkdir .ssh
scp USER@HOST:.ssh/id_rsa.pub .ssh/authorized_keys
