fourier_install.sh 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. git clone https://niofis@bitbucket.org/niofis/fourier-server.git server
  45. git clone https://niofis@bitbucket.org/niofis/fourier.git fourier
  46. git clone https://niofis@bitbucket.org/niofis/fourier-alt.git fourier-alt
  47. git clone https://niofis@bitbucket.org/niofis/fourier-monitor.git monitor
  48. git clone https://niofis@bitbucket.org/niofis/fourier-uploader.git uploader
  49. git clone https://niofis@bitbucket.org/niofis/fourier-ondemand.git ondemand
  50. git clone https://niofis@bitbucket.org/niofis/fourier-admanager.git admanager
  51. #install fourier-server dependencies
  52. cd ~/programs/server
  53. npm install
  54. #install fourier-monitor dependencies
  55. cd ~/programs/monitor
  56. npm install
  57. #install fourier-uploader dependencies
  58. cd ~/programs/uploader
  59. npm install
  60. #install fourier-ondemand dependencies
  61. cd ~/programs/ondemand
  62. npm install
  63. #install fourier-admanager dependencies
  64. cd ~/programs/admanager
  65. npm install
  66. sudo npm install -g pm2
  67. #build sdr lib
  68. sudo apt-get install -y libusb-1.0-0-dev
  69. cd ~/programs
  70. git clone https://github.com/niofis/rtl-sdr.git
  71. cd ~/programs/rtl-sdr
  72. mkdir build
  73. cd build
  74. cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON
  75. make
  76. sudo cp ./src/rtl_fm /usr/bin/rtl_fm
  77. #sudo make install
  78. echo "SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", MODE:="0666"" | sudo tee -a /etc/udev/rules.d/rtl-sdr.rules
  79. #build and install nim
  80. cd ~/programs
  81. curl -L https://nim-lang.org/download/nim-0.17.0.tar.xz -o nim-0.17.0.tar.xz
  82. tar xvf nim-0.17.0.tar.xz
  83. cd nim-0.17.0
  84. sh build.sh
  85. bin/nim c koch
  86. ./koch tools
  87. echo "export PATH=~/programs/nim-0.17.0/bin:$PATH" >> ~/.bashrc
  88. #build fourier-alt
  89. cd ~/programs/fourier-alt
  90. nimble build
  91. #configure ramdisk
  92. #sudo mkdir -p /mnt/ramdisk
  93. #echo "ramfs /mnt/ramdisk ramfs nodev,nosuid,noexec,nodiratime,umask=000,noatime,size=256m 0 0" | sudo tee -a /etc/fstab
  94. #sudo chgrp plugdev /mnt/ramdisk
  95. #sudo chmod g+w /mnt/ramdisk
  96. #sudo chmod +t /mnt/ramdisk
  97. #cd ~
  98. #curl -L -o fourier.service https://gist.githubusercontent.com/niofis/86e6e3fbe72a01263fbd388bde7953ea/raw/
  99. #sudo mv fourier.service /etc/systemd/system/fourier.service
  100. #sudo systemctl enable fourier
  101. sudo mysql -u root -e "create database fourier;"
  102. sudo mysql -u root -e "create user 'fourier'@'localhost' identified by 'Sup3rDuper!';"
  103. sudo mysql -u root -e "grant all privileges on fourier.* to 'fourier'@'localhost';flush privileges;"
  104. cd ~
  105. curl -L -o fourier.sql https://gist.githubusercontent.com/niofis/cd843500ac96fe8ddc8f39a58a4afc55/raw/
  106. sudo mysql -u root -h localhost fourier < fourier.sql
  107. curl -L -o fourier-config.json https://gist.githubusercontent.com/niofis/0e95b950faa333909407b5a65270376d/raw/
  108. sudo mv fourier-config.json /etc/fourier-config.json
  109. curl -L -o Fourier-key.json https://gist.githubusercontent.com/niofis/7f8ced8fc878acf8c9b45d8db3bb5458/raw/
  110. sudo mv Fourier-key.json /etc/Fourier-key.json
  111. echo "****************************************************************************"
  112. echo "REMEMBER: Initialize attached storage and create a symlink named /var/fourier pointing to the storage volume"
  113. echo "****************************************************************************"