yum -y install yum-utils
yum update
yum -y install httpd
systemctl enable httpd
systemctl start httpd
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
# 隐藏版本号
vim /etc/httpd/conf.d/secure.conf
TraceEnable off
ServerSignature Off
ServerTokens Prod
# 配置vhost
vim /etc/httpd/conf.d/vhosts.conf
DocumentRoot "/var/www/html"
ServerName example.com
ServerAlias www.example.com
ErrorLog "logs/example.com-error_log"
CustomLog "logs/example.com-access_log" combined
yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
yum install certbot python2-certbot-apache
certbot --apache
systemctl restart httpd
# 安装MySQL8 YUM源
rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm
yum install mysql-community-server
systemctl enable mysqld
systemctl start mysqld
# 查看自动生成的MySQL密码
grep "password" /var/log/mysqld.log
# 登录MySQL后修改密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码'
# 刷新MySQL权限表
FLUSH PRIVILEGES
yum-config-manager --disable remi-php54
yum-config-manager --enable remi-php73
yum -y install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json php-opcache php-redis php-soap
# 隐藏php版本号
vim /etc/php.ini
expose_php = off
系统参数设置
# 文件打开数设置
ulimit -n 65535
vim /etc/security/limits.d/nofile.conf
* soft nofile 65535
* hard nofile 65535
# 内核网络优化
vim /etc/sysctl.conf
# 启用timewait 快速回收
net.ipv4.tcp_tw_recycle = 1
下面给出在linux 上安装Asterisk,FreePBX的基本步骤。1. 首先是更新系统(可选)
在命令行中输入
sudo apt-get update
sudo apt-get upgrade
2. 安装LAMP (Apache2+MySQL+PHP)
在命令行输入
sudo tasksel
选择 LAMP Server
3. 添加额外的PHP 软件包
sudo apt-get install php5-gd php-pear php-db sox curl
4. 安装phpmyadmin (可选)
sudo apt-get install phpmyadmin
5. 安装asterisk
sudo apt-get install asterisk asterisk-mysql asterisk-mp3
6. 安装Freepbx准备工作
在安装Freepbx我们先要想好将Freepbx 安装在哪个目录下,FreePBX 为asterisk 的Web管理应用,可以帮助用户配置Asterisk等。
1) Ubuntu 的Web根目录为/var/www, 因此我们可以把FreePBX安装到/var/www/freepbx 目录下,为便于管理,创建三个子目录conf 设置文件
log 存放日志
public WEB应用。
sudo mkdir /var/www/freepbx/
sudo mkdir /var/www/freepbx/conf
sudo mkdir /var/www/freepbx/log
sudo mkdir /var/www/freepbx/public
2) 创建设置文件 /var/www/freepbx/conf/vhost.conf
sudo vim /var/www/freepbx/conf/vhost.conf
输入以下内容
<VirtualHost *:80>
ServerName freepbx
ServerAlias freepbx
ServerAdmin james.shen@guidebee.com
ErrorLog /var/www/freepbx/log/error.log
CustomLog /var/www/freepbx/log/access.log combined
DocumentRoot /var/www/freepbx/public
<Directory /var/www/freepbx/public>
Options Indexes FollowSymLinks MultiViews
Order allow,deny
AllowOverride All
Allow from all
</Directory>
<Directory /var/www/freepbx/public/admin>
AuthType Basic
AuthName "Restricted Area"
AuthUserFile freepbx-passwd
Require user admin
</Directory>
</VirtualHost>
修改 ServerAdmin 到你自己的Email地址。
3) 将vhost 添加到 Apache的sites-enabled目录下
sudo ln -s /var/www/freepbx/conf/vhost.conf /etc/apache2/sites-available/freepbx
cd /etc/apache2/sites-enabled/
sudo ln -s ../sites-available/freepbx
4) 创建 用户和密码来验证合法用户可以来配置FreePBX (有权限访问该网页)
sudo htpasswd -c /etc/apache2/freepbx-passwd admin
5) 重启Apache
sudo /etc/init.d/apache2 restart
有了这些准备工作后,就可以开始安装FreePBX了
7. 安装FreePBX
1) 下载FreePBX安装包
cd /tmp
wget http://mirror.freepbx.org/freepbx-2.8.1.tar.gz
cd /usr/src
sudo tar xvzf /tmp/freepbx-2.8.1.tar.gz
cd freepbx-2.8.1/
2) 创建数据库
mysqladmin create asterisk -u root -p
mysqladmin create asteriskcdrdb -u root -p
mysql -u root -p asterisk <SQL/newinstall.sql
mysql -u root -p asteriskcdrdb <SQL/cdr_mysql_table.sql
3) 创建数据库用户
mysql -u root -p
在SQL命令行输入GRANT ALL PRIVILEGES ON asterisk.* TO asterisk@localhost IDENTIFIED BY ‘badasspassword’
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asterisk@localhost IDENTIFIED BY ‘badasspassword’
flush privileges
quit
注意将badasspassword 换成你自己选择的密码。
4) 备份modules.conf , FreePBX安装时会修改Apache的配置文件
sudo cp /etc/asterisk/modules.conf ~/asterisk-modules.conf
5) 安装FreePBX
sudo ./install_amp
输入对应的参数
Enter your USERNAME to connect to the 'asterisk' database:
[asteriskuser] asterisk
Enter your PASSWORD to connect to the 'asterisk' database:
[amp109] badasspassword
Enter the hostname of the 'asterisk' database:
[localhost]
Enter a USERNAME to connect to the Asterisk Manager interface:
[admin]
Enter a PASSWORD to connect to the Asterisk Manager interface:
[amp111]
Enter the path to use for your AMP web root:
[/var/www/html]
/var/www/freepbx/public
Enter the IP ADDRESS or hostname used to access the AMP web-admin:
[xx.xx.xx.xx] freepbx
Enter a PASSWORD to perform call transfers with the Flash Operator Panel:
[passw0rd] password
Use simple Extensions [extensions] admin or separate Devices and Users [deviceanduser]?
[extensions]
Enter directory in which to store AMP executable scripts:
[/var/lib/asterisk/bin]
6)恢复asterisk-modules.conf
sudo cp ~/asterisk-modules.conf /etc/asterisk/modules.conf
7) 添加asterisk用户
sudo adduser www-data asterisk
修改权限/etc/amportal.conf 中添加
AMPASTERISKUSER=www-data
AMPASTERISKGROUP=asterisk
AMPASTERISKWEBUSER=www-data
AMPASTERISKWEBGROUP=asterisk
重启amportal
sudo amportal start
8) 使用amport 启动Asterisk
sudo update-rc.d -f asterisk remove
sudo sed -e s/BACKGROUND=0/BACKGROUND=1/ -i /usr/sbin/safe_asterisk
修改/etc/rc.local
在exit 0 前添加
/usr/local/sbin/amportal start
至此,安装完毕。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)