In this tutorial, we will be installing Snipe IT, an open-source asset management software, on the latest stable release of NixOS. Snipe IT is built using Laravel and Vue.js, and it provides a simple and intuitive interface for managing assets such as computers, servers, and other hardware.
Before we install Snipe IT, we need to make sure that our NixOS server meets the following requirements:
Let's get started with the installation process.
The first step is to install the necessary packages that we need for Snipe IT to run. We can do this by updating the package manager and installing the packages with the following commands:
$ sudo nixos-rebuild switch
$ sudo nix-env -i nodejs yarn nginx
We need to create a new database and a user to access it. We can do this by running the following command:
$ sudo mysql_secure_installation
Follow the prompts to set a root password and answer the security questions. Once the installation is complete, log in to MySQL with the following command:
$ sudo mysql -u root -p
Now we can create a new database and a user with the privileges to access it:
CREATE DATABASE snipeit;
GRANT ALL PRIVILEGES ON snipeit.* TO 'snipeit'@'localhost' IDENTIFIED BY 'your_password_here';
FLUSH PRIVILEGES;
EXIT;
Note that you should replace 'your_password_here' with a strong and secure password.
We can now download and install Snipe IT with the following commands:
$ cd /var/www
$ sudo git clone https://github.com/snipe/snipe-it.git
$ cd snipe-it
$ sudo cp .env.example .env
Next, we need to edit the .env file to reflect our database details. Open the file with your favorite text editor, and modify the following lines:
APP_URL=https://your_domain_or_ip_address.com
DB_HOST=localhost
DB_DATABASE=snipeit
DB_USERNAME=snipeit
DB_PASSWORD=your_password_here
Save the changes and exit the editor.
Now we can install the dependencies and generate the application key with the following commands:
$ sudo composer install
$ sudo php artisan key:generate
$ sudo chown -R www-data:www-data /var/www/snipe-it
Finally, we need to run the database migrations and seed the database:
$ sudo php artisan migrate --seed
We need to configure Nginx to serve Snipe IT. Create a new Nginx configuration file with the following command:
$ sudo nano /etc/nginx/sites-available/snipeit.conf
Add the following configuration to the file:
server {
listen 80;
server_name your_domain_or_ip_address.com;
root /var/www/snipe-it/public;
index index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
error_log /var/log/nginx/snipeit_error.log;
access_log /var/log/nginx/snipeit_access.log;
}
Replace 'your_domain_or_ip_address.com' with your own domain or IP address. Save the configuration file and exit the editor.
Next, create a symbolic link to enable the site and reload Nginx:
$ sudo ln -s /etc/nginx/sites-available/snipeit.conf /etc/nginx/sites-enabled/
$ sudo systemctl reload nginx
That's it, you're done! You can now access Snipe IT by navigating to http://your_domain_or_ip_address.com in your web browser. The default username and password are 'admin' and 'admin123'.
You should change the default password immediately after logging in, to ensure the security of your installation.
In this tutorial, we have shown you how to install Snipe IT on NixOS. Snipe IT is a powerful asset management software that can help streamline your IT operations, and with these instructions, you can have it up and running in no time. If you encounter any issues or have any questions, please reach out to the Snipe IT community for assistance.
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!