
Below are some instructions to install Netshot on a Debian-based system.
You can also consult our Blog at: http://www.netfishers.onl/blog


HOW TO INSTALL NETSHOT ON A DEBIAN-BASED MACHINE

### 0. Unzip the Netshot package
You must have downloaded it from the NetFishers web site.
Unzip the file.
$ unzip netshot_x.y.z.zip

### 1. Install a database server, e.g. MySQL
$ sudo apt-get install mysql-server


### 2. Install Java 8
Using the PPA is probably the easiest way to go.

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer

If these commands are not available on your system (Debian), manually add the
source list and import the key. Follow the instructions on this page:
http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html.

Check the running Java version:
$ java -version 2>&1 | grep version
This should give 1.8.x


### 3. Add a dedicated system user

$ sudo adduser --system --home /usr/local/netshot --disabled-password --disabled-login netshot


### 4. Create the SSL certificate

$ sudo keytool -genkey -keyalg RSA -alias selfsigned -keystore netshot.jks -storepass password -validity 3600 -keysize 2048
Press Enter when asked for a password.

$ sudo mv netshot.jks /usr/local/netshot
$ sudo chmod o-r /usr/local/netshot


### 5. Prepare files

$ sudo cp netshot.jar /usr/local/netshot
$ sudo mkdir /usr/local/netshot/drivers
$ sudo chown -R netshot /usr/local/netshot
$ sudo mkdir /var/log/netshot
$ sudo chown -R netshot /var/log/netshot
$ sudo cp netshot.conf /etc/netshot.conf
$ sudo chown netshot /etc/netshot.conf
$ sudo chmod 400 /etc/netshot.conf

In case of SysV system:

$ sudo cp initd-netshot /etc/init.d/netshot
$ sudo chown root:root /etc/init.d/netshot
$ sudo chmod +x /etc/init.d/netshot

In case of systemd system:

$ sudo cp systemd-netshot /etc/systemd/system/netshot.service
$ sudo systemctl enable netshot.service


### 6. Create database and user

$ mysql -u root
> CREATE DATABASE netshot01 CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
> GRANT ALL PRIVILEGES ON netshot01.* TO 'netshot'@'localhost' IDENTIFIED BY 'netshot';
> quit


### 7. Start Netshot service

$ sudo service netshot start


### 8. Manually create the initial user

$ mysql -u root
> USE netshot01;
> INSERT INTO user (level, local, username, hashed_password) VALUES (1000, 1, 'netshot', '7htrot2BNjUV/g57h/HJ/C1N0Fqrj+QQ');

Now you should be able to access Netshot with a browser, on
https://localhost:8443/ on the machine itself.
Use the account netshot (password netshot) for the initial login (then you can
create the real users in the Admin section).


### 9. Optional - UDP port translation
If you want Netshot to detect changes from Syslog and/or SNMP messages sent by
the devices, you can translate the UDP ports using iptables:

$ sudo cp ifup-netshot /etc/network/if-up.d/netshot
$ sudo chown root:root /etc/network/if-up.d/netshot
$ sudo chmod +x /etc/network/if-up.d/netshot


### 10. Optional - Start Netshot at bootup

$ sudo update-rc.d netshot defaults
