Installing Frappe Framework v15 in Ubuntu: Including Production Setup
Guide to Install Frappe v15 in Ubuntu 22.04 LTS
Guide to Install Frappe Framework version 15 in Ubuntu 22.04 LTS
Follow these steps to ensure a successful installation of Frappe Version 15 on your Ubuntu 22.04 LTS system.
1. Prepare System Dependencies:
Install essential software for managing repositories:
sudo apt install software-properties-common
2. Python Installation:
Add the deadsnakes PPA for Python:
sudo add-apt-repository ppa:deadsnakes/ppa -ysudo apt update
Install Python 3.11:
sudo apt install python3.11
Check if it is installed properly
python3.11 --version
Get the full Python 3.11 package:
sudo apt install python3.11-full
Install additional development tools:
sudo apt-get install python3-dev python3-setuptools python3-pip python3.11-venvsudo apt-get updatesudo apt-get install -y build-essential python3.11-dev gccsudo apt-get install -y libffi-dev libssl-dev
3. Database Setup (MariaDB):
Install MariaDB server:
sudo apt install mariadb-server
Secure your MariaDB installation:
sudo mysql_secure_installation
Install necessary MySQL database development files:
sudo apt-get install libmysqlclient-dev
Configure MariaDB settings:
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
use this in the 50-server.cnf file
[server]user = mysqlpid-file = /run/mysqld/mysqld.pidsocket = /run/mysqld/mysqld.sockbasedir = /usrdatadir = /var/lib/mysqltmpdir = /tmplc-messages-dir = /usr/share/mysqlbind-address = 127.0.0.1query_cache_size = 16Mlog_error = /var/log/mysql/error.log[mysqld]innodb-file-format=barracudainnodb-file-per-table=1innodb-large-prefix=1character-set-client-handshake = FALSEcharacter-set-server = utf8mb4collation-server = utf8mb4_unicode_ci[mysql]default-character-set = utf8mb4
Restart MariaDB:
sudo service mysql restart
4. Redis Installation:
Install Redis server:
sudo apt-get install redis-server
5. Node.js and Yarn Setup:
Install Node Version Manager (nvm):
sudo apt install curlcurl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bashsource ~/.profile
Install Node.js 18.X
nvm install 18
Install Yarn:
sudo apt-get install npmsudo npm install -g yarn
6. wkhtmltopdf installation
Install wkhtmltopdf dependencies:
sudo apt-get install xvfb libfontconfig wkhtmltopdf
[Optional]: Setting Up Production Environment
To isolate the Frappe setup in a dedicated user environment:
[Optional]:Create a New User:
sudo adduser frappe-usersudo usermod -aG sudo frappe-usersu - frappe-user
You'll switch to the newly created user "frappe-user" to perform the following steps.
7. Frappe Installation:
Install Frappe Bench using pip3:
sudo -H pip3 install frappe-bench
Check the installed Bench version:
bench --version
8. Initialize Frappe Bench and Install Frappe Version 15:
Initialize the Frappe Bench with Python 3.11:
bench init frappe-bench --frappe-branch version-15 --python python3.11
After completing the installation, navigate to the frappe-bench directory and create sites and apps..
[Optional]Setup Production:
Configure Frappe Bench for production use:
sudo bench setup production frappe-userbench restart
Open a web browser and navigate to the server's IP address to access the production instance.
Fix for supervisor
bench setup socketiobench setup supervisorbench setup redissudo supervisorctl reloadbench restart
Fix for css
sudo chmod -R o+rx /home/frappe-user
Jinso Raj
Fellow at t4glabs
Followed instructions and it is not working. Using Oracle cloud Ubuntu server.
frappe-user@erpnext:~/frappe-bench$ sudo bench setup production frappe-user bench restart [sudo] password for frappe-user: Setting Up prerequisites... $ bench setup role fail2ban ansible-playbook [core 2.17.1] config file = None configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python3.10/dist-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /usr/local/bin/ansible-playbook python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3) jinja version = 3.1.4 libyaml = True No config file found; using defaults setting up inventory plugins Loading collection ansible.builtin from hostlist declined parsing /etc/ansible/hosts as it did not pass its verifyfile() method Skipping due to inventory source not existing or not being readable by the current user script declined parsing /etc/ansible/hosts as it did not pass its verifyfile() method auto declined parsing /etc/ansible/hosts as it did not pass its verifyfile() method Skipping due to inventory source not existing or not being readable by the current user yaml declined parsing /etc/ansible/hosts as it did not pass its verifyfile() method Skipping due to inventory source not existing or not being readable by the current user ini declined parsing /etc/ansible/hosts as it did not pass its verifyfile() method Skipping due to inventory source not existing or not being readable by the current user toml declined parsing /etc/ansible/hosts as it did not pass its verifyfile() method ERROR! [DEPRECATED]: ansible.builtin.include has been removed. Use includetasks or import_tasks instead. This feature was removed from ansible-core in a release after 2023-05-16. Please update your playbooks.
The error appears to be in '/usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/mariadb/tasks/main.yml': line 2, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/usr/local/bin/bench", line 8, in <module> sys.exit(cli()) File "/usr/local/lib/python3.10/dist-packages/bench/cli.py", line 132, in cli benchcommand() File "/usr/local/lib/python3.10/dist-packages/bench/commands/setup.py", line 110, in setupproduction setupproduction(user=user, yes=yes) File "/usr/local/lib/python3.10/dist-packages/bench/config/productionsetup.py", line 37, in setupproduction setupproductionprerequisites() File "/usr/local/lib/python3.10/dist-packages/bench/config/productionsetup.py", line 28, in setupproductionprerequisites execcmd("bench setup role fail2ban") File "/usr/local/lib/python3.10/dist-packages/bench/utils/init.py", line 178, in execcmd raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd) bench.exceptions.CommandFailedError: bench setup role fail2ban
$ sudo supervisorctl restart frappe: frappe: ERROR (no such group) frappe: ERROR (no such group) ERROR: sudo supervisorctl restart frappe: subprocess.CalledProcessError: Command 'sudo supervisorctl restart frappe:' returned non-zero exit status 2.
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/usr/local/bin/bench", line 8, in <module> sys.exit(cli()) File "/usr/local/lib/python3.10/dist-packages/bench/cli.py", line 132, in cli benchcommand() File "/usr/local/lib/python3.10/dist-packages/bench/commands/utils.py", line 41, in restart Bench(".").reload(web, supervisor, systemd) File "/usr/local/lib/python3.10/dist-packages/bench/utils/render.py", line 126, in wrapperfn return fn(args, *kwargs) File "/usr/local/lib/python3.10/dist-packages/bench/bench.py", line 152, in reload restartsupervisorprocesses(benchpath=self.name, webworkers=web, raise=raise) File "/usr/local/lib/python3.10/dist-packages/bench/utils/bench.py", line 342, in restartsupervisorprocesses failure = bench.run(f"{sudo}supervisorctl restart {group}", raise=raise) File "/usr/local/lib/python3.10/dist-packages/bench/bench.py", line 48, in run return execcmd(cmd, cwd=cwd or self.cwd, _raise=raise) File "/usr/local/lib/python3.10/dist-packages/bench/utils/init.py", line 178, in execcmd raise CommandFailedError(cmd) from subprocess.CalledProcessError(returncode, cmd) bench.exceptions.CommandFailedError: sudo supervisorctl restart frappe: