-
Notifications
You must be signed in to change notification settings - Fork 0
/
a18.sh
104 lines (104 loc) · 2.85 KB
/
a18.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/usr/bin/env bash
#
clear
echo "This script will automate the installation of PHP and Asterisk 18"
echo "It is 99% automated with the exception on one prompt which will "
echo "ask you for the dial code of the country you are in"
echo
echo "If you want to exit this script without continuing, please press CTRL-C"
echo
read -p "Hit Enter to Continue..." wsname
echo "Adding Extra PHP and Nginx Repositories"
add-apt-repository -y ppa:ondrej/php
add-apt-repository -y ppa:ondrej/nginx-mainline
echo "Updating APT Libraries..."
apt update -y -q
clear
echo "APT Libraries updated..."
echo "Installing PHP..."
sleep 2
apt install -y -q php-{cli,json,fpm,mysql,gd,soap,mbstring,bcmath,common,xml,curl,imagick,zip}
apt install unzip -q -y
clear
echo "PHP Installed Successfully."
sleep 2
echo "Installing composer..."
sleep 2
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
clear
echo "Composer Successfully Installed"
echo
apt install wget build-essential git autoconf subversion pkg-config libtool -q -y
echo "Composer Successfully Installed"
echo
sleep 2
echo "Updating the server now..."
sleep 2
apt dist-upgrade -y -q
clear
echo "Server updated."
sleep 2
echo "Installing DAHDI Linux"
sleep 2
cd /usr/src/
git clone -b next git://git.asterisk.org/dahdi/linux dahdi-linux
cd dahdi-linux
make
make install
clear
echo "DAHDI Installed Successfully"
sleep 2
echo "Installing DAHDI Tools"
sleep 2
cd /usr/src/
git clone -b next git://git.asterisk.org/dahdi/tools dahdi-tools
cd dahdi-tools
autoreconf -i
./configure
make install
make install-config
dahdi_genconf modules
clear
echo "DAHDI Installed Successfully"
sleep 2
echo "Installing Lib PRI"
sleep 2
cd /usr/src/
git clone https://gerrit.asterisk.org/libpri libpri
cd libpri
make
make install
clear
echo "Lib PRI Installed Successfully"
sleep 2
echo "Here comes Asterisk..."
sleep 2
cd /usr/src/
git clone -b 18 https://gerrit.asterisk.org/asterisk asterisk-18
cd asterisk-18/
contrib/scripts/get_mp3_source.sh
contrib/scripts/install_prereq install
./configure
make menuselect.makeopts
menuselect/menuselect --enable format_mp3
make
make install WGET_EXTRA_ARGS="--no-verbose"
make config
make basic-pbx
adduser --system --group --home /var/lib/asterisk --no-create-home --gecos "Asterisk PBX" asterisk
sed -i "s~^#AST_USER=*~AST_USER=~" /etc/default/asterisk
sed -i "s~^#AST_GROUP=*~AST_GROUP=~" /etc/default/asterisk
usermod -a -G dialout,audio asterisk
chown -R asterisk: /var/{lib,log,run,spool}/asterisk /usr/lib/asterisk /etc/asterisk
chmod -R 750 /var/{lib,log,run,spool}/asterisk /usr/lib/asterisk /etc/asterisk
systemctl enable asterisk
clear
echo
echo "Asterisk Installed Successfull"
sleep 2
echo "Updating all remaining system data then i'm going to reboot"
apt update -y && apt dist-upgrade -y && apt autoremove -y
clear
echo
echo "Server updated and ready to use. I suggest a reboot first"
echo