Skip to content

Instantly share code, notes, and snippets.

@AreRex14
Created June 20, 2021 08:44
Show Gist options
  • Save AreRex14/64bdfdf85c3f352124c5a482b2bfe901 to your computer and use it in GitHub Desktop.
Save AreRex14/64bdfdf85c3f352124c5a482b2bfe901 to your computer and use it in GitHub Desktop.
Basic script to install Suricata IDS/IPS 5.0.0 for Linux (specifically Ubuntu 18.04 LTS)
#for logging useful message during script execution
log() {
echo "[+] $1"
}
install() {
log "Installing Suricata 5 for Linux..."
sudo apt-get update -y
#to download suricata source
sudo apt-get install -y wget
#install recommended suricata dependencies
#refer ubuntu/debian package repository for desc/about of each packages
sudo apt-get install -y libpcre3 libpcre3-dbg libpcre3-dev autoconf automake libtool build-essential libpcap-dev && \
sudo apt-get install -y libnet1-dev libyaml-0-2 libyaml-dev libjansson4 pkg-config zlib1g zlib1g-dev && \
sudo apt-get install -y libcap-ng-dev libcap-ng0 make libmagic-dev libjansson-dev && \
sudo apt-get install -y libnss3-dev libgeoip-dev liblua5.1-0-dev libluajit-5.1-dev libhiredis-dev libmaxminddb-dev libevent-dev python-yaml && \
#for Rust support
sudo apt-get install -y rustc cargo
#Extra for iptables/nftables IPS integration
sudo apt-get install libnetfilter-queue-dev libnetfilter-queue1 libnetfilter-log-dev libnetfilter-log1 libnfnetlink-dev libnfnetlink0
#install missing dependencies
sudo apt-get install -y --fix-missing
log "Get Suricata release source..."
#unless not work, try with latest stable of Suricata 5 > https://www.openinfosecfoundation.org/download/suricata-5.0.6.tar.gz
wget https://openinfosecfoundation.org/download/suricata-5.0.0.tar.gz
#extract gzip package
tar -xvzf suricata-5.0.0.tar.gz
cd suricata-5.0.0 || exit
log "Configuring IDS/IPS..."
#https://suricata.readthedocs.io/en/suricata-5.0.6/install.html#common-configure-options
#https://suricata.readthedocs.io/en/suricata-5.0.0/install.html#common-configure-options
./configure --enable-nfqueue --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
--with-libhs-libraries=/usr/local/lib/ --enable-geoip --enable-hiredis \
--disable-gccmarch-native --enable-gccprotect --enable-luajit --enable-pie
make clean && make && sudo make install && sudo make install-conf
#create link and cache to shared libraries
sudo ldconfig
log "Installation complete!"
}
install
@AreRex14
Copy link
Author

  1. Download the script
  2. sudo chmod +x suricata-install.sh
  3. sudo ./suricata-install.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment