Shaark is a web-based Wireshark-like network protocol analyzer that is compatible with PCAP files. It can help you troubleshoot network issues and monitor network traffic. In this tutorial, we will show you how to install Shaark on NixOS Latest.
Before you start, make sure that you have:
sudo
access.First, update the system to the latest version:
sudo nix-channel --update
sudo nixos-rebuild switch
You will need the following dependencies installed on your system:
You can install these dependencies by running the following commands:
sudo nix-env -i mysql nginx php-fpm composer
Next, clone the latest version of Shaark from GitHub:
git clone https://github.com/MarceauKa/shaark.git
To install the required PHP packages, navigate to the Shaark root directory and run the following command:
cd shaark
composer install
Create a new Nginx configuration file for Shaark:
sudo nano /etc/nginx/sites-available/shaark
Add the following configuration:
server {
listen 80;
server_name shaark.example.com;
root /path/to/shaark/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
Change the server_name
and root
values to match your environment. Save and exit the file.
Create a symbolic link to sites-enabled
:
sudo ln -s /etc/nginx/sites-available/shaark /etc/nginx/sites-enabled/
Remove the default Nginx configuration:
sudo rm /etc/nginx/conf.d/default.conf
Test the Nginx configuration:
sudo nginx -t
If there are no errors, restart Nginx:
sudo systemctl restart nginx
Edit the PHP-FPM configuration file:
sudo nano /etc/php-fpm.d/www.conf
Change the following values:
user = nginx
group = nginx
listen.owner = nginx
listen.group = nginx
Save and exit the file.
Restart PHP-FPM:
sudo systemctl restart php-fpm
Create a new database and user in MySQL:
mysql -u root -p
CREATE DATABASE shaark;
CREATE USER 'shaark'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON shaark.* TO 'shaark'@'localhost';
FLUSH PRIVILEGES;
Change password
to a secure password of your choice.
Copy the .env.example
file to .env
:
cp .env.example .env
Edit the .env
file:
APP_ENV=production
APP_DEBUG=false
APP_URL=http://shaark.example.com
DB_DATABASE=shaark
DB_USERNAME=shaark
DB_PASSWORD=password
Change the APP_URL
, DB_USERNAME
, DB_PASSWORD
values to match your environment. Save and exit the file.
Generate a new application key:
php artisan key:generate
Run the database migrations:
php artisan migrate
Start the built-in PHP development server:
php artisan serve --host=0.0.0.0 --port=8000
You should now be able to access Shaark by visiting http://server_ip_address:8000
in your web browser.
You have successfully installed Shaark on NixOS Latest. You can now use Shaark to analyze network traffic using PCAP files.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!