使用GNURadio一般都在Linux下,官方有Ubuntu的LiveCD,Mac下也能兼容,但我一般还是习惯用Ubuntu,当年我的进化路线是Win98SE-WinME-Win2000-WinNT-WinXP-Win2003-RedHat9-Fedora-CentOS-OpenSUSE-Debian-Ubuntu-Arch-Gentoo-LFS-BackTrack-Ubuntu,从赛扬600的松下二手本到P4的Thinkpad G40二手本,一路玩过来,最后还是懒了,基本就在Debian和Ubuntu上打转

用GNURadio也是从Ubuntu 14.04到16.04,但Unity对GNURadio的界面支持不太好,就像Mac下的X11,丑的难以接受,所以基本都安装Gnome版本的Ubuntu,到了18.04官方终于把默认桌面环境改到Gnome,但一开始用16.04写的脚本安装时候报了一些错,所以整理了下18.04的安装过程


安装配置Ubuntu 18.04系统


去官网下载desktop安装镜像安装系统
https://www.ubuntu.com/download/desktop

安装时候,我一般选择英文系统,安装配置完再设置中文

安装完成后,设置root密码,安装openssh-server,配置远程登录

1
2
3
$sudo passwd root
$su -
#apt-get install openssh-server

之后修改sshd配置文件,将PermitRootLogin的参数prohibit-password改为yes,允许root登录

1
2
3
4
5
6
vi /etc/ssh/sshd_config

#PermitRootLogin prohibit-password
PermitRootLogin yes

service ssh restart

之后就可以用putty、xshell、securecrt等终端软件远程登录操作了

登录后进行基本配置,我写了个脚本,保存为ub1804_install.sh,然后执行

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
(
cat <<EOF
deb http://mirrors.ustc.edu.cn/ubuntu bionic main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu bionic-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu bionic-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu bionic-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu bionic-backports main restricted universe multiverse

deb-src http://mirrors.ustc.edu.cn/ubuntu bionic main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu bionic-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu bionic-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu bionic-proposed main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu bionic-backports main restricted universe multiverse
EOF
) > /etc/apt/sources.list

apt-get update && apt-get upgrade && apt-get -u dist-upgrade

apt-get install zsh vim openssh-server console-setup rar unrar ntpdate unzip htop screen tmux psmisc bzip2 nload wireless-tools wpasupplicant linux-headers-`uname -r` build-essential kernel-package autoconf lzma bc subversion git libncurses5-dev net-tools

sed -i 's/^PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
echo "greeter-show-manual-login=true" >> /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf

service ssh restart

echo "*/30 * * * * /usr/sbin/ntpdate cn.pool.ntp.org" > /etc/cron.d/ntp
crontab /etc/cron.d/ntp
/etc/init.d/cron restart

update-alternatives --config editor

dpkg-reconfigure console-setup

/etc/init.d/console-setup start

sysv-rc-conf

vi /etc/network/interfaces

echo >> /etc/motd

(
cat <<EOF
# ~/.bashrc: executed by bash(1) for non-login shells.

#PS1='\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\\$ '
PS1='\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;35m\]\w\[\033[00m\]\\$ '
umask 022

# You may uncomment the following lines if you want 'ls' to be colorized:
export LS_OPTIONS='--color=auto'
#eval "\`dircolors\`"
alias ls='ls \$LS_OPTIONS'
alias ll='ls \$LS_OPTIONS -l'
alias l='ls \$LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'

if [ -f /etc/bash_completion ];then
. /etc/bash_completion
fi
EOF
) > /root/.bash_profile

echo "syntax on" >> /root/.vimrc

vi /etc/fstab

rm -rf /etc/grub.d/20_memtest86+
sed -i "s/GRUB_TIMEOUT=10/GRUB_TIMEOUT=3/g" /etc/default/grub
sed -i "s/GRUB_CMDLINE_LINUX=\"\"/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
sed -i "s/#GRUB_DISABLE/GRUB_DISABLE/g" /etc/default/grub

update-grub2

sed -i "s/timeout=-1/timeout=3/g" /boot/grub/grub.cfg

sed -i "s/^printf/#printf/g" /etc/update-motd.d/10-help-text

echo "Over!"

通常我会编辑fstab,将id号改为/dev/xxx,这样方便我打包备份、迁移配置好的系统

另外,安装完成后,不常用的那些游戏、office那些我都会删掉,虽然现在硬盘不值钱,但省一点空间是一点,不要浪费

最后再在Language中将汉语拖到最上面,将系统设置为中文,注销再登录或者重启后,会提示是否将用户目录下的那些文件夹改为中文名,我通常都是保留旧名称然后不再提醒,毕竟在终端下总切换中文太麻烦

中文输入法在设置-区域和语言-输入源中添加汉语-Pinyin就可以了


安装配置常用软件


vnc是很常用的,可以装

1
2
3
4
5
wget https://www.realvnc.com/download/file/vnc.files/VNC-Server-6.3.2-Linux-x64.deb
dpkg -i VNC-Server-6.3.2-Linux-x64.deb
vnclicense -add 46262-6H7LB-9SH8M-MK5MV-ASHZA
systemctl enable vncserver-x11-serviced.service
systemctl start vncserver-x11-serviced.service

通常我会在vnc先配置下,比如关闭自动更新,登录方式改为将UNIX password改为VNC password
之后再其他机器上用vncviewer连接看一下


SSR更不用说,有2种安装方式:
PlanA 是直接去github下载最新的bin,之后执行即可,注意,最后执行需要在本机图形界面或者vnc图形中执行

1
2
3
4
wget https://github.com/shadowsocks/shadowsocks-qt5/releases/download/v3.0.1/Shadowsocks-Qt5-3.0.1-x86_64.AppImage
chmod 777 Shadowsocks-Qt5-3.0.1-x86_64.AppImage
mv Shadowsocks-Qt5-3.0.1-x86_64.AppImage /usr/local/bin/
Shadowsocks-Qt5-3.0.1-x86_64.AppImage &

PlanB 是apt安装,但作者没有出18.04版本的,但17.10版本是一样可以用的

1
2
3
4
add-apt-repository ppa:hzwhuang/ss-qt5
sed -i "s/bionic/artful/g" /etc/apt/sources.list.d/hzwhuang-ubuntu-ss-qt5-bionic.list
apt-get update
apt-get install shadowsocks-qt5

装完SSR我习惯也把SS装上

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
apt-get install shadowsocks-libev

(
cat <<EOF
{
"server":"x.x.x.x",
"server_port":"xxx",
"local_port":"1080",
"password":"xxxxxxxx",
"timeout":60,
"method":"aes-256-cfb",
"fast_open":false
}
EOF
) > /etc/shadowsocks-libev/config.json

ss-local -c /etc/shadowsocks-libev/config.json

再安装几个常用软件,gnome-tweak-tool是gnome的优化配置工具,psensor是温度监测工具,conky是自定义桌面监控工具,当年还写过conky的配置教程,不过已经过时了,以后有空再写个新的~~

1
apt-get install gnome-tweak-tool psensor conky

装完SS和SSR,可以再装个sock5协议转换http协议的软件Polipo,但需要依赖dnsmasq,dnsmaq又和系统的systemd-resolved冲突,如果先关了systemd-resolved又没有dns解析,除非手动加配置,太麻烦,所以先安装,无视安装时的报错,再关systemd-resolved,再启动dnsmasq,

1
2
3
4
5
apt-get install dnsmasq
systemctl stop systemd-resolved
systemctl disable systemd-resolved
systemctl stop dnsmasq
systemctl start dnsmasq

修改配置文件

1
2
3
4
vi  /etc/NetworkManager/NetworkManager.conf

[main]
dns=dnsmasq

重启服务,设置关联

1
2
3
systemctl restart NetworkManager
rm -rf /etc/resolv.conf
ln -s /var/run/NetworkManager/resolv.conf /etc/resolv.conf

最后才安装Polipo

1
2
3
4
5
6
7
8
9
10
11
apt-get install polipo

(
cat <<EOF

socksParentProxy = "127.0.0.1:1080"
socksProxyType = socks5
proxyAddress = "0.0.0.0"
proxyPort = 8123
EOF
) >> /etc/polipo/config

相比Firefox,我更喜欢Chrome

1
2
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dpkg -i google-chrome-stable_current_amd64.deb

避免每次update都报错,除非开了SS或者SSR

1
2
3
vi /etc/apt/sources.list.d/google-chrome.list

#deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main

修改数据目录

1
2
3
4
vi /opt/google/chrome/google-chrome

HERE="`dirname "$CHROME_WRAPPER"`"后面添加
CHROME_USER_DATA_DIR="/root/.config/google-chrome"

安装配置GNU Radio 环境


安装基本依赖包

1
2
3
4
5
6
7
apt-get -y install git cmake g++ python-dev swig  \
pkg-config libfftw3-dev libboost-all-dev libcppunit-dev libgsl-dev \
libusb-dev libsdl1.2-dev python-wxgtk3.0 python-numpy python-cheetah \
python-lxml doxygen libxi-dev python-sip libqt4-opengl-dev libqwt-dev \
libfontconfig1-dev libxrender-dev python-sip python-sip-dev python-qt4 \
python-sphinx libusb-1.0-0-dev libcomedi-dev libzmq3-dev python-mako \
python-gtk2

这里我使用pybombs来配置,所以需要还需要安装python-pip

1
2
apt-get install python-pip
pip install --upgrade pip

这里可能需要注销或者重启一下,当然也可能不需要,看执行后面的命令会不会报错

1
2
3
pip install  git+https://github.com/gnuradio/pybombs.git
pybombs recipes add gr-recipes git+https://github.com/gnuradio/gr-recipes.git
pybombs recipes add gr-etcetera git+https://github.com/gnuradio/gr-etcetera.git

安装到/usr/local目录,目录下会有.pybombs目录

1
pybombs prefix init /usr/local -a myprefix -R gnuradio-default

** 这个过程很漫长,需要先下载源码,然后编译,如果电脑性能不够好时间会很长,而且会把CPU跑满,做好散热吧 **

ubuntu 18.04 默认安装apache-thrift会报错,直接进源码目录手动安装

1
2
3
4
cd /usr/local/src/apache-thrift/
./configure
make -j 8
make install

如果安装出问题,直接安装所需要的组件就行,或者有其他自己想用的组件,都可以这样安装

1
pybombs install osmo-sdr  rtl-sdr gnuradio dump1090 hackrf bladeRF airspy gr-iqbal libosmo-dsp gr-osmosdr armadillo gflags glog gnutls gnss-sdr gqrx

如果用USRP需要下载image,需要挂代理,不然这个过程非常漫长

1
uhd_images_downloader

安装gr-fosphor出现过问题,所以单独说下,因为这个需要opencl库
如果是intel集显

1
apt-get install beignet-dev

如果是nVidia独显

1
apt-get install nvidia-opencl-dev

如果是AMD独显,去官网下载安装驱动
https://www.amd.com/en/support
然后安装APP SDK,但官网很奇葩,现在居然404了,这里给个链接
https://github.com/Microsoft/LightGBM/releases/download/v2.0.12/AMD-APP-SDKInstaller-v3.0.130.136-GA-linux64.tar.bz2
官方给的解释是直接apt安装opencl-headers就可以了,因为没有amd显卡的机器,我没有实测,哪位如果实测了可以告诉我结果

1
apt install opencl-headers

之后可以安装了

1
pybombs install gr-fosphor

如果遇到gqrx无法启动

1
usermod -a -G pulse-access root

安装最新audacity和wireshark,建议挂代理,不然下载很慢

1
2
3
4
5
6
7
8
cd
add-apt-repository ppa:ubuntuhandbook1/audacity
apt-get update
apt-get install audacity

add-apt-repository ppa:wireshark-dev/stable
apt-get update
apt-get install wireshark

安装dspectrum、inspectrum和urh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
cd
apt-get install ruby
git clone https://github.com/jgaeddert/liquid-dsp.git
cd liquid-dsp
./bootstrap.sh
./configure
make -j 8
make install
ldconfig

cd
apt-get install qt5-default libfftw3-dev cmake pkg-config
git clone https://github.com/miek/inspectrum.git
cd inspectrum
mkdir build
cd build
cmake ..
make -j 8
make install

cd
git clone https://github.com/tresacton/dspectrum.git
cd dspectrum
chmod +x ./dspectrum
gem install colorize
cp ./dspectrum /usr/local/bin/

cd
ln -s /usr/lib/x86_64-linux-gnu/libLimeSuite.so.17.02.2 /usr/lib/x86_64-linux-gnu/libLimeSuite.so
apt-get install python3-numpy python3-psutil python3-zmq python3-pyqt5 g++ libpython3-dev python3-pip cython3
git clone https://github.com/jopohl/urh/
cd urh
pip3 install urh

好了,基本环境配置完成,其他的按个人喜好自定义吧

祝大家用得开心~~