You are on page 1of 4

At the Review and modify the partitioning layout screen, you can create a separate vol-

ume for /var. Selecting Yes will bring up the Partitioning tool. To partition the drive
accurately, you need to know what the hard drive size is; this may not jibe with what
is stamped on the outside of the drive because you have to tell the tool how to chop up
the drive. A limitation of the tool is that there is no option to say “use all available
space”; that is, you can’t simply could use 500 MB on the / partition and then say “use
the rest for /var”. The workaround is to make a note of the size it has selected for /
currently, as that is the full space, subtract 500 MB from that, and make that the size
for the / partition. The subtracted amount will then be reserved for /var.

A message will appear asking if you’d like to configure the eth0 network interface on
your system. Select Yes . Be sure the Activate on boot and Enable IPv4 support options
are enabled, then select OK .
If your network provides automatic IP provisioning via DHCP, you can just select
OK . Otherwise, select Manual address configuration, enter the appropriate informa-
tion, and then select OK .
Next, you’ll be asked to provide a hostname. You can either allow the DHCP server to
provide one for you (if your network assigns hostnames automatically) or enter one
manually, then select OK .
You will be presented with a list of time zones. Highlight your local time zone and select
OK .
At this point, you will be asked for a root password. Enter a secure password and type
it again to confirm. After entering your secure password, select OK .
Next up will be the package selection. Several packages that you don’t need to install
(and that require additional ISO files you probably haven’t downloaded) are selected
by default. Deselect all options in the list using the space bar, then select the Customize
software selection option. Once you’ve done that, select OK .
You will then be presented with the Package Group Selection screen. Scroll through the
whole list, deselecting each item. If any packages are selected, you’ll be prompted for
additional CDs that you have not downloaded. We’ll be installing additional packages
with the yum application after the operating system is installed. Once you’ve deselected
all packages, select OK .
A dependency check will then be performed and a confirmation that installation is
ready to begin will be presented. Select OK to start the installation. The filesystem will
then be formatted, the installation image transferred to the hard drive, and installation
of the system packages performed. Upon installation, you will be asked to reboot.
Remove any media in the drives and select the Reboot button.

Distribution Installation | 37
Base system update
Once you’ve rebooted your system, you need to run the yum update command to make
sure you have the latest base packages. To do this, log in using the username root and
the password you created during installation. Once logged in, run the following:
# yum update
Is this ok [y/N]: y

When prompted to install the latest packages, press y and wait for the packages to
update. If you’re asked to accept a GPG key, press y . When complete, reboot the system
as it is likely the kernel will have been updated‡:
# reboot

If you’re running CentOS Server 64-bit, you’ll need to remove all the
32-bit libraries manually. Once you’ve rebooted, or just prior to reboot,
run the following command:
# yum remove *.i386 -y

This will remove all the 32-bit libraries on your 64-bit system, which
can otherwise cause conflicts and issues when compiling Asterisk and
other software.

Congratulations! You’ve successfully installed and updated the base CentOS system.

Enabling NTP for accurate system time


Keeping accurate time is essential on your Asterisk system, both for maintaining accu-
rate call detail records and for synchronization with your other programs. You don’t
want the times of your voicemail notifications to be off by 10 or 20 minutes, as this can
lead to confusion and panic from those who might think their voicemail notifications
are taking took too long to be delivered. The ntpd command can be used to ensure that
the time on your Asterisk server remains in sync with the rest of the world:
# yum install ntp
...
Is this ok [y/N]: y
...
# ntpdate pool.ntp.org
# chkconfig ntpd on
# service ntpd start

The defaults shipped with CentOS are sufficient to synchronize the time and keep the
machine’s time in sync with the rest of the world.

‡ This reboot step is essential prior to installing Asterisk.

38 | Chapter 3: Installing Asterisk


Adding a system user
The Ubuntu server install process asks you to add a system user other than root, but
CentOS does not. In order to be consistent in the book and to be more secure, we’re
going to add another system user and provide it sudo access.§ To add the new user,
execute the adduser command:
# adduser asteriskpbx
# passwd asteriskpbx
Changing password for user asteriskpbx.
New UNIX password:
Retype new UNIX password:

Now we need to provide the asteriskpbx user sudo access. We do this by modifying the
sudoers file with the visudo command. You’ll need to install visudo the first time you
use it:
# yum install sudo

With the sudo-related applications and file installed, we can modify the sudoers file.
Execute the visudo command and look for the lines shown below:
# visudo

## Allows people in group wheel to run all commands


%wheel ALL=(ALL) ALL

With the %wheel line uncommented as shown in our example, save the file by pressing
Esc , then typing :wq and pressing Enter . Now open the /etc/group file in your favorite
editor (nano is easy to use) and find the line that starts with the word wheel. Modify it
like so:
wheel:x:10:root,asteriskpbx

Save the file, log out from root by typing exit, and log in as the asteriskpbx user you
created. Test your sudo access by running the following command:
$ sudo ls /root/
[sudo] password for asteriskpbx:

After typing your password, you should get the output of the /root/ directory. If you
don’t, go back and verify the steps to make sure you didn’t skip or mistype anything.
The rest of the instructions in this chapter will assume that you’re the asteriskpbx user
and that you have sudo access.
One last thing needs to done, which will allow you to enter commands without having
to enter the full path. By default only root has /sbin/ and /usr/sbin/ in the default system
PATH, but we’ll add it to our asteriskpbx user as well since we’ll be running many ap-
plications located in those directories.

§ sudo is an application that allows a user to execute commands as another user, such as root, or the superuser.

Distribution Installation | 39
Start by opening the hidden file .bash_profile located within the asteriskpbx home di-
rectory with an editor. We’re then going to append :/usr/sbin:/sbin to the end of the
line starting with PATH:
$ vim ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/sbin:/sbin

As previously, save the file by pressing Esc and then typing :wq and pressing Enter .
With the operating system installed, you’re ready to install the dependencies required
for Asterisk. The next section deals with Ubuntu, so you can skip ahead to the section
“Software Dependencies” on page 44, which provides an in-depth review of the in-
stallation process. Alternatively, if you’ve already reviewed the information in that sec-
tion, you may want to refer back to the “Installation Cheat Sheet” on page 31 for a
high-level review of how to install Asterisk.

Ubuntu Server
Ubuntu Server is a popular Linux distribution loosely based on Debian. There is also
a popular desktop version of the software. The Ubuntu Server package contains no GUI
and is ideal for Asterisk installations.
To get the latest version of Ubuntu Server,‖ visit http://www.ubuntu.com and select the
Server tab at the top of the page. You will be provided with a page that contains infor-
mation about Ubuntu Server Edition. Clicking the orange Download button in the
upper-right corner will take you to a page where you can select either the 32-bit or 64-
bit version of Ubuntu Server. After selecting one of the options, you can press the Start
download button.
Once you’ve downloaded the ISO file, burn it to a CD and start the installation process.
If you’re installing into a virtual machine (which we don’t recommend for production
use, but can be a great way to test out Asterisk), you should be able to mount the ISO
file directly and install from there.

Base system installation


Upon booting from the CD, you will be presented with a screen where you can select
your language of choice. By default English is the selected language, and after a timeout
period, it will be automatically selected. After selecting your language, press Enter .
The next screen will give you several options, the first of which is Install Ubuntu
Server. Select it by pressing Enter .
You will then be asked which language to use for the installation (yes, this is slightly
redundant). Select your language of choice (the default is English), and press Enter .

‖ Of course, projects can change their websites whenever they want. Hopefully the instructions we’ve provided
here are accurate enough to help guide you through the site even in the event of changes.

40 | Chapter 3: Installing Asterisk

You might also like