Page 324 - Asterisk™: The Future of Telephony
P. 324
We’re going to run Asterisk as the user asterisk, so we need to create that user on our
system first. The following commands will be run as root. We’ll tell you when to switch
and use the asterisk user that we’re about to create:
# adduser -c "Asterisk PBX" asterisk
# passwd asterisk
Now that you’ve created the asterisk user, let’s switch to that user, with which we’ll
‡
perform the rest of the commands. Once we su to the asterisk user, we can download
a copy of Asterisk via SVN, FTP or WGET, and then compile and install. We’re going
to grab a copy of Asterisk from the SVN repository in the following example.
1.4.5 is the current release version at the time of this writing, but it won’t
be by the time you read this, so check the Asterisk web site for the latest
version. In other words, don’t just type 1.4.5 whenever you see us refer
to it. Find out what is current and use that instead.
# su - asterisk
$ svn co http://svn.digium.com/svn/asterisk/tags/1.4.5 asterisk-1.4.5
$ cd asterisk-1.4.5
$ ./configure --prefix=$HOME/asterisk-bin --sysconfdir=$HOME/asterisk-bin
--localstatedir=$HOME/asterisk-bin
$ make menuselect
$ make install
When running the ./configure script with the --prefix flag, we’re telling the system to
§
install the binary components into our $HOME directory under the subdirectory called
asterisk-bin. The --sysconfdir flag tells the system where to place the configuration
files, and --localstatedir tells the system where to install additional files, such as
sounds. The key here is that since we are downloading, compiling, and installing as the
user asterisk, everything that only gets created will be assigned to that user, and have
the permissions granted to that user.
We can now install the sample files as well into the $HOME/asterisk-bin/asterisk
directory:
$ make samples
Test starting up Asterisk with the following command:
$ ./asterisk-bin/sbin/asterisk -cvvv
Normally, Asterisk needs to be run as a service. During installation, the make config
command will install the init scripts. Unfortunately, this will not work when you are
logged in as the user asterisk, because only the root user has the authority to make
‡ su historically means super-user, but nowadays it could also mean switch-user or substitute-user. The - in
the command tells su to use the environment for that user (for example to use the PATH for that user)
§ $HOME is a system variable that defines the path to the home directory for the current user, i.e., /home/asterisk.
296 | Chapter 13: Managing Your Asterisk System