Automating Snipe-IT Installation on Ubuntu with a Bash Script

Managing IT assets can be a daunting task, but with the right tools, it becomes significantly more manageable. Snipe-IT is a powerful, open-source asset management system that simplifies tracking hardware, software, licenses, and more. To streamline the deployment process, I’ve developed a Bash script that automates the installation and configuration of Snipe-IT on Ubuntu servers.

๐Ÿ”ง Script Overview

The installation script is designed to:

  • Install and configure essential packages: Apache, PHP, MariaDB, Composer, and Git.
  • Set up the database: Create a dedicated database and user with appropriate permissions.
  • Download and configure Snipe-IT: Clone the latest version and set up necessary configurations.
  • Set permissions: Ensure correct ownership and permissions for Snipe-IT directories.
  • Configure Apache Virtual Host: Set up Apache to serve the Snipe-IT application.
  • Finalize installation: Clear cache, generate Laravel app key, and run migrations.
  • Error handling: Detect and report issues related to dependencies, permissions, and database migrations.

๐Ÿ“‚ Repository Details

You can find the script and detailed instructions in my GitHub repository: tabishshaikh90/Snipeit-installation

The repository contains:

  • install.sh: The main Bash script for installation.
  • README.md: Comprehensive guide on using the script.

๐Ÿ› ๏ธ Prerequisites

Before running the script, ensure you have:

  • An Ubuntu-based server (tested on Ubuntu 20.04 and 22.04).
  • Root or sudo access to the server.
  • A stable internet connection for downloading packages and dependencies.

๐Ÿš€ Installation Steps

  1. Clone the Repository:
    git clone https://github.com/tabishshaikh90/Snipeit-installation.git
    cd Snipeit-installation
    
  2. Make the Script Executable:
    chmod +x install.sh
    
  3. Run the Installation Script:
    sudo ./install.sh
    

    The script will prompt you for necessary information, such as database credentials and domain name.

  4. Access Snipe-IT:Once the installation is complete, open your web browser and navigate to your server’s IP address or domain name to access the Snipe-IT setup wizard.

๐Ÿงช Testing and Validation

After installation:

  • Verify Services: Ensure Apache and MariaDB services are running.
    systemctl status apache2
    systemctl status mariadb
    
  • Check Snipe-IT: Navigate to your server’s address to confirm the Snipe-IT web interface is accessible.
  • Review Logs: Check Apache and Snipe-IT logs for any errors or warnings.

๐Ÿ“Œ Notes

  • The script is intended for fresh installations. If you’re running other services on the server, review the script to prevent conflicts.
  • Always back up your server before running automated scripts.
  • For production environments, consider securing your server with SSL certificates and firewall configurations.

๐Ÿค Contributions

Feedback and contributions are welcome! If you encounter issues or have suggestions, feel free to open an issue or submit a pull request on the GitHub repository.


By automating the installation process, this script aims to save time and reduce potential errors during manual setup. Happy asset managing!

Leave a Reply

Your email address will not be published. Required fields are marked *