ERPNextインストール · 6 min read · Sep 22, 2025

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

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

このチュートリアルでは、Ubuntu 22.04サーバーにERPNextソフトウェアをインストールする方法を示します。

前提条件

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

始めに

最初に、システムにいくつかのPython依存関係をインストールする必要があります。次のコマンドでそれらすべてをインストールできます:

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

すべてのPython依存関係がインストールされたら、サーバーにNode.jsをインストールする必要があります。

最初に、次のコマンドでNode.jsリポジトリを追加します:

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

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

apt-get install nodejs redis-server -y

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

npm install -g yarn

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

MariaDBデータベースのインストールと設定

デフォルトでは、MariaDBはUbuntu 22.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の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

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

systemctl restart mariadb

Ubuntu 22.04に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

次に、次のコマンドでERPNext用のディレクトリを作成します:

sudo mkdir /opt/bench

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

sudo chown -R erpnext:erpnext /opt/bench

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

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

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

pip3 install -e bench-repo

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

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サイトを作成します:

cd /opt/bench/erpnext  
bench new-site erp.example.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.example.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.example.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.example.comを入力します。ERPNextのログインページにリダイレクトされます:

ERPNext Login

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

Select language

希望の言語、国、タイムゾーン、通貨を選択し、Nextボタンをクリックします。以下のページが表示されるはずです:

Create a user

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

ERPNext Dashboard

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.example.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.example.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.example.com

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/erp.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/erp.example.com/privkey.pem
   Your cert will expire on 2022-09-11. 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 22.04にNginxとLet’s Encrypt SSLでERPNextを正常にインストールしました。質問があればお気軽にお尋ねください。詳細についてはERPNextのドキュメントページをご覧ください。

Share: X/Twitter LinkedIn

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

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