GNU/Linux >> Linux の 問題 >  >> Ubuntu

Ubuntu20.04にInvoiceNinjaをインストールする方法

Invoice Ninjaは、フリーランサーや企業向けの無料のオープンソースオンライン請求アプリで、支払いの受け取り、費用の追跡、提案の作成、タイムタスクを支援します。これは、Freshbooksなどの商用請求書アプリケーションと非常によく似た自己ホスト型の請求書アプリケーションです。独自のカスタム請求書を作成して、1秒以内にオンラインで送信できます。

Invoice Ninjaは、中小企業に非常に役立ちます。安全で使いやすい請求書発行ソフトウェアをお探しの場合は、請求書忍者が最適です。

このチュートリアルでは、Apacheを使用してInvoiceNinjaをインストールする方法とUbuntu20.04サーバーにSSLを暗号化する方法を示します。

前提条件
  • Ubuntu20.04を実行しているサーバー。
  • サーバーIPで指定された有効なドメイン名。
  • ルートパスワードがサーバーに設定されます。
はじめに

まず、システムパッケージを最新バージョンに更新することをお勧めします。次のコマンドを実行して、すべてのパッケージを更新します。

apt-get update -y

すべてのパッケージが更新されたら、次のコマンドを使用して他の必要な依存関係をインストールします。

apt-get install software-properties-common apt-transport-https ca-certificates gnupg2 -y

すべての依存関係がインストールされたら、次のステップに進むことができます。

LAMPサーバーをインストールする

次に、Apache、MariaDB、およびPHPをシステムにインストールする必要があります。まず、次のコマンドを使用してApacheおよびMariaDBパッケージをインストールします。

apt-get install apache2 mariadb-server -y

両方のパッケージをインストールした後、PHPバージョン7.2およびその他の拡張機能をシステムにインストールする必要があります。

デフォルトでは、Ubuntu20.04にはPHPバージョン7.4が付属しています。そのため、Ondrejリポジトリをシステムに追加する必要があります。

次のコマンドを使用して、PHPOndrejリポジトリを追加できます。

add-apt-repository ppa:ondrej/php

リポジトリが追加されたら、次のコマンドを使用してPHPおよびその他の拡張機能をインストールします。

apt-get install php7.2 libapache2-mod-php7.2 php-imagick php7.2-fpm php7.2-mysql php7.2-common php7.2-gd php7.2-json php7.2-curl php7.2-zip php7.2-xml php7.2-mbstring php7.2-bz2 php7.2-intl php7.2-gmp unzip -y

すべてのパッケージをインストールした後、次のコマンドを使用して、インストールされているPHPのバージョンを確認します。

php -v

次の出力が表示されます。

PHP 7.2.34-8+ubuntu20.04.1+deb.sury.org+1 (cli) (built: Oct 31 2020 16:57:33) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.34-8+ubuntu20.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

MariaDBデータベースを構成する

次に、InvoiceNinjaのデータベースとユーザーを作成する必要があります。まず、次のコマンドを使用してMariaDBコンソールにログインします。

mysql

ログインしたら、次のコマンドを使用してデータベースとユーザーを作成します。

MariaDB [(none)]> create database invoicedb;
MariaDB [(none)]> create user [email protected] identified by 'password';

次に、次のコマンドを使用して、invoicedbにすべての権限を付与します。

MariaDB [(none)]> grant all privileges on invoicedb.* to [email protected];

次に、特権をフラッシュし、次のコマンドを使用してMariaDBコンソールを終了します。

MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;

完了したら、次のステップに進むことができます。

請求書忍者をインストール

まず、公式Webサイトから最新バージョンのInvoiceNinjaをダウンロードします。

wget -O invoice-ninja.zip https://download.invoiceninja.com/

ダウンロードが完了したら、次のコマンドを使用して、ダウンロードしたファイルをApacheルートディレクトリに解凍します。

unzip invoice-ninja.zip -d /var/www/html/
を解凍します

次に、次のコマンドを使用して適切な権限と所有権を設定します。

chown -R www-data:www-data /var/www/html/ninja
chmod -R 755 /var/www/html/ninja

終了したら、次のステップに進むことができます。

請求書忍者用にApacheを構成する

次に、InvoiceNinja用のApache仮想ホスト構成ファイルを作成する必要があります。次のコマンドで作成できます:

nano /etc/apache2/sites-available/ninja.conf

次の行を追加します:

<VirtualHost *:80>
    ServerName invoice.example.com
    DocumentRoot /var/www/html/ninja/public
    <Directory /var/www/html/ninja/public>
       DirectoryIndex index.php
       Options +FollowSymLinks
       AllowOverride All
       Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/invoice-ninja.error.log
    CustomLog ${APACHE_LOG_DIR}/invoice-ninja.access.log combined

    Include /etc/apache2/conf-available/php7.2-fpm.conf
</VirtualHost>

ファイルを保存して閉じてから、次のコマンドで仮想ホストファイルを有効にします。

a2ensite ninja.conf

次に、次のコマンドを使用して、必要なapacheモジュールを有効にします。

a2enmod mpm_event proxy_fcgi setenvif
a2enmod rewrite

最後に、Apacheサービスを再起動して、変更を適用します。

systemctl restart apache2

これで、次のコマンドを使用してApacheのステータスを確認できます。

systemctl status apache2

次の出力が得られるはずです:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2020-12-27 07:15:15 UTC; 11s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 25097 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 25113 (apache2)
      Tasks: 55 (limit: 2353)
     Memory: 5.3M
     CGroup: /system.slice/apache2.service
             ??25113 /usr/sbin/apache2 -k start
             ??25114 /usr/sbin/apache2 -k start
             ??25115 /usr/sbin/apache2 -k start

Dec 27 07:15:15 ubuntu systemd[1]: Starting The Apache HTTP Server..

この時点で、ApacheはInvoiceNinjaを提供するように構成されています。これで、次のステップに進むことができます。

請求書忍者にアクセス

次に、Webブラウザーを開き、URL http://invoice.example.comを使用して請求書忍者にアクセスします。 。次のページにリダイレクトされます:

ウェブサイトのURL、データベースの詳細、管理者のユーザー名、パスワードを入力し、送信をクリックします ボタン。 Invoice Ninjaのログイン画面にリダイレクトされます:

管理者のユーザー名とパスワードを入力し、ログインをクリックします ボタン。次の画面に請求書忍者ダッシュボードが表示されます。

SSLを暗号化して安全な請求書忍者

Let'sEncryptSSLを使用してWebサイトを保護することは常に良い考えです。 SSLをインストールして管理するには、Certbotクライアントをインストールする必要があります。次のコマンドでインストールできます:

apt-get install python3-certbot-apache -y

Certbotをインストールしたら、次のコマンドを実行して、Let'sEncryptSSLでWebサイトを保護します。

certbot --apache -d invoice.example.com

以下に示すように、メールアドレスを提供し、利用規約に同意するよう求められます。

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing 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
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for invoice.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/invoice-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/invoice-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/invoice-le-ssl.conf

次に、以下に示すように、HTTPトラフィックをHTTPSにリダイレクトするかどうかを選択します。

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

2と入力し、Enterキーを押して、WebサイトにLet'sEncryptSSLをインストールします。

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/invoice.conf to ssl vhost in /etc/apache2/sites-available/invoice-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://invoice.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=invoice.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/invoice.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/invoice.example.com/privkey.pem
   Your cert will expire on 2020-10-23. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - 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

これで、URLhttps://invoice.example.comを使用してWebサイトに安全にアクセスできます。

結論

おめでとう!これで、Ubuntu20.04サーバーにLet'sEncryptSSLを使用してInvoiceNinjaが正常にインストールおよび構成されました。これで、Invoice Ninjaでその他の機能を調べて、実稼働環境にデプロイできます。ご不明な点がございましたら、お気軽にお問い合わせください。


Ubuntu
  1. Ubuntu18.04にLogstashをインストールする方法

  2. Ubuntu18.04にInvoiceNinjaをインストールする方法

  3. Ubuntu20.04にXWikiをインストールする方法

  1. Ubuntu20.04にphpBBをインストールする方法

  2. Debian9にInvoiceNinjaをインストールする方法

  3. Ubuntu20.04にMongoDBをインストールする方法

  1. Ubuntu16.04にInvoiceNinjaをインストールする方法

  2. Ubuntu20.04にSyncthingをインストールする方法

  3. Ubuntu18.04にRをインストールする方法