LoginSignup
0
1

More than 1 year has passed since last update.

【Asterisk16】centos8にダウンロードから起動まで

Posted at

Asterisk16 ダウンロードから起動まで

初めに

Asteriskを使う機会があったのでインストールまでをまとめてみようと思います。
今後は内線の設定方法や通話方法などもまとめて行きたいと思います。

Asteriskとは

Asterisk(アスタリスク)は、オープンソースのIP-PBXソフトウェアです。

参考: https://www.ossnews.jp/oss_info/asterisk

環境とバージョン

os: Linux(centos8)
Asterisk: 16.23.0

Asteriskのダウンロードの準備

基本的にルートユーザーで作業します。

今回は /usr/local/src/ 以下にソースをダウンロードします。
権限周りは適時変更してください。

必要なパッケージをインストールします

yum -y groupinstall 'Development Tools'

centos8の場合はPowerToolsのレポジトリ有効化

/etc/yum.repos.d/CentOS-Linux-PowerTools.repo
# デフォルト: 無効
enabled=0

# 変更後: 有効
enabled=1

libedit が無いとビルドが出来ないのでインストールします。

yum -y libedit-devel

ソースのダウンロード

Asteriskのソースをダウンロードします。
http://downloads.asterisk.org/pub/telephony/asterisk/

バージョンは任意のものを選んでください。
ここでは現行バージョンを指定します。

cd /usr/local/src/

# 現在の最新を取得する
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-16-current.tar.gz

# 解凍する
tar -zxvf asterisk-16-current.tar.gz

# 2021 1月現在
cd asterisk-16.23.0/

# その他必要パッケージのインストール
contrib/scripts/install_prereq install

# mp3を使う場合
contrib/scripts/get_mp3_source.sh

Asterisk のビルド

/usr/local/src/asterisk-16.23.0
./configure --with-jansson-bundled

コマンドを実行して下記マークが表示されば成功です。

configure: Menuselect build configuration successfully completed

               .$$$$$$$$$$$$$$$=..
            .$7$7..          .7$$7:.
          .$$:.                 ,$7.7
        .$7.     7$$$$           .$$77
     ..$$.       $$$$$            .$$$7
    ..7$   .?.   $$$$$   .?.       7$$$.
   $.$.   .$$$7. $$$$7 .7$$$.      .$$$.
 .777.   .$$$$$$77$$$77$$$$$7.      $$$,
 $$$~      .7$$$$$$$$$$$$$7.       .$$$.
.$$7          .7$$$$$$$7:          ?$$$.
$$$          ?7$$$$$$$$$$I        .$$$7
$$$       .7$$$$$$$$$$$$$$$$      :$$$.
$$$       $$$$$$7$$$$$$$$$$$$    .$$$.
$$$        $$$   7$$$7  .$$$    .$$$.
$$$$             $$$$7         .$$$.
7$$$7            7$$$$        7$$$
 $$$$$                        $$$
  $$$$7.                       $$  (TM)
   $$$$$$$.           .7$$$$$$  $$
     $$$$$$$$$$$$7$$$$$$$$$.$$$$$$
       $$$$$$$$$$$$$$$$.

エラーなどがでたら適時対応してください。

#この場合は libedit がインストールされていない
configure: error: *** Please install the 'libedit' development package.

メニューセレクトの選択

make menuselect

上記コマンドでビルドオプションを設定できます。
スペースキーを押すことで選択でき、矢印キーで動かすことが出来ます。

例えばmp3などを使う予定がある場合は、

Add-ons -> [*]format_mp3

としてください。

設定しましたら、 Save & Exit をエンターで押すことで保存できます。

ビルドを開始します。

/usr/local/src/asterisk-16.23.0/
make

下記マークが表示されれば成功です

 +--------- Asterisk Build Complete ---------+
 + Asterisk has successfully been built, and +
 + can be installed by running:              +
 +                                           +
 +                make install               +
 +-------------------------------------------+

make install

/usr/local/src/asterisk-16.23.0/
make install

下記マークがでれば成功です

done
 +---- Asterisk Installation Complete -------+
 +                                           +
 +    YOU MUST READ THE SECURITY DOCUMENT    +
 +                                           +
 + Asterisk has successfully been installed. +
 + If you would like to install the sample   +
 + configuration files (overwriting any      +
 + existing config files), run:              +
 +                                           +
 + For generic reference documentation:      +
 +    make samples                           +
 +                                           +
 + For a sample basic PBX:                   +
 +    make basic-pbx                         +
 +                                           +
 +                                           +
 +-----------------  or ---------------------+
 +                                           +
 + You can go ahead and install the asterisk +
 + program documentation now or later run:   +
 +                                           +
 +               make progdocs               +
 +                                           +
 + **Note** This requires that you have      +
 + doxygen installed on your local system    +
 +-------------------------------------------+

サンプルの設定を適応

Asteriskにサンプルがあるので、それの設定を行います。

make samples

Asteriskの起動

Asteriskを起動します。

touch /etc/redhat-release

# 起動スクリプトのインストール
make config

Asteriskの起動状態を確認します。
起動済みの場合もありますが一応確認します。

# 起動状態の確認
/etc/init.d/asterisk status

# 停止中
Active: failed

起動コマンドを実行します

/etc/init.d/asterisk start

# 下記が表示去れれば成功
Starting asterisk (via systemctl):                         [  OK  ]

Asterisk cliの起動

# Asterisk cliに接続
asterisk -r

# 下記表示が出れば Asteriskの起動が確認できます
Asterisk 16.23.0, Copyright (C) 1999 - 2021, Sangoma Technologies Corporation and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.

なんらかの理由でやり直す事になった場合の方法

# コンパイルをやり直す
make clean

# configureまでやり直す
# make distclean

# 参考
https://wiki.asterisk.org/wiki/display/AST/Building+and+Installing+Asterisk

最後に

以上で Asterisk PBX のインストール及び起動までは完了です。
何かの役に立てたら幸いです。

今回はcentos8で行っておりますが、centos7でもほとんど同様の方法でインストールまでできると思います。

今後は内線の設定などを書いていけたらと思います。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1