[This is a post 3 in two-part series :), for hardware setup go here]
While running SDR radio on Raspberry was fine, I kinda wanted to move this to one of my x86 servers. Due to this, I had to revisit my old guide.
When device is plugged in, trace should be seen in dmesg
. If everything is fine, you should see some activity.
Terminaldmesg | tail
…
[4306437.661393] usbcore: registered new interface driver dvb_usb_rtl28xxu
To get SDR running, there is some work involved with its compilation. Note the DETACH_KERNEL_DRIVER=ON
flag enabling SDR application to access device without disabling its driver. Rest is really similar to official instructions.
Terminalsudo apt-get install -y git build-essential cmake libusb-1.0-0-dev libglib2.0-dev
cd ~
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON
make
sudo make install
sudo ldconfig
This is an ideal time to test it. As I have the iptables
active, I manually enable port on external interface. Other than that I will not restrict application to a single IP but allow it to listen on all interfaces.
Terminaliptables -A INPUT -i eth0 -p tcp --dport 1234 -j ACCEPT
/usr/local/bin/rtl_tcp -a 0.0.0.0
The last step is to enable running it as a service. We need to create a separate user, enable service, and finalize it all with reboot.
Terminalsudo adduser --disabled-password --gecos "" sdr
sudo usermod -a -G plugdev sdr
sudo cat > /lib/systemd/system/rtl_tcp.service <<- EOF
[Unit]
After=network.target
[Service]
Type=exec
ExecStart=/usr/local/bin/rtl_tcp -a 0.0.0.0
KillMode=process
Restart=on-failure
RestartSec=10
User=sdr
[Install]
WantedBy=multi-user.target
Alias=rtl_tcp.service
EOF
sudo systemctl enable /lib/systemd/system/rtl_tcp.service
sudo reboot
And that's it. Now you can run SDR TCP server on your Ubuntu server.