GNU/Linux >> Belajar Linux >  >> Ubuntu

Cara Menginstal Invoice Ninja di Ubuntu 20.04

Invoice Ninja adalah aplikasi faktur online gratis dan sumber terbuka untuk pekerja lepas &bisnis yang membantu Anda menerima pembayaran, melacak pengeluaran, membuat proposal, dan tugas waktu. Ini adalah aplikasi faktur yang dihosting sendiri yang sangat mirip dengan aplikasi faktur komersial seperti Freshbooks. Ini memungkinkan Anda membuat faktur khusus sendiri dan mengirimkannya secara online dalam hitungan detik.

Ninja Faktur sangat berguna untuk bisnis kecil atau menengah. Jika Anda mencari perangkat lunak faktur yang aman dan mudah digunakan, Ninja Faktur adalah pilihan terbaik untuk Anda.

Dalam tutorial ini, kami akan menunjukkan cara menginstal Invoice Ninja dengan Apache dan Let's Encrypt SSL di server Ubuntu 20.04.

Prasyarat

  • Server yang menjalankan Ubuntu 20.04.
  • Nama domain valid yang ditunjukkan dengan IP server Anda.
  • Sandi root dikonfigurasi untuk server.

Memulai

Pertama, disarankan untuk memperbarui paket sistem Anda ke versi terbaru. Jalankan perintah berikut untuk memperbarui semua paket:

apt-get update -y

Setelah semua paket diperbarui, instal dependensi lain yang diperlukan dengan perintah berikut:

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

Setelah semua dependensi terinstal, Anda dapat melanjutkan ke langkah berikutnya.

Instal Server LAMP

Selanjutnya, Anda perlu menginstal Apache, MariaDB, dan PHP ke sistem Anda. Pertama, instal paket Apache dan MariaDB dengan perintah berikut:

apt-get install apache2 mariadb-server -y

Setelah menginstal kedua paket, Anda perlu menginstal PHP versi 7.2 dan ekstensi lainnya di sistem Anda.

Secara default, Ubuntu 20.04 dikirimkan dengan PHP versi 7.4. Jadi, Anda perlu menambahkan repositori Ondrej ke sistem Anda.

Anda dapat menambahkan repositori PHP Ondrej dengan perintah berikut:

add-apt-repository ppa:ondrej/php

Setelah repositori ditambahkan, instal PHP dan ekstensi lainnya dengan perintah berikut:

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

Setelah menginstal semua paket, verifikasi versi PHP yang diinstal dengan perintah berikut:

php -v

Anda akan melihat output berikut:

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

Konfigurasi Database MariaDB

Selanjutnya, Anda perlu membuat database dan pengguna untuk Invoice Ninja. Pertama, masuk ke konsol MariaDB dengan perintah berikut:

mysql

Setelah login, buat database dan user dengan perintah berikut:

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

Selanjutnya, berikan semua hak istimewa ke invoicedb dengan perintah berikut:

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

Selanjutnya, flush hak istimewa dan keluar dari konsol MariaDB dengan perintah berikut:

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

Setelah selesai, Anda dapat melanjutkan ke langkah berikutnya.

Instal Invoice Ninja

Pertama, unduh versi terbaru dari Invoice Ninja dari situs resminya:

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

Setelah unduhan selesai, unzip file yang diunduh ke direktori root Apache menggunakan perintah berikut:

unzip invoice-ninja.zip -d /var/www/html/

Selanjutnya, atur izin dan kepemilikan yang tepat dengan perintah berikut:

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

Setelah selesai, Anda dapat melanjutkan ke langkah berikutnya.

Konfigurasi Apache untuk Ninja Faktur

Selanjutnya, Anda perlu membuat file konfigurasi virtual host apache untuk Invoice Ninja. Anda dapat membuatnya dengan perintah berikut:

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

Tambahkan baris berikut:

<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>

Simpan dan tutup file kemudian aktifkan file virtual host dengan perintah berikut:

a2ensite ninja.conf

Selanjutnya, aktifkan modul apache yang diperlukan menggunakan perintah berikut:

a2enmod mpm_event proxy_fcgi setenvif
a2enmod rewrite

Terakhir, restart layanan Apache untuk menerapkan perubahan:

systemctl restart apache2

Anda sekarang dapat memverifikasi status Apache menggunakan perintah berikut:

systemctl status apache2

Anda akan mendapatkan output berikut:

? 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..

Pada titik ini, Apache dikonfigurasi untuk melayani Invoice Ninja. Sekarang Anda dapat melanjutkan ke langkah berikutnya.

Akses Ninja Faktur

Sekarang, buka browser web Anda dan akses Ninja Faktur menggunakan URL http://invoice.example.com . Anda akan diarahkan ke halaman berikut:

Berikan URL situs web Anda, detail basis data, nama pengguna admin, kata sandi, dan klik Kirim tombol. Anda akan diarahkan ke layar login Invoice Ninja:

Berikan nama pengguna, kata sandi admin Anda, dan klik LOGIN tombol. Anda akan melihat dasbor Invoice Ninja di layar berikut:

Amankan Ninja Faktur dengan Let's Encrypt SSL

Itu selalu merupakan ide yang baik untuk mengamankan situs web Anda dengan Let's Encrypt SSL. Anda perlu menginstal klien Certbot untuk menginstal dan mengelola SSL. Anda dapat menginstalnya dengan perintah berikut:

apt-get install python3-certbot-apache -y

Setelah Certbot terinstal, jalankan perintah berikut untuk mengamankan situs web Anda dengan Let's Encrypt SSL:

certbot --apache -d invoice.example.com

Anda akan diminta untuk memberikan email Anda dan menerima persyaratan layanan seperti yang ditunjukkan di bawah ini:

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

Selanjutnya, pilih apakah akan mengarahkan lalu lintas HTTP ke HTTPS seperti yang ditunjukkan di bawah ini:

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

Ketik 2 dan tekan Enter untuk menginstal Let's Encrypt SSL untuk situs web Anda:

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

Sekarang, Anda dapat mengakses situs web Anda dengan aman menggunakan URL https://invoice.example.com.

Kesimpulan

Selamat! Anda telah berhasil menginstal dan mengkonfigurasi Invoice Ninja dengan Let's Encrypt SSL di server Ubuntu 20.04. Anda sekarang dapat menjelajahi Ninja Faktur untuk lebih banyak fitur dan menerapkannya di lingkungan produksi. Jangan ragu untuk bertanya kepada saya jika Anda memiliki pertanyaan.


Ubuntu
  1. Cara Menginstal XWiki di Ubuntu 20.04

  2. Cara Memasang Invoice Ninja di Debian 9

  3. Cara Menginstal MongoDB di Ubuntu 20.04

  1. Cara Menginstal Logstash di Ubuntu 18.04

  2. Cara Menginstal Invoice Ninja di Ubuntu 18.04

  3. Cara Menginstal R di Ubuntu 18.04

  1. Cara Menginstal Invoice Ninja di Ubuntu 16.04

  2. Cara Menginstal Syncthing di Ubuntu 20.04

  3. Cara Menginstal phpBB di Ubuntu 20.04