Installing Snipe-IT on CentOS 7 and MariaDB



  • Can't seem to grasp how to upgrade from V2 to V3 as I've used the above method and used the install.sh

    So not sure if I should be using GIT to clone the new version and then how to install/move the latest version and what files need editing.

    https://snipe-it.readme.io/docs/upgrading



  • @Romo said in Installing Snipe-IT on CentOS 7 and MariaDB:

    @jfc Setup you CentOS 7 vm and only use their install script.

    wget https://raw.githubusercontent.com/snipe/snipe-it/master/install.sh
    chmod 744 install.sh
    ./install.sh
    

    It will download everything you need and get you to a working Snipe IT installation, I just setup my own Snipe IT vm like this =).

    Tested on centOS 7 installs great. Wonder how we update.



  • @tiagom Taken from here https://snipe-it.readme.io/docs/how-to-upgrade:

    Upgrading
    Updating Snipe-IT should be pretty straightforward. Simply pull down the newest release, copy the files over, and run whatever commands the release notes specify. Your configuration won’t be overwritten, since the .env file isn't checked into version control.

    Always backup your database and configuration files before upgrading. We try very hard to make sure that all database changes are non-destructive, but you should always backup beforehand anyway. You will never regret backing up your database. You may regret not doing so, so it’s just better to get into the habit.

    Whenever you pull down a new version from master or develop, or when you grab the latest official release, make sure to run the following commands via command line:

    php composer.phar install --no-dev --prefer-source
    php composer.phar dump-autoload
    php artisan migrate
    php artisan config:clear
    php artisan config:cache
    (Developers should remove the --no-dev flag, so they have unit test frameworks and debugging tools.)

    Forgetting to run these commands can mean your DB might end up out of sync with the new files you just pulled, or you may have some funky cached autoloader values.

    It’s a good idea to get into the habit of running these every time you pull anything new down. If there are no database changes to migrate, it won't hurt anything to run migrations anyway, you’ll just see "Nothing to migrate".

    If you have any issues upgrading, check the Common Issues page for a fix. If you don’t see your issue listed there, open an issue on Github and we’ll try to get you sorted out. Be sure to provide the information outlined in the Getting Help section of this site so that we have the info we need to assist you.



  • @Romo said in Installing Snipe-IT on CentOS 7 and MariaDB:

    Upgrading
    Updating Snipe-IT should be pretty straightforward. Simply pull down the newest release, copy the files over, and run whatever commands the release notes specify. Your configuration won’t be overwritten, since the .env file isn't checked into version control.

    That's the first issue I have. I used the install.sh method so how do we download the latest?

    Do I GIT the latest into the var/www/snipeit folder?
    Do I download a zip/tar and unpack into the folder etc etc. 🙂



  • @hobbit666 You can use either way, they both accomplish the same thing that is downloading the newest source files.

    Step 1: Backup your database
    While logged in, go to Admin > Backups and generate a new backup. Download that file and keep it somewhere safe, in case you need to restore back to that version if something goes wrong with your upgrade.

    Step 2: Backup your old version
    The easiest way to do this will be to just rename your old Snipe-IT install directory and create a new, empty directory that uses the old directory name, but you can handle this any way that works for you.

    For example, if your Snipe-IT was installed in /var/www/snipe-it, you could rename that directory to /var/www/snipe-it-backup and then create a new directory /var/www/snipe-it.

    Step 3: Download/clone the new release
    Download the zip from: https://github.com/snipe/snipe-it/archive/master.zip
    or
    git clone https://github.com/snipe/snipe-it.git

    Step 4: Update dependencies
    Whenever you pull down a new version, you should update the dependencies via Composer and dump the autoloader.

    NOTE: Never run composer as a super-user or Administrator. Always run it as the user that owns the Snipe-IT files. Running composer as a super-user will break things in ways that will be difficult to debug later. Just don't do it.

    1st you'll need to install composer into the directory if you don't have it installed globally:

    cd <install-dir>
    curl -sS https://getcomposer.org/installer | php 
    

    Noq update dependencies and dump the auto-loader.

    php composer.phar install --no-dev --prefer-source
    php composer.phar dump-autoload
    

    Step 5: Copy over your configuration settings

    IMPORTANT:
    This step will only need to be done once, while upgrading to v3.0. Once you've upgraded to v3.0, you won't ever have to do this part again.

    Open up your .env file in your new Snipe-IT install directory, and update the configuration placeholders you see there with the values you were previously using in your individual config files.

    If you don't have a .env file, just copy the existing .env.example over to .env and use that:

    cp .env.example .env
    

    The files you'll be copying from are:

    • app/config/app.php
    • app/config/production/app.php
    • app/config/production/database.php
    • app/config/production/mail.php
    • app/config/production/session.php
    New .env Setting Old Config File Old Config File Key Notes
    APP_ENV N/A N/A Set to production
    APP_DEBUG /app/config/production/app.php debug
    APP_KEY /app/config/production/app.php key Make SURE you keep this app key the same from your old version.
    APP_URL /app/config/production/app.php url
    APP_TIMEZONE /app/config/app.php timezone
    APP_LOCALE /app/config/app.php locale
    DB_CONNECTION /app/config/production/database.php default This should be mysql
    DB_HOST /app/config/production/database.php connections-> mysql-> host
    DB_DATABASE /app/config/production/database.php connections-> mysql-> database
    DB_USERNAME /app/config/production/database.php connections-> mysql-> username
    DB_PASSWORD /app/config/production/database.php connections-> mysql-> password
    DB_PREFIX /app/config/production/database.php connections-> mysql-> prefix
    DB_DUMP_PATH N/A N/A Path to your dabase dump binary (such as mysqldump)e.g. '/usr/local/bin'
    MAIL_DRIVER /app/config/production/mail.php driver
    MAIL_HOST /app/config/production/mail.php host
    MAIL_PORT /app/config/production/mail.php port
    MAIL_USERNAME /app/config/production/mail.php username
    MAIL_PASSWORD /app/config/production/mail.php password
    MAIL_ENCRYPTION /app/config/production/mail.php encryption
    MAIL_FROM_ADDR /app/config/production/mail.php from->address
    MAIL_FROM_NAME /app/config/production/mail.php from->name
    IMAGE_LIB N/A N/A Should be set to gd or imagick, depending on which library you have on your server.
    SESSION_LIFETIME /app/config/production/session.php lifetime
    EXPIRE_ON_CLOSE /app/config/production/session.php expire_on_close
    ENCRYPT N/A N/A Should be set to true if you wish to encrypt your cookies.
    COOKIE_NAME /app/config/production/session.php cookie
    COOKIE_DOMAIN /app/config/production/session.php domain
    SECURE_COOKIES /app/config/production/session.php secure

    Everything else in your .env can be left alone, as they are more advanced settings that are not commonly used.

    Step 6: Move uploaded files and check permissions
    Since Laravel's file structure has changed, you're going to need to move a few files around to make sure your uploaded files (logo, uploaded asset files, asset model files, etc) are in their new location.

    cp ../snipe-it-backup/app/storage/dumps/* snipe-it/storage/app/backups/
    cp ../snipe-it-backup/app/private_uploads/* snipe-it/storage/private_uploads/
    cp ../snipe-it-backup/public/uploads/* snipe-it/public/uploads/
    

    Also confirm that your entire storage directory (and subdirectories) is writable by the web server.

    Step 7: Migrate the database
    Always run your database migrations on any upgrade, as this will make sure your database schema is up to date with what the new code expected.

    php artisan migrate
    

    Forgetting to run these commands can mean your DB might end up out of sync with the new files you just pulled, or you may have some funky cached autoloader values.

    It’s a good idea to get into the habit of running these every time you pull anything new down. If there are no database changes to migrate, it won't hurt anything to run migrations anyway, you’ll just see "Nothing to migrate".

    Step 8: Launch Snipe-IT in a browser
    You should be all set now, so just go to your old Snipe-IT URL and make sure everything is working.



  • @Romo said in Installing Snipe-IT on CentOS 7 and MariaDB:

    @hobbit666 You can use either way, they both accomplish the same thing that is downloading the newest source files.

    Step 1: Backup your database
    While logged in, go to Admin > Backups and generate a new backup. Download that file and keep it somewhere safe, in case you need to restore back to that version if something goes wrong with your upgrade.

    Thanks Romo will give it a try Monday/Tuesday



  • @NashBrydges Thanks a lot! its the first step by step for amateurs i had see, 🙂



  • @scottalanmiller @brandon.hay I am getting the below error message... Please assist...
    0_1475333103577_Capture.PNG



  • @rejivincentc welcome to the community.



  • @scottalanmiller Thanks...

    I managed to login the snipe-it after that the webpage is blank...

    Please assist asap...



  • Thx for mentioning Snipe-IT, @scottalanmiller. Didn't follow your instructions, because the install script provided by Snipe worked like a charm.

    The tool is great, I'm just missing a few things. For example

    • Licenses should be treated the same way as assets (Create a "template", create instances of that template).
    • Assets can't be checked out to other assets (Notebook docking station -> Notebook).
    • Components (or Accessories?) can't have vendors, which is a bit odd.
    • Components must have a minimum of 1 unused item or they will generate an alert otherwise. No I don't want to have 1 spare part of every little gadget 🙂
    • Does not handle floating licenses.
    • Licenses can't be upgraded (but you can assign two versions of the same software to the same machine / user which works just fine)
    • You can't modify software checkout dates via the GUI

    But all in all, it's great. Simplifies tracking of assets and licenses.



  • @thwr said in Installing Snipe-IT on CentOS 7 and MariaDB:

    Thx for mentioning Snipe-IT, @scottalanmiller. Didn't follow your instructions, because the install script provided by Snipe worked like a charm.

    It's been a bit, they've changed a lot because their old script didn't install at all, hence these instructions. Which script did you use?



  • @scottalanmiller Script used - yum -y install wget firewalld; setenforce 0 && yum -y install epel-release; mkdir -p /var/www/html; cd /var/www/html/; wget https://raw.githubusercontent.com/snipe/snipe-it/master/install.sh && chmod 744 install.sh && ./install.sh && cd snipeit; sed -i "s/'timezone' => '',/'timezone' => 'UTC',/" app/config/app.php; php artisan app:install; firewall-cmd --zone=public --add-port=80/tcp --permanent; firewall-cmd --reloadrpm

    OS -Centos 7
    snipe-it-3.4



  • @scottalanmiller said in Installing Snipe-IT on CentOS 7 and MariaDB:

    @thwr said in Installing Snipe-IT on CentOS 7 and MariaDB:

    Thx for mentioning Snipe-IT, @scottalanmiller. Didn't follow your instructions, because the install script provided by Snipe worked like a charm.

    It's been a bit, they've changed a lot because their old script didn't install at all, hence these instructions. Which script did you use?

    Will take a look on Tuesday. But it was the one provided in the github package.



  • @rejivincentc said in Installing Snipe-IT on CentOS 7 and MariaDB:

    @scottalanmiller Script used - yum -y install wget firewalld; setenforce 0 && yum -y install epel-release; mkdir -p /var/www/html; cd /var/www/html/; wget https://raw.githubusercontent.com/snipe/snipe-it/master/install.sh && chmod 744 install.sh && ./install.sh && cd snipeit; sed -i "s/'timezone' => '',/'timezone' => 'UTC',/" app/config/app.php; php artisan app:install; firewall-cmd --zone=public --add-port=80/tcp --permanent; firewall-cmd --reloadrpm

    OS -Centos 7
    snipe-it-3.4

    Just use the following and it will take you to a working install of Snipe-IT

    wget https://raw.githubusercontent.com/snipe/snipe-it/master/install.sh
    chmod 744 install.sh
    ./install.sh
    


  • @Romo said in Installing Snipe-IT on CentOS 7 and MariaDB:

    Just use the following and it will take you to a working install of Snipe-IT

    Not when this was originally wrote.



  • @Romo said in Installing Snipe-IT on CentOS 7 and MariaDB:

    @rejivincentc said in Installing Snipe-IT on CentOS 7 and MariaDB:

    @scottalanmiller Script used - yum -y install wget firewalld; setenforce 0 && yum -y install epel-release; mkdir -p /var/www/html; cd /var/www/html/; wget https://raw.githubusercontent.com/snipe/snipe-it/master/install.sh && chmod 744 install.sh && ./install.sh && cd snipeit; sed -i "s/'timezone' => '',/'timezone' => 'UTC',/" app/config/app.php; php artisan app:install; firewall-cmd --zone=public --add-port=80/tcp --permanent; firewall-cmd --reloadrpm

    OS -Centos 7
    snipe-it-3.4

    Just use the following and it will take you to a working install of Snipe-IT

    wget https://raw.githubusercontent.com/snipe/snipe-it/master/install.sh
    chmod 744 install.sh
    ./install.sh
    

    Big changes from how it was before. Glad to see that they've made so much progress.



  • The install script works great. The stuff the tripped me up I submitted a PR to correct.

    Im still transitioning over, i currently have about 30% of my assets in there.



  • @scottalanmiller said in Installing Snipe-IT on CentOS 7 and MariaDB:

    se the following and it will take you to a working install of S

    Thanks 🙂



  • @rejivincentc said in Installing Snipe-IT on CentOS 7 and MariaDB:

    @scottalanmiller said in Installing Snipe-IT on CentOS 7 and MariaDB:

    se the following and it will take you to a working install of S

    Thanks 🙂

    Glad that it is working!



  • so thankful I ran across this article, much more helpful then the snipe-it documentation. I am trying to do the CentOS 7 install method and have tried the single line Scott showed and the wget line that was confirmed working. Everything installs fine but when I enter the IP address/hostname nothing loads, I then open up the firewall to port 80 and the IP address will redirect to the hostname/setup but I receive a "This site can't be reached" I have literally spent 4 hours trying different things with no luck, the server DNS address could not be found is what I am seeing now.
    Please help!!! lol



  • @Robblehead Hi,
    Please try this one...

    setenforce 0
    mkdir -p /var/www/html; cd /var/www/html/
    wget https://raw.githubusercontent.com/snipe/snipe-it/master/install.sh
    chmod 744 install.sh
    ./install.sh



  • Did @rejivincentc update work for you?



  • @scottalanmiller I will test this afternoon and let you guys know, appreciate the help



  • @scottalanmiller Yes, its working





  • @rejivincentc unfortunately I am still not working with a clean install and running those lines mentioned.
    0_1491427502282_Screen Shot 2017-04-05 at 5.24.27 PM.png

    Any ideas?



  • The above script fails to opent he firewall.

    I just did a clean install and got the same result.

    [[email protected] html]# firewall-cmd --list-ports
    
    [[email protected] html]# firewall-cmd --zone=public --add-port=http/tcp --permanent
    success
    [[email protected] html]# firewall-cmd --reload
    success
    

    now it works.



  • So the full process to get a new clean version running is this.

    Install CentOS 7 minimal r1611 (current release as of this writing)

    Then run these commands.

    yum -y update
    yum -y install wget
    firewall-cmd --zone=public --add-port=http/tcp --permanent
    firewall-cmd --reload
    setenforce 0
    mkdir -p /var/www/html; cd /var/www/html/
    wget https://raw.githubusercontent.com/snipe/snipe-it/master/install.sh
    chmod 744 install.sh
    ./install.sh
    

    The install.sh script will install and enable the EPEL, MariaDB, and IUS repositories. Not sure why the MariaDB repo is needed as that is part of core now. Did not look at the script, just it said it was doing it on the status screen.

    Then it will install all the pieces.

    It also runs the secure mysql thing.

    Really the only thing it missed was the firewall.

    Obviously the whole disabling of SELinux is bad. I would never recommend running a server like that if given any choice at all.

    Unlike FreePBX, there are not that many pieces to this program, so it should not be hard to properly setup things to work with SELinux.



  • @JaredBusch Running a fresh install of CentOS 7 now, thanks for your help