最近在做代码漏洞检测的实验,需要用到代码分析工具joern。安装过程参考了多个博客,也遇到了一些小坑。在这里整合一下我安装的完整过程,希望能帮到看到这篇文章的各位。
安装过程主要参考:https://github.com/joernio/joern
安装jdk11
主要参考这篇教程:
https://blog.csdn.net/csdnksqc/article/details/119993048
gcc或g++
Ubuntu16.04自带gcc 5.4.0 我就没另外安装
安装joern
wget https://github.com/joernio/joern/releases/latest/download/joern-install.sh
chmod +x ./joern-install.sh
sudo ./joern-install.sh //这里注意要进入joern-install.sh所在的文件夹,我的是在home文件夹下
执行这句的时候报错:
Symbolic links in: /usr/local/bin Please ensure you have curl installed.
于是安装一下curl
sudo apt install curl
再次执行
sudo ./joern-install.sh
有点慢,我等待了差不多一个小时,完成了。但是有一个提示说没检测到java。
No java installations was detected.
Please go to http://www.java.com/getjava/ and download
原来是上面安装jdk11的时候,只配置了一个暂时的环境变量,需要配置全局的永久环境变量,这里需要先回到系统的根目录下,然后
sudo gedit /etc/profile
在文件末尾粘贴上
export PATH=$PATH:/usr/local/share/jdk-11.0.9/bin
export JAVA_HOME=/usr/local/share/jdk-11.0.9
export J2SDKDIR=/usr/local/share/jdk-11.0.9
然后输入以下命令使环境变量生效
source /etc/profile
在home文件夹下有一个joern-cli.zip文件,解压一下,进入这个文件夹。
最后执行一下
./joern
大功告成