コンテンツまでスキップ

無料で使える資産管理システム Snipe-ITをインストールする

snipe-itのインストール

前提条件

  • xserver の ubuntu24.04をセットアップした状態からの手順です。

snipe-itのダウンロード

git clone https://github.com/snipe/snipe-it snipe-it

インストール処理の起動

ダウンロードしたフォルダにある、install.shを実行すると、インストールが始まります。

 cd snipe-it
 sh ./install.sh

シェルを起動すると、以下の画面が出てきます。
最初に、FQDNの入力が求められるので、適切な値を設定してください。

       _____       _                  __________
      / ___/____  (_)___  ___        /  _/_  __/
      \__ \/ __ \/ / __ \/ _ \______ / /  / /
     ___/ / / / / / /_/ /  __/_____// /  / /
    /____/_/ /_/_/ .___/\___/     /___/ /_/
                /_/
  Welcome to Snipe-IT Inventory Installer for CentOS, Rocky, Debian, and Ubuntu!
  Installation log located: /var/log/snipeit-install.log
  The installer has detected Ubuntu version 24.04 codename noble.

  Q. What is the FQDN of your server? (server): server.static.xvps.ne.jp ←(ここを入力する)
     Setting to server.static.xvps.ne.jp

次に、データベースやデータベースユーザーを自動で作るかを聞かれます。今回は、自動作成を選びます。ここから、自動インストールが始まります。

  Q. Do you want to automatically create the SnipeIT database user password? (y/n) y
* Updating installed packages./
* Installing Apache httpd, PHP, MariaDB and other requirements.
  * cron already installed
  * Installing mariadb-server
  * mariadb-client already installed
  * Installing apache2
  * Installing libapache2-mod-php
  * Installing php
  * Installing php-mcrypt
  * Installing php-curl
  * Installing php-mysql
  * Installing php-gd
  * Installing php-ldap
  * Installing php-zip
  * Installing php-mbstring
  * Installing php-xml
  * Installing php-bcmath
  * curl already installed
  * git already installed
  * Installing unzip
* Configuring Apache.
* Setting up hosts file.
* Starting MariaDB.
* Creating Snipe-IT user.
* Creating MariaDB Database/User.
* Cloning Snipe-IT from github to the web directory.
/
/var/www/html/snipeit ~/snipe-it
Already on 'master'
Your branch is up to date with 'origin/master'.
~/snipe-it
* Configuring .env file.
* Installing composer.
All settings correct for using Composer
Downloading...
Composer (version 2.7.9) successfully installed to: /home/snipeitapp/composer.phar
Use it: php composer.phar
* Setting permissions.
* Running composer.
* This can take 5 minutes or more. Tail /var/log/snipeit-install.log for more full command output.
* Generating the application key.
* Artisan Migrate.
* Creating scheduler cron.
* Restarting Apache httpd.
* Clearing cache and setting final permissions.
  Q. Do you want to configure mail server settings now? This can be done later too.
     * You will need mail server address, port, user and password among other items. (y/n) y
  Outgoing mailserver address:smtp.office365.com
  Server port number:587
  Username:tominari@evolinq.link
  Password:
  Verify TLS certificate on remote server? (true/false):true
  From address:soumu@evolinq.link
  From name:soumu
  Reply to address:soumu@evolinq.link
  Reply to name:soumu
  ***Open http://x162-43-88-190.static.xvps.ne.jp to login to Snipe-IT.***
* Installation log located in /var/log/snipeit-install.log.
* Finished! 

snipe-itの初期設定

インストールが成功していれば、以下の画面が出るはずです。今回は、メールの設定をしているのですが、テストが終わっていないため、「Send Test」があります。まずは、「Send Test」を押してテストをします。
image-1

テストが成功すれば、Email欄にもチェックが入ります。そうしたら、「Create Database Tables」ボタンを押します。
image-2-2

データベースの生成が終わると、snipe-itの利用者登録となります。「Create User」ボタンを押します。
image-3-3

システムのタイトル、通貨やシステム管理者の名前などを設定します。日本人なので、円、Last Name First Initialを設定します。一通り設定が終わったら、「Save User」を押します。
image-4-1
※この語、500エラーが出てしまうのでが、言語設定以外はインストールが出来ているように見えます。

HTTPSの設定

今回は、Let's Encryptを使いことにしました。
最初に、certbotをインストールします。

apt install certbot python3-certbot-apache

次に、certbotを実行します。3つほど質問がありますので、適宜答えてください。メールアドレス、規約に同意、お知らせメール届けていいか、の3つの質問です。

certbot --apache -d asset-management.evolinq.link

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
(Enter 'c' to cancel): soumu@evolinq.link ←(ここ入力)
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.4-April-3-2024.pdf. You must agree in
order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y ←(ここ入力)
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y  ←(ここ入力)

Account registered.
Requesting a certificate for asset-management.evolinq.link
 
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/asset-management.evolinq.link/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/asset-management.evolinq.link/privkey.pem
This certificate expires on 2024-12-08.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
 
Deploying certificate
Successfully deployed certificate for asset-management.evolinq.link to /etc/apache2/sites-available/snipeit-le-ssl.conf
Congratulations! You have successfully enabled HTTPS on https://asset-management.evolinq.link
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
* Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
* Donating to EFF:                    https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

毎月、1日 4時に、SSLの証明書を更新するよう設定します。cronの設定をします。

sudo crontab -e

エディタが開くので、以下の行を追加します。

0 4 1 * *  certbot renew --dry-run && systemctl reload apache2

なお、インストール時と違うFDQNでSSLを設定する場合、snipe-itの.envにある、APP_URLの更新する必要があります。

これにて、snipe-itのインストールは完了です。