fourier_install.sh 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. #install essential software
  2. #sudo apt-get update
  3. read -p "Whats this box port (last 3 numbers with zero for padding)?" PORT
  4. ssh-keygen -t rsa -b 2048 -C "$HOSTNAME"
  5. echo "Please add the following public key to server's authorized keys:"
  6. cat ~/.ssh/id_rsa.pub
  7. read -p "Press enter to continue"
  8. echo "/usr/bin/autossh -N -f -M 7$PORT -oPubkeyAuthentication=yes -oPasswordAuthentication=no -oLogLevel=error -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -i /home/niofis/.ssh/id_rsa -R 6$PORT:localhost:22 rtunnel@server.fourier.audio -p 22" > ssh-tunnel.sh
  9. curl -L -o ssh-tunnel.service https://gist.githubusercontent.com/niofis/bc24f1b33414fd77d77f/raw/
  10. sudo mv ssh-tunnel.service /etc/systemd/system/ssh-tunnel.service
  11. sudo systemctl enable ssh-tunnel
  12. sudo systemctl start ssh-tunnel
  13. curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
  14. sudo apt-get install -y tmux
  15. sudo apt-get install -y vim
  16. sudo apt-get install -y autossh
  17. sudo apt-get install -y git-core
  18. sudo apt-get install -y build-essential
  19. sudo apt-get install -y nodejs
  20. #sudo apt-get install -y mysql-server mysql-client
  21. sudo apt-get install -y python-dev
  22. sudo apt-get install -y lame
  23. sudo apt-get install -y ezstream
  24. sudo apt-get install -y cmake
  25. sudo apt-get install -y rtl-sdr
  26. wget https://bootstrap.pypa.io/get-pip.py
  27. sudo python get-pip.py
  28. sudo apt-get install -y portaudio19-dev
  29. sudo pip install pyaudio
  30. sudo apt-get install -y ffmpeg
  31. sudo pip install pydub
  32. sudo pip install numpy
  33. sudo apt-get install -y gfortran libopenblas-dev liblapack-dev
  34. sudo pip install scipy
  35. sudo apt-get install -y python-matplotlib
  36. #sudo apt-get install -y python-mysqldb
  37. sudo apt-get install -y curl
  38. #sudo pip install mysql-connector==2.1.4
  39. sudo pip install requests
  40. #download fourier software
  41. cd ~
  42. mkdir programs
  43. cd ~/programs
  44. if [ "$REPOSRC" == "edesarrollos" ]; then
  45. git clone https://git.miralo.xyz/AudioValid/fourier-server.git server
  46. git clone https://git.miralo.xyz/AudioValid/fourier-fourier.git fourier
  47. git clone https://git.miralo.xyz/AudioValid/fourier-alt.git fourier-alt
  48. git clone https://git.miralo.xyz/AudioValid/fourier-monitor.git monitor
  49. git clone https://git.miralo.xyz/AudioValid/fourier-uploader.git uploader
  50. git clone https://git.miralo.xyz/AudioValid/fourier-ondemand.git ondemand
  51. git clone https://git.miralo.xyz/AudioValid/fourier-admanager.git admanager
  52. else
  53. git clone https://niofis@bitbucket.org/niofis/fourier-server.git server
  54. git clone https://niofis@bitbucket.org/niofis/fourier.git fourier
  55. git clone https://niofis@bitbucket.org/niofis/fourier-alt.git fourier-alt
  56. git clone https://niofis@bitbucket.org/niofis/fourier-monitor.git monitor
  57. git clone https://niofis@bitbucket.org/niofis/fourier-uploader.git uploader
  58. git clone https://niofis@bitbucket.org/niofis/fourier-ondemand.git ondemand
  59. git clone https://niofis@bitbucket.org/niofis/fourier-admanager.git admanager
  60. fi
  61. #install fourier-server dependencies
  62. cd ~/programs/server
  63. npm install
  64. #install fourier-monitor dependencies
  65. cd ~/programs/monitor
  66. npm install
  67. #install fourier-uploader dependencies
  68. cd ~/programs/uploader
  69. npm install
  70. #install fourier-ondemand dependencies
  71. cd ~/programs/ondemand
  72. npm install
  73. #install fourier-admanager dependencies
  74. cd ~/programs/admanager
  75. npm install
  76. sudo npm install -g pm2
  77. #build sdr lib
  78. sudo apt-get install -y libusb-1.0-0-dev
  79. cd ~/programs
  80. git clone https://github.com/niofis/rtl-sdr.git
  81. cd ~/programs/rtl-sdr
  82. mkdir build
  83. cd build
  84. cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON
  85. make
  86. sudo cp ./src/rtl_fm /usr/bin/rtl_fm
  87. #sudo make install
  88. echo "SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", MODE:="0666"" | sudo tee -a /etc/udev/rules.d/rtl-sdr.rules
  89. #build and install nim
  90. cd ~/programs
  91. curl -L https://nim-lang.org/download/nim-0.17.0.tar.xz -o nim-0.17.0.tar.xz
  92. tar xvf nim-0.17.0.tar.xz
  93. cd nim-0.17.0
  94. sh build.sh
  95. bin/nim c koch
  96. ./koch tools
  97. echo "export PATH=~/programs/nim-0.17.0/bin:$PATH" >> ~/.bashrc
  98. #build fourier-alt
  99. cd ~/programs/fourier-alt
  100. nimble build
  101. #configure ramdisk
  102. #sudo mkdir -p /mnt/ramdisk
  103. #echo "ramfs /mnt/ramdisk ramfs nodev,nosuid,noexec,nodiratime,umask=000,noatime,size=256m 0 0" | sudo tee -a /etc/fstab
  104. #sudo chgrp plugdev /mnt/ramdisk
  105. #sudo chmod g+w /mnt/ramdisk
  106. #sudo chmod +t /mnt/ramdisk
  107. #cd ~
  108. #curl -L -o fourier.service https://gist.githubusercontent.com/niofis/86e6e3fbe72a01263fbd388bde7953ea/raw/
  109. #sudo mv fourier.service /etc/systemd/system/fourier.service
  110. #sudo systemctl enable fourier
  111. sudo mysql -u root -e "create database fourier;"
  112. sudo mysql -u root -e "create user 'fourier'@'localhost' identified by 'Sup3rDuper!';"
  113. sudo mysql -u root -e "grant all privileges on fourier.* to 'fourier'@'localhost';flush privileges;"
  114. cd ~
  115. curl -L -o fourier.sql https://gist.githubusercontent.com/niofis/cd843500ac96fe8ddc8f39a58a4afc55/raw/
  116. sudo mysql -u root -h localhost fourier < fourier.sql
  117. curl -L -o fourier-config.json https://gist.githubusercontent.com/niofis/0e95b950faa333909407b5a65270376d/raw/
  118. sudo mv fourier-config.json /etc/fourier-config.json
  119. curl -L -o Fourier-key.json https://gist.githubusercontent.com/niofis/7f8ced8fc878acf8c9b45d8db3bb5458/raw/
  120. sudo mv Fourier-key.json /etc/Fourier-key.json
  121. echo "****************************************************************************"
  122. echo "REMEMBER: Initialize attached storage and create a symlink named /var/fourier pointing to the storage volume"
  123. echo "****************************************************************************"