MMDVMHost/ircddbGateway Install on Raspberry Pi 4
집에 설치된 라즈베리파이 서버가 SD카드로 OS 파티션을 구성하니 시간이 지나면 갑자기 메모리가 손상되는 일이 자주 있다. 1년에 4~5번꼴로 삭제와 포맷, 재설치가 반복이 되기 때문에 현재 라즈베리파이 서버에 D-STAR Hotspot 기능과 IP-PBX, Web server, NAS Storage Server가 구동되고 있어 이런 많은 구성을 두는 나로선 상당히 피곤하다.
라즈베리파이4 에서는 bootloader 차원에서 USB부팅이 가능하여 앞으로는 OS를 SD카드를 사용하지 않고 USB로 연결된 안정적인 1TB HDD를 사용하기로 하여 새로 구성을 하면서 설치과정을 정리해 보았다.
Destinate : Raspberry Pi 4 4GB + DVMega Board , after installed complete Asterisk 16 and FreePBX 15
● Initialize
# systemctl stop serial-getty@ttyAMA0.service
# systemctl disable serial-getty@ttyAMA0.service
# nano /boot/cmdline.txt
‘console=serial0,115200’ 삭제
# nano /boot/config.txt
dtoverlay=disable-bt 추가
● Install MMDVMHost with compile
# apt-get install git screen
# cd /tmp → if you use HD44780
# w get https://project-downloads.drogon.net/wiringpi-latest.deb → if you use HD44780
# sudo dpkg -i wiringpi-latest.deb → if you use HD44780
(Raspberry Pi4 기종이 apt repository의 WiringPi에서는 지원하지 않아 최신버전 2.52 패키지로 설치해야 HD44780 출력이 동작함, http://wiringpi.com/wiringpi-updated-to-2-52-for-the-raspberry-pi-4b/)
# cd /opt
# git clone https://github.com/g4klx/MMDVMHost.git
# git clone https://github.com/g4klx/MMDVMCal.git
# cd /opt/MMDVMHost
# make → if you use HD44780, don't use make
# make -f Makefile.Pi.HD44780 → if you use HD44780, execuate this command.
# nano MMDVM.ini
[General] Callsign=DS1NMA Id=450371 #Timeout=180 Duplex=1 # ModeHang=10 RFModeHang=10 NetModeHang=3 Display=HD44780 Daemon=0
[Info] RXFrequency=432380000 TXFrequency=437380000 Power=1 Latitude=0.0 Longitude=0.0 Height=0 Location=Seoul, Korea Description=DS1NMA Repeater URL=rep.kkit.kr
[Log] # Logging levels, 0=No logging DisplayLevel=1 FileLevel=2 FilePath=/var/log/MMDVM FileRoot=MMDVM
[CW Id] Enable=1 Time=10 # Callsign=
[DMR Id Lookup] File=/opt/MMDVMHost/DMRIds.dat Time=24
[NXDN Id Lookup] File=NXDN.csv Time=24
[Modem] # Port=/dev/ttyACM0 Port=/dev/ttyAMA0 #Port=\\.\COM3 # Protocol=uart # Address=0x22 TXInvert=1 RXInvert=0 PTTInvert=0 TXDelay=100 RXOffset=0 TXOffset=0 DMRDelay=0 RXLevel=50 TXLevel=50 RXDCOffset=0 TXDCOffset=0 RFLevel=100 # CWIdTXLevel=50 # D-StarTXLevel=50 # DMRTXLevel=50 # YSFTXLevel=50 # P25TXLevel=50 # NXDNTXLevel=50 # POCSAGTXLevel=50 # RSSIMappingFile=RSSI.dat Trace=0 Debug=0
[Transparent Data] Enable=0 RemoteAddress=127.0.0.1 RemotePort=40094 LocalPort=40095 # SendFrameType=0
[UMP] Enable=0 # Port=\\.\COM4 Port=/dev/ttyACM1
[D-Star] Enable=1 Module=B SelfOnly=0 AckReply=1 AckTime=750 AckMessage=0 ErrorReply=1 RemoteGateway=0 # ModeHang=10
[DMR] Enable=0 Beacons=0 BeaconInterval=60 BeaconDuration=3 ColorCode=1 SelfOnly=0 EmbeddedLCOnly=0 DumpTAData=1 # Prefixes=234,235 # Slot1TGWhiteList= # Slot2TGWhiteList= CallHang=3 TXHang=4 # ModeHang=10
[System Fusion] Enable=0 LowDeviation=0 SelfOnly=0 TXHang=4 #DGID=1 RemoteGateway=0 # ModeHang=10
[P25] Enable=0 NAC=293 SelfOnly=0 OverrideUIDCheck=0 RemoteGateway=0 # ModeHang=10
[NXDN] Enable=0 RAN=1 SelfOnly=0 RemoteGateway=0 # ModeHang=10
[POCSAG] Enable=0 Frequency=439987500
[D-Star Network] Enable=1 GatewayAddress=127.0.0.1 GatewayPort=20010 LocalPort=20011 # ModeHang=3 Debug=0
[DMR Network] Enable=0 Address=44.131.4.1 Port=62031 Jitter=360 # Local=62032 Password=PASSWORD # Options= Slot1=1 Slot2=1 # ModeHang=3 Debug=0
[System Fusion Network] Enable=0 LocalAddress=127.0.0.1 LocalPort=3200 GatewayAddress=127.0.0.1 GatewayPort=4200 # ModeHang=3 Debug=0
[P25 Network] Enable=0 GatewayAddress=127.0.0.1 GatewayPort=42020 LocalPort=32010 # ModeHang=3 Debug=0
[NXDN Network] Enable=0 LocalAddress=127.0.0.1 LocalPort=14021 GatewayAddress=127.0.0.1 GatewayPort=14020 # ModeHang=3 Debug=0
[POCSAG Network] Enable=0 LocalAddress=127.0.0.1 LocalPort=3800 GatewayAddress=127.0.0.1 GatewayPort=4800 # ModeHang=3 Debug=0
[TFT Serial] # Port=modem Port=/dev/ttyAMA0 Brightness=50
[HD44780] Rows=2 Columns=16
# For basic HD44780 displays (4-bit connection) # rs, strb, d0, d1, d2, d3 Pins=11,10,0,1,2,3
# Device address for I2C I2CAddress=0x20
# PWM backlight PWM=0 PWMPin=21 PWMBright=100 PWMDim=16
DisplayClock=1 UTC=1
[Nextion] # Port=modem Port=/dev/ttyAMA0 Brightness=50 DisplayClock=1 UTC=0 #Screen Layout: 0=G4KLX 2=ON7LDS ScreenLayout=2 IdleBrightness=20
[OLED] Type=3 Brightness=0 Invert=0 Scroll=1 Rotate=0 Cast=0
[LCDproc] Address=localhost Port=13666 #LocalPort=13667 DimOnIdle=0 DisplayClock=1 UTC=0
[Lock File] Enable=0 File=/tmp/MMDVM_Active.lck
[Mobile GPS] Enable=0 Address=127.0.0.1 Port=7834
[Remote Control] Enable=0 Port=7642
|
# cd /opt/MMDVMCal
# make
# nano /lib/systemd/system/mmdvmhost.service
[Unit] Description=MMDVM Host Service After=syslog.target network.target
[Service] User=root WorkingDirectory=/opt/MMDVMHost ExecStart=/usr/bin/screen -S MMDVMHost -D -m /opt/MMDVMHost/MMDVMHost /opt/MMDVMHost/MMDVM.ini ExecStop=/usr/bin/screen -S MMDVMHost -X quit
[Install] WantedBy=multi-user.target
|
# chmod 755 /lib/systemd/system/mmdvmhost.service
# ln -s /lib/systemd/system/mmdvmhost.service /etc/systemd/system/mmdvmhost.service
# nano /lib/systemd/system/mmdvmhost.timer
[Timer] [Install] WantedBy=multi-user.target
|
# chmod 755 /lib/systemd/system/mmdvmhost.timer
# ln -s /lib/systemd/system/mmdvmhost.timer /etc/systemd/system/mmdvmhost.timer
# systemctl daemon-reload
# systemctl enable mmdvmhost.timer
# reboot
● Install ircDDBGateway (get github repository and compile)
# apt-get install libwxgtk3.0-dev git build-essential
# cd ~
# git clone --depth 1 https://github.com/g4klx/ircDDBGateway.git
# cd ~/ircDDBGateway
# make
# make install
데몬은 /usr/bin/ircddbgatewayd
설정파일은 nano /etc/ircddbgateway
language=6 description2=Korea ircddbEnabled=1 ircddbHostname=rr.openquad.net ircddbUsername=ds1nma ircddbPassword= aprsEnabled=1 aprsHostname=rotate.aprs2.net aprsPort=14580 ccsEnabled=1 ccsHost=CCS704 dextraEnabled=1 dextraMaxDongles=3 dplusEnabled=1 dplusMaxDongles=3 dplusLogin=DS1NMA dcsEnabled=1 remoteEnabled=1 remotePassword=1 remotePort=10022 infoEnabled=1 echoEnabled=1 logEnabled=0 dratsEnabled=1 dtmfEnabled=1 repeaterBand1=B repeaterType1=0 repeaterAddress1=127.0.0.1 repeaterPort1=20011 frequency1=437.38 offset1=0.0000 rangeKms1=0.0000 agl1=0.000 reflector1=XRF076 B atStartup1=1 reconnect1=0 latitude1=0.000000 longitude1=0.000000 |
데이터폴더는 /usr/share/ircddbgateway
로그는 /var/log/ircddbgateway
# nano /lib/systemd/system/ircddbgatewayd.service
[Unit] Description=D-STAR Gateway Daemon After=network.target
[Service] User=root ExecStart=/usr/bin/ircddbgatewayd Restart=on-abort
[Install] WantedBy=multi-user.target |
# systemctl daemon-reload
# systemctl start ircddbgatewayd
# systemctl status ircddbgatewayd
Install Asterisk 16 and FreePBX 15 on Raspberry PI 4
데비안 기준이라 수정할게 좀 있음. 확인하면서 적용하기 바람.
Step-by-step guide
All commands are to be run as the root user, either by directly logging in as root or by using sudo su - .
Start from a base Debian 10 installation. All necessary packages will be installed through the following commands.
Prerequisite recommended OS update
Add the backports repo specifically so that the odbc-mariadb package is available. Then update the OS to current.
- 사전에 타이프 할것
- apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 04EE7237B7D453EC
- apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
- echo deb http://ftp.us.debian.org/debian/ buster-backports main > /etc/apt/sources.list.d/backports.list
- echo deb-src http://ftp.us.debian.org/debian/ buster-backports main >> /etc/apt/sources.list.d/backports.list
- apt-get update
- apt-get upgrade
Install all the necessary packages (취소선 그어진 것은 raspbian 10에서 설치 안됨. 삭제하고 실행
- apt-get install -y build-essential linux-headers-*
`uname -r`openssh-server apache2 mariadb-server mariadb-client bison flex php php-curl php-cliphp-pdophp-mysql php-pear php-gd php-mbstring php-intl php-bcmath curl sox libncurses5-dev libssl-dev mpg123 libxml2-dev libnewt-dev sqlite3 libsqlite3-dev pkg-config automake libtool autoconf git unixodbc-dev uuid uuid-dev libasound2-dev libogg-dev libvorbis-dev libicu-dev libcurl4-openssl-dev libical-dev libneon27-dev libsrtp2-dev libspandsp-dev sudo subversion libtool-bin python-dev unixodbc dirmngr sendmail-bin sendmail asterisk debhelper-compat cmake libmariadb-devodbc-mariadbphp-ldap
Install Node.js (setup_11.x --> setup_12.x 로 바꿀것)
- curl -sL https://deb.nodesource.com/
setup_11.xsetup_12.x | sudo -E bash - - apt-get install -y nodejs
Install this required Pear module
- pear install Console_Getopt
Prepare Asterisk
- systemctl stop asterisk
- systemctl disable asterisk
- cd /etc/asterisk
- mkdir DIST
- mv * DIST
- cp DIST/asterisk.conf .
- sed -i 's/(!)//' asterisk.conf
- touch modules.conf
- touch cdr.conf
Configure Apache web server
- sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.3/apache2/php.ini
- sed -i 's/\(^memory_limit = \).*/\1256M/' /etc/php/7.3/apache2/php.ini
- sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/apache2/apache2.conf
- sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
- a2enmod rewrite
- service apache2 restart
- rm /var/www/html/index.html
Configure ODBC
- cat <<EOF > /etc/odbcinst.ini
[MySQL]
Description = ODBC for MySQL (MariaDB)
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
FileUsage = 1
EOF - cat <<EOF > /etc/odbc.ini
[MySQL-asteriskcdrdb]
Description = MySQL connection to ‘asteriskcdrdb’ database
Driver = MySQL
Server = localhost
Database = asteriskcdrdb
Port = 3306
Socket = /var/run/mysqld/mysqld.sock
Option = 3
EOF
Download FFMPEG static build for sound file manipulation
- cd /usr/local/src
- wget "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz"
- tar xf ffmpeg-release-amd64-static.tar.xz
- cd ffmpeg-4*
- mv ffmpeg /usr/local/bin
Install FreePBX
- cd /usr/local/src
- wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-15.0-latest.tgz
- tar zxvf freepbx-15.0-latest.tgz
- cd /usr/local/src/freepbx/
- ./start_asterisk start
- ./install -n
Get the rest of the modules
Only a very basic system is installed at this point. You will probably want to install all the modules on Debian 10 . Alternatively, you can skip this and pick-and-choose the individual modules you want later.
- fwconsole ma installall
Uninstall digium_phones
Broken with PHP 7.3 (April 2020).
- fwconsole ma uninstall digium_phones
Apply the current configuration
- fwconsole reload
Set symlinks to the correct sound files
- cd /usr/share/asterisk
- mv sounds sounds-DIST
- ln -s /var/lib/asterisk/sounds sounds
Perform a restart to load all Asterisk modules that had not yet been configured
- fwconsole restart
Set up systemd (startup script)
- cat <<EOF > /etc/systemd/system/freepbx.service
[Unit]
Description=FreePBX VoIP Server
After=mariadb.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/fwconsole start -q
ExecStop=/usr/sbin/fwconsole stop -q
[Install]
WantedBy=multi-user.target
EOF - systemctl daemon-reload
- systemctl enable freepbx