Skip to content

Instantly share code, notes, and snippets.

@bilson
Last active May 2, 2024 22:34
Show Gist options
  • Save bilson/00bac5eb5f38466bf2863a27ec9e5eb3 to your computer and use it in GitHub Desktop.
Save bilson/00bac5eb5f38466bf2863a27ec9e5eb3 to your computer and use it in GitHub Desktop.
Install script for rtl-sdr for ubuntu
#!/bin/bash
cd ~
sudo apt-get update
sudo apt-get install curl git cmake libusb-1.0-0.dev build-essential
cat <<EOF >no-rtl.conf
blacklist dvb_core
blacklist dvb_usb_rtl28xxu
blacklist dvb_usb_v2
blacklist e4000
blacklist rtl2830
blacklist rtl2832
EOF
sudo mv no-rtl.conf /etc/modprobe.d/
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON
make
sudo make install
sudo ldconfig
cd ~/rtl-sdr/
mkdir ~/spyserver
cd ~/spyserver
ARCH=$(uname -m)
if [ $ARCH == "x86_64" ] ; then
wget https://airspy.com/downloads/spyserver-linux-x64.tgz
tar zxvf spyserver-linux-x64.tgz
else
wget https://airspy.com/downloads/spyserver-linux-x86.tgz
tar zxvf spyserver-linux-x86.tgz
fi
sed -i '/.*device_type*/c\device_type = RTL-SDR' /home/$USER/spyserver/spyserver.config
sed -i '/.*device_sample_rate*/c\device_sample_rate = 2048000' /home/$USER/spyserver/spyserver.config
sed -i '/.*fft_fps*/c\fft_fps = 10' /home/$USER/spyserver/spyserver.config
sed -i '/.*initial_gain*/c\initial_gain = 20' /home/$USER/spyserver/spyserver.config
cd ~
cat <<EOF > spyserver.service
[Unit]
Description=Spy Server
Wants=network-online.target
After=network-online.target
[Service]
ExecStartPre=/bin/sleep 15
ExecStart=/home/$USER/spyserver/spyserver spyserver.config
WorkingDirectory=/home/$USER/spyserver/
StandardOutput=inherit
StandardError=inherit
Restart=always
User=$USER
[Install]
WantedBy=multi-user.target
EOF
sudo mv spyserver.service /etc/systemd/system/spyserver.service
sudo systemctl enable spyserver.service
sudo systemctl start spyserver.service
echo "Install finished. Please reboot."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment