最近有一项语音呼叫的业务需要将DotAsterisk(点星PBX)部署到阿里云ECS云主机上,正好这段时间发现阿里云做活动,ECS机器购买优惠力度很大,新用户只需要699元就可以购买一台2CPU 4G内存,而且使用3年期限的云主机,官方活动链接如下:
https://promotion.aliyun.com/ntms/act/vm/aliyun-group/buy.html?group=LPBxaxPdCr
因为便宜,所以毫不犹豫的跟风购买了一台ECS,下面将介绍一下如何在阿里云ECS云主机上面部署点星PBX呼叫系统。
1. 下载点星PBX呼叫系统,官方下载地址为:
http://www.dotasterisk.cn/thread-31-1-1.html
下载完成ISO后,上传到阿里云服务器,并从中提取出所有的RPM软件包。下面会讲解。
2. 点星PBX呼叫系统部署完成后会修改系统默认的ssh端口为24432,导致安装部署完成后,ssh客户端无法连接到远程ECS服务器。此处我也是踩过这个坑,所以在安装部署之前先提出来,以免其他人重蹈覆辙。建议部署前最好先在阿里云控制台做好开放端口的准备工作。在阿里云控制台的【安全组配置】中添加24432端口的数据包允许规则,所谓阿里云【安全组配置】就相当于系统防火墙而已。如下图:
3. 查看ECS主机系统环境是否兼容点星PBX
由于点星PBX呼叫系统只支持Linux CentOS6 x86_64的系统平台安装,所以安装器一定要先看看购买的阿里云主机的操作系统是否是“64位的CentOS 6 Linux发行版”,如果不是,请务必在阿里云ECS控制台重新安装64位的CentOS6系统后再进行后续操作。如下是我的ECS系统:
检测操作系统是否是Linux CentOS 6,而且必须是64位系统,命令如下:
3.1) 登录:
Last login: Wed Sep 5 09:29:20 2018 from 61.183.151.86
Welcome to Alibaba Cloud Elastic Compute Service !
[root@centos6_64 ~]#
3.2) 查看预装阿里云系统的发行版本:
[root@centos6_64 ~]# cat /etc/issue
CentOS release 6.8 (Final)
Kernel \r on an \m
3.3) 查看预装阿里云系统的内核和操作系统位数是否是64位:
[root@centos6_64 ~]#
[root@centos6_64 ~]# uname -a
Linux centos6_64 2.6.32-696.6.3.el6.x86_64 #1 SMP Wed Jul 12 14:17:22 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@centos6_64 ~]#
[root@centos6_64 ~]# getconf LONG_BIT
64
[root@centos6_64 ~]#
从上面的命令可以看出,我的ECS服务器兼容DotAsterisk系统的安装。
我从点星PBX的ISO镜像中提取出了基本所有的RPM安装包放到了我自己的RPMS/目录,如果采用里面完整的安装包也是可以的,点星PBX的RPM包的在ISO的Packages/目录。然后简单写了个shell的安装脚本,一条命令安装搞定,如下图:
2.1) 上传我提取的rpm包和shell脚本的要说吧,并解压此文件: da-aliyun-rpm.tgz
[root@centos6_64 ~]# cd /
[root@centos6_64 /]# ls
bin boot da-aliyun-rpm.tgz dev etc home lib lib64 lost+found media mnt opt proc root run sbin selinux srv sys tmp usr var
[root@centos6_64 /]#
[root@centos6_64 /]# tar zxf da-aliyun-rpm.tgz
[root@centos6_64 /]# cd da-aliyun-rpm
[root@centos6_64 da-aliyun-rpm]# ls
da-install.sh RPMS
[root@centos6_64 da-aliyun-rpm]#
[root@centos6_64 da-aliyun-rpm]# ll -F
total 52
-rwxr-xr-x 1 root root 5226 Sep 5 10:11 da-install.sh*
drw-r--r-- 2 root root 45056 Sep 5 09:53 RPMS/
[root@centos6_64 da-aliyun-rpm]#
3)执行安装脚本
[root@centos6_64 da-aliyun-rpm]# ./da-install.sh
Are You Sure To Install?(yes/no)yes
----- Begin Install! -----
error: package httpd is not installed
error: package httpd-devel is not installed
rpm: no packages given for erase
rpm: no packages given for erase
error: package nginx is not installed
error: package memcached is not installed
Preparing... ########################################### [100%]
1:libgcc ########################################### [ 0%]
2:setup warning: /etc/gshadow created as /etc/gshadow.rpmnew
warning: /etc/motd created as /etc/motd.rpmnew
warning: /etc/passwd created as /etc/passwd.rpmnew
########################################### [ 0%]
warning: /etc/shadow created as /etc/shadow.rpmnew
3:filesystem ########################################### [ 0%]
4:basesystem ########################################### [ 1%]
5:ncurses-base ########################################### [ 1%]
6:dhcp-common ########################################### [ 1%]
7:centos-release warning: /etc/yum.repos.d/CentOS-Base.repo saved as /etc/yum.repos.d/CentOS-Base.repo.rpmsave
########################################### [ 1%]
8:tzdata ########################################### [ 1%]
9:glibc-common ########################################### [ 1%]
10:nss-softokn-freebl ########################################### [ 1%]
......(省略)
2.2) da-install.sh 的脚本内容
[root@dotasterisk:/da-aliyun-rpm]#cat da-install.sh
#!/bin/bash
read -p "Are You Sure To Install?(yes/no)" isSure
if [ "$isSure" == "yes" -o "$isSure" == "Yes" -o "$isSure" == "y" -o "$isSure" == "Y" ];then
echo '----- Begin Install! -----'
else
echo '----- Cancel Install, Exit! -----'
exit
fi
#----------clear: 卸载ECS云主机自带的软件
rpm -e httpd --nodeps
rpm -e httpd-devel --nodeps
rpm -qa|grep -i php |xargs rpm -e --nodeps
rpm -qa|grep -i mysql |xargs rpm -e --nodeps
rm -rf /var/lib/mysql /etc/my.cnf*
rpm -e nginx --nodeps
rpm -e memcached --nodeps
#----------clear-----end
cd RPMS/
rpm -ivh *.rpm --nodeps --force --nomd5 --nofiledigest --nodigest --nosignature
#---------------------post
/sbin/chkconfig memcached on
/sbin/chkconfig mysqld on
/sbin/chkconfig asterisk on
/sbin/chkconfig nginx on
/sbin/chkconfig php-fpm on
/sbin/chkconfig rpcbind on
/sbin/chkconfig rpcidmapd on
/sbin/chkconfig redis off
/sbin/chkconfig keepalived off
/sbin/chkconfig smb off
/sbin/chkconfig open off
/sbin/chkconfig ip6tables off
/sbin/chkconfig iptables off
/sbin/chkconfig iscsid off
/sbin/chkconfig iscsi off
/sbin/chkconfig mdmonitor off
/sbin/chkconfig messagebus off
/sbin/chkconfig postfix off
#/sbin/chkconfig rpcbind off
/sbin/chkconfig rpcgssd off
/sbin/chkconfig portreserve off
/sbin/chkconfig gpm off
/sbin/chkconfig fail2ban off
/sbin/chkconfig xinetd off
......
reboot
安装完成后可能系统要做部分优化,比如mysql配置,系统打开文件数等。
访问地址:http://101.200.58.137
登录账户/密码: admin/admin
测试了一波,除了最上面提到的安装完成并重启后ssh无法登陆到服务器的问题要在安全组里面开发24432端口外,暂时没有发现什么问题,至此阿里云安装DotAsterisk(点星PBX)顺利完成。
由于本机是一个测试机,后续也要要重装其它系统,感兴趣的朋友可以上去随便测试。成功安装后的截图如下: