ERPインストール · 6 min read · Oct 14, 2025

Ubuntu 20.04 LTSにERPNextをインストールする方法

ERPNextは、Python、JavaScript、およびFrappe Frameworkで構築された無料のオープンソースERPソフトウェアです。製造業者、流通業者、サービス業者によって使用される、現代的で使いやすい無料のビジネスシステムです。これは、中小企業向けに設計されており、企業がビジネス運営のすべての側面を管理するのに役立ちます。これは、世界中の何千もの企業がERPプロセスを管理するために使用している最高のオープンソースERP管理ソフトウェアの1つです。

このチュートリアルでは、Ubuntu 20.04サーバーにERPNextをインストールする方法を説明します。

前提条件

  • Ubuntu 20.04を実行しているサーバー。
  • サーバーにポイントされた有効なドメイン。
  • サーバーに設定されたrootパスワード。

始めに

始める前に、システムに必要なPython依存関係をインストールする必要があります。次のコマンドでそれらをすべてインストールできます:

apt-get install python3-dev libffi-dev git python3-pip python3-testresources libssl-dev wkhtmltopdf gcc g++ make -y

Python依存関係をインストールした後、ERPNextはフロントエンドにNode.jsも使用します。次のコマンドでNode.jsリポジトリを追加します:

curl -sL https://deb.nodesource.com/setup_12.x | bash -

次に、次のコマンドでNode.jsとRedisサーバーをインストールします:

apt-get install nodejs redis-server -y

両方のパッケージがインストールされたら、次のコマンドを実行してYarnパッケージをインストールします:

npm install -g yarn

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

MariaDBデータベースのインストールと構成

デフォルトでは、MariaDBはUbuntu 20.04のデフォルトリポジトリにあります。次のコマンドでインストールできます:

apt-get install mariadb-server -y

インストールが完了したら、次のコマンドでMariaDBを保護し、MariaDBのrootパスワードを設定します:

mysql_secure_installation

次のように表示される質問にすべて回答して、MariaDBのrootパスワードを設定し、インストールを保護します:

Enter current password for root (enter for none):
Set root password? [Y/n] Y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

MariaDBが保護されたら、次のコマンドでMariaDBコンソールにログインします:

mysql -u root -p

次に、次のコマンドでMariaDBの認証プラグインを変更します:

MariaDB [(none)]>USE mysql;  
MariaDB [(none)]>UPDATE user SET plugin='mysql_native_password' WHERE User='root';

次に、特権をフラッシュし、次のコマンドでMariaDBシェルから退出します:

MariaDB [(none)]> FLUSH PRIVILEGES;  
MariaDB [(none)]> EXIT;

次に、MariaDBのInnodbファイルフォーマットをBarracudaに変更する必要があります。次のファイルを編集することで行えます:/etc/mysql/mariadb.conf.d/50-server.cnf

nano /etc/mysql/mariadb.conf.d/50-server.cnf

次の行を追加/変更します:

[mysqld]
innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

[mysql]
default-character-set = utf8mb4

ファイルを保存して閉じたら、次のコマンドでMariaDBサービスを再起動して変更を適用します:

systemctl restart mariadb

ERPNextのインストール

このセクションでは、ERPNextユーザーを作成し、benchツールをインストールし、システムにERPNextをインストールする方法を示します。

ERPNextユーザーの作成

まず、次のコマンドを使用してERPNextを実行するための新しいユーザーを作成します:

useradd -m -s /bin/bash erpnext

次に、次のコマンドでERPNextのパスワードを設定します:

passwd erpnext

次に、次のコマンドでERPNextユーザーをsudoグループに追加します:

usermod -aG sudo erpnext

次に、ERPNextユーザーにログインし、次のコマンドで環境変数を設定します:

su - erpnext  
nano ~/.bashrc

次の行を追加します:

PATH=$PATH:~/.local/bin/

ファイルを保存したら、次のコマンドで環境変数を有効にします:

source ~/.bashrc

Benchツールのインストール

まず、ERPNextユーザーにディレクトリを切り替え、次のコマンドでERPNext用のディレクトリを作成します:

su - erpnext  
sudo mkdir /opt/bench

次に、所有権をerpnextユーザーに設定します:

sudo chown -R erpnext:erpnext /opt/bench

次に、/opt/benchにディレクトリを変更し、Git Hubからbenchリポジトリをクローンします:

cd /opt/bench  
git clone https://github.com/frappe/bench bench-repo

次に、pip3コマンドを使用してbenchリポジトリをインストールします:

pip3 install -e bench-repo

インストールが完了したら、次のコマンドを使用してfrappeフレームワークを使用してbenchディレクトリを初期化します:

bench init erpnext

次の出力が表示されるはずです:

? Built js/checkout.min.js
? Built js/dialog.min.js
? Built js/social.min.js
? Built js/web_form.min.js
? Built js/list.min.js
? Built js/chat.js
Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade caniuse-lite browserslist`
? Built css/frappe-rtl.css
? Built css/printview.css
? Built js/bootstrap-4-web.min.js
? Built js/barcode_scanner.min.js
? Built css/list.min.css
? Built css/report.min.css
? Built frappe/css/email.css
? Built js/frappe-recorder.min.js
? Built js/desk.min.js
? Built css/frappe-chat-web.css
? Built js/frappe-web.min.js
? Built css/form.min.css
? Built css/web_form.css
? Built css/desk.min.css
? Built css/frappe-web-b4.css
? Built js/control.min.js
? Built js/form.min.js
? Built js/data_import_tools.min.js
? Built js/report.min.js
?  Done in 111.35s
Done in 113.33s.
SUCCESS: Bench erpnext initialized

ERPNextサイトの作成

次に、ディレクトリをerpnextに変更し、次のコマンドで新しいERPNextサイトを作成します:

cd /opt/bench/erpnext  
bench new-site erp.linuxbuz.com

MariaDBのrootパスワードと管理者パスワードを提供するように求められます。次のように表示されます:

MySQL root password: 

Installing frappe...
Updating DocTypes for frappe        : [========================================] 100%
Updating country info               : [========================================] 100%
Set Administrator password: 
Re-enter Administrator password: 
* Scheduler is disabled *
Current Site set to erp.linuxbuz.com

この時点で、ERPNextはシステムにインストールされています。

本番環境用にERPNextを構成する

次に、ERPNextプロセスを管理するためにSupervisorをインストールし、Nginxをリバースプロキシとしてインストールする必要があります。

まず、ユーザーをERPNextに変更し、次のコマンドでSupervisorとNginxをインストールします:

su - erpnext  
sudo apt-get install supervisor nginx -y

次に、次のコマンドでfrappe-benchをインストールします:

sudo pip3 install frappe-bench

次に、/opt/bench/erpnextにディレクトリを変更し、次のコマンドで本番環境用にERPNextを設定します:

cd /opt/bench/erpnext  
sudo /home/erpnext/.local/bin/bench setup production erpnext

ERPNextが構成されると、次の出力が表示されるはずです:

PLAY RECAP ************************************************************************************************************************************
localhost                  : ok=8    changed=4    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0   

$ sudo systemctl restart supervisor
Port configuration list:

Site erp.linuxbuz.com assigned port: 80
$ /usr/bin/supervisorctl reread
No config updates to processes
$ /usr/bin/supervisorctl update
$ sudo /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ sudo systemctl reload nginx

この時点で、ERPNextは本番環境用にNginxと構成されています。

ERPNext Web UIにアクセスする

今、ウェブブラウザを開き、URL http://erp.linuxbuz.com を入力します。ERPNextのログインページにリダイレクトされます:

ユーザー名をAdministrator、以前に設定したパスワードを入力し、ログインボタンをクリックします。次のページが表示されるはずです:

希望する言語を選択し、次へボタンをクリックします。次のページが表示されるはずです:

国、タイムゾーン、通貨を選択し、次へボタンをクリックします。次のページが表示されるはずです:

名前、メールアドレス、パスワードを入力し、セットアップを完了ボタンをクリックします。次のページにERPNextダッシュボードが表示されるはずです:

Let’s Encrypt SSLでERPNextを保護する

まず、Let’s Encrypt SSLをインストールおよび管理するためにCertbotクライアントをインストールする必要があります。次のコマンドでインストールできます:

sudo apt-get install certbot python3-certbot-nginx -y

インストールが完了したら、次のコマンドを実行して、ドメイン用にLet’s Encrypt SSLをインストールおよび構成します:

sudo certbot --nginx -d erp.linuxbuz.com

次のように、メールアドレスを提供し、サービス利用規約に同意するように求められます:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
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
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for erp.linuxbuz.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/conf.d/erpnext.conf

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

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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を押してプロセスを完了します。次の出力が表示されるはずです:

Redirecting all traffic on port 80 to ssl in /etc/nginx/conf.d/erpnext.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://erp.linuxbuz.com

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/erp.linuxbuz.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/erp.linuxbuz.com/privkey.pem
   Your cert will expire on 2020-08-29. 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"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - 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

 - We were unable to subscribe you the EFF mailing list because your
   e-mail address appears to be invalid. You can try again later by
   visiting https://act.eff.org.

この時点で、あなたのERPNextウェブサイトはLet’s Encrypt SSLで保護されています。HTTPSプロトコルで安全にウェブサイトにアクセスできるようになりました。

結論

このガイドでは、Ubuntu 20.04でNginxを使用してERPNextをインストールする方法を学びました。また、Let’s Encrypt SSLでERPNextを保護する方法も学びました。詳細については、ERPNextのドキュメントページを訪れてください。

Share: X/Twitter LinkedIn

新しい投稿を受信箱で受け取る

スパムはありません。いつでも購読を解除できます。