[asterisk-users] Newbie Asterisk: Install Asterisk as non-root
Lee, John (Sydney)
John.Lee at compuware.com
Fri May 16 03:04:20 CDT 2008
First of all, thanks Philipp, Alan, Tzafrir and James for your valuable
comments. I have listed below the exact list of commands to run for
reinstalling asterisk 1.4.* as non-root on a Redhat / Fedora distro.
Hope others can benefit.
I have the following comments/questions though:
1) #####What is safe_asterisk used for actually? I did not touch it in
my modification because I don't know when is it triggered?
2) #####I do not actually know whether we really need to modify
/etc/asterisk/asterisk.conf? Is this file read by asterisk at all?
Seems like an important file name - asterisk.conf?
3) It is safer to define a user called asterisk in group asterisk unless
you want to make more changes to 2 files i.e. zaptel.rules and
/etc/init.d/asterisk
4) There is an additional chmod to run for letting voicemail.conf to be
written by group asterisk.
# /etc/init.d/asterisk stop
Shutting down asterisk: [ OK ]
----------------------------------------------------
# /usr/sbin/groupadd asterisk
----------------------------------------------------
# /usr/sbin/useradd -d /var/lib/asterisk -g asterisk asterisk
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
----------------------------------------------------
# cp Makefile Makefile.org
----------------------------------------------------
***
*** Change the following line from:
***
*** ASTVARRUNDIR=$(localstatedir)/run
***
*** to
***
*** ASTVARRUNDIR=$(localstatedir)/run/asterisk
***
# vi Makefile
[...]
ifeq ($(OSARCH),SunOS)
ASTETCDIR=/var/etc/asterisk
ASTLIBDIR=/opt/asterisk/lib
ASTVARLIBDIR=/var/opt/asterisk
ASTSPOOLDIR=/var/spool/asterisk
ASTLOGDIR=/var/log/asterisk
ASTHEADERDIR=/opt/asterisk/include
ASTBINDIR=/opt/asterisk/bin
ASTSBINDIR=/opt/asterisk/sbin
ASTVARRUNDIR=/var/run/asterisk
ASTMANDIR=/opt/asterisk/man
else
ASTETCDIR=$(sysconfdir)/asterisk
ASTLIBDIR=$(libdir)/asterisk
ASTHEADERDIR=$(includedir)/asterisk
ASTBINDIR=$(bindir)
ASTSBINDIR=$(sbindir)
ASTSPOOLDIR=$(localstatedir)/spool/asterisk
ASTLOGDIR=$(localstatedir)/log/asterisk
ASTVARRUNDIR=$(localstatedir)/run/asterisk
ASTMANDIR=$(mandir)
[...]
----------------------------------------------------
cd /usr/src/asterisk-1.4
make clean
./configure
make
make install
----------------------------------------------------
***
*** Don't panic!
*** /var/run/asterisk should just be an empty directory but should just
exist.
***
----------------------------------------------------
# chown --recursive asterisk:asterisk /var/lib/asterisk
# chown --recursive asterisk:asterisk /var/log/asterisk
# chown --recursive asterisk:asterisk /var/run/asterisk
# chown --recursive asterisk:asterisk /var/spool/asterisk
# chown --recursive asterisk:asterisk /usr/lib/asterisk
# chown --recursive asterisk:asterisk /dev/zap
----------------------------------------------------
# chmod --recursive u=rwX,g=rX,o= /var/lib/asterisk
# chmod --recursive u=rwX,g=rX,o= /var/log/asterisk
# chmod --recursive u=rwX,g=rX,o= /var/run/asterisk
# chmod --recursive u=rwX,g=rX,o= /var/spool/asterisk
# chmod --recursive u=rwX,g=rX,o= /usr/lib/asterisk
# chmod --recursive u=rwX,g=rX,o= /dev/zap
----------------------------------------------------
# chown --recursive root:asterisk /etc/asterisk
# chmod --recursive u=rwX,g=rX,o= /etc/asterisk
----------------------------------------------------
# cp /etc/asterisk/asterisk.conf /etc/asterisk/asterisk.conf.org
# vi /etc/asterisk/asterisk.conf
***
*** Change the following line from:
***
*** astrundir => /var/run
***
*** to
***
*** astrundir => /var/run/asterisk
***
----------------------------------------------------
# cp /etc/init.d/asterisk /etc/init.d/asterisk.org
----------------------------------------------------
# vi /etc/init.d/asterisk
***
*** Uncomment the following line from:
***
*** #AST_USER="asterisk"
*** #AST_GROUP="asterisk"
***
*** to
***
*** AST_USER="asterisk"
*** AST_GROUP="asterisk"
***
----------------------------------------------------
***
*** Asterisk needs to write to voicemail.conf for password change.
***
# chmod g+w /etc/asterisk/voicemail.conf
----------------------------------------------------
***
*** Restart Asterisk by either of below:
***
# /etc/init.d/asterisk restart
----------------------------------------------------
# asterisk -U asterisk -G asterisk
----------------------------------------------------
More information about the asterisk-users
mailing list