Last active
November 5, 2019 12:03
-
-
Save bgunebakan/20cd06c38c384fa3e58cea05c9447848 to your computer and use it in GitHub Desktop.
ERPNext manual install on Debian 10 (fork from https://murgatroyd.za.net/?p=284)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#As Root User | |
apt upgrade -y | |
apt update -y | |
#Until recently, and based on many/most of the "standard" installation documents, | |
#I used the default username of "frappe" - but have been told that this is not advisable, | |
#since it is a targeted username for hacking attempts, so I have changed this to erp_base | |
#Whatever you choose, make sure you have a decent password! | |
adduser erp_base | |
usermod -aG sudo erp_base | |
apt install build-essential -y | |
apt install software-properties-common -y | |
apt install dirmngr -y | |
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8 | |
apt install curl -y | |
apt install mariadb-client mariadb-server -y | |
# | |
#1) Test the install: | |
mysql -u root | |
exit | |
#2) Also good idea to do the GRANT items here (BEFORE proceeding with other bits) | |
mysql_secure_installation | |
mysqladmin -uroot password 'MySQLPassWordOFchoice' | |
mysql -uroot -pMySQLPassWordOFchoice -Bse "GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.%.%' IDENTIFIED BY 'MySQLPassWordOFchoice' WITH GRANT OPTION;" | |
mysql -uroot -pMySQLPassWordOFchoice -Bse "GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.%.%.%' IDENTIFIED BY 'MySQLPassWordOFchoice' WITH GRANT OPTION;" | |
mysql -uroot -pMySQLPassWordOFchoice -Bse "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'MySQLPassWordOFchoice' WITH GRANT OPTION;" | |
# | |
apt install nginx -y | |
#1a- Test the install: open a browser and go to http://192.168.1.238 (or whichever IP you used). You should get a default NGINX install webpage | |
# | |
#####v7.x##### (now obsolete, but I guess some may prefer v7 for whatever reason | |
#curl -sL https://deb.nodesource.com/setup_7.x | sudo bash - | |
#####v8.x | |
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash - | |
#on previous attempt, pip install frappe failed on 64bit only | |
#turns out it's OS bits related. I used 32bit to mimic the .ova download file, but that doesn't seem to work here | |
#> chromedriver@2.34.1 install /home/erp_base/frappe-bench/node_modules/chromedriver | |
#> node install.js | |
#Only Linux 64 bits supported. | |
#npm ERR! Linux 4.9.0-5-686 | |
# | |
apt install yarn -y | |
apt install nodejs -y | |
#1- Test the install: | |
node -v && npm -v | |
#v8 v8.x.x && 5.x.x | |
# | |
apt install redis-server -y | |
#1- Test the install: redis-server -v | |
# | |
# to install wkhtmltox without xserver | |
apt-get install xvfb | |
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb | |
dpkg --install wkhtmltox_0.12.5-1.stretch_amd64.deb | |
#you need apt --fix-broken install to install font packages | |
# | |
apt install git-core -y | |
#(needed during installation of Bench, Frappe & ERPNext) | |
apt install python-pip -y | |
apt install python3-pip -y | |
# | |
apt install libmariadbclient-dev -y | |
apt install python-mysqldb -y | |
sudo apt install python-pdfkit -y | |
# | |
#1- (This resolves the issue of Python not connecting to MariaDB MySQL) | |
apt install libssl-dev -y | |
#pip install --upgrade setuptools | |
#pip install MySQL-python #--no-use-wheel | |
pip install mysqlclient | |
#1- (Wheel does not have a MySQL-python module yet, so it will error if the -no-use-wheel is not flagged) | |
#DEPRECATION: --no-use-wheel is deprecated and will be removed in the future. Please use --no-binary :all: instead. | |
#pip install --upgrade mysql-python | |
# | |
apt install supervisor -y | |
#2- (needed for production mode) | |
# | |
#Tune the DB (should be done before the frappe installs, otherwise it will warn you to make these changes before it proceeds. | |
#The values should be adjusted/scaled for YOUR situation/hardware. This example is based on 1GB of RAM | |
# | |
nano /etc/mysql/my.cnf #and add/tune these lines in the appropriate section | |
[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 | |
# Set buffer pool size to 50-80% of your computer's memory | |
innodb_buffer_pool_size=512M | |
# Set the log file size to about 25% of the buffer pool size | |
innodb_log_file_size=128M | |
innodb_log_buffer_size=64M | |
# the default here is 4MB, or maybe (16MB?? in more recent versions) | |
# which sometimes allows for disconnects in the middle of transactions | |
max_allowed_packet=64M | |
# | |
[mysql] | |
default-character-set = utf8mb4 | |
# You can improve performance by indexing. | |
# Also check innodb_buffer_pool_size, should be 50-60% of your memory | |
# https://discuss.erpnext.com/t/erpnext-running-slow/14302/5 | |
# https://discuss.erpnext.com/t/very-slow-and-very-bad-performance-v7/30040 | |
# | |
#REBOOT server | |
reboot | |
# | |
#Login as ##########ERP_BASE########## user | |
su erp_base; cd ~ | |
git clone https://github.com/frappe/bench bench-repo | |
sudo pip install -e bench-repo | |
# | |
#git clone https://github.com/frappe/bench bench-repo | |
#sudo npm install -g yarn #recently we seem to need this for most recent changes | |
#This is now installed higher up using "apt" | |
#sudo pip install -e bench-repo | |
#sudo pip install gevent eventlet #I add these in for gunicorn debugging | |
#bench init frappe-bench && cd frappe-bench | |
# | |
#I downgraded to pip to 9.0.3 and things worked for me. Command for downgrading pip is | |
#python -m pip install --user pip==9.0.3 | |
#subsequently I found that on occasion, there were yarn install errors if I use this version, | |
# so I now use v19.03 instead. If you want v19 use this instead | |
#python -m pip install --user pip==19.0.3 | |
# | |
# | |
############## REVISED: YARN install ############ | |
#I actually think it might just be best to install this globally | |
sudo npm install -g yarn | |
# | |
# | |
# Also found a post on the <a href="https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally" target="_blank" rel="noopener noreferrer">ERPNext forum</a> which has a nice fix for yarn errors..... | |
# | |
############## START: If you get YARN install errors ############ | |
# npm config set prefix '~/.npm' | |
# export PATH=~/.npm/bin:$PATH | |
# source ~/.profile | |
# #to test without sudo … | |
# #npm install -g jshint | |
# npm install -g yarn | |
# bench update --requirements | |
# bench setup socketio | |
# bench build | |
############## END: If you get YARN install errors ############ | |
# | |
bench init frappe-bench --frappe-branch version-12 && cd frappe-bench | |
#bench init frappe-bench --frappe-branch master #default seems to be "develop" | |
#https://discuss.erpnext.com/t/frappe-bench-installation-error-in-ubuntu-16-04/22562/10?u=yogendrasinh | |
### You are using pip version 9.0.3, however version 10.0.1 is available. | |
###### THIS APPARENTLY MAKES NO DIFFERENCE AND CAN BE IGNORED !!! | |
# | |
# | |
bench new-site site1.local | |
#create Administrator password & confirm it ######[admin]###### | |
bench start | |
#1) To Test Installation | |
#If there are issues in accessing the site @ http://192.168.1.xx:8000 do a bench reinstall | |
#REBOOT server | |
reboot | |
# | |
# | |
# | |
#Login as ERP_BASE User | |
cd frappe-bench | |
#################################################################### | |
#bench get-app erpnext https://github.com/frappe/erpnext | |
#################################################################### | |
bench get-app erpnext https://github.com/frappe/erpnext --branch version-12 | |
bench --site site1.local install-app erpnext | |
# 1- It failed with an error here - to do with missing doctype Data Import - BUT!!! | |
# I think that was in the develop branch, since this time it went through without any problems!!!!! | |
# 2- bench start starts anyway on the dev version! | |
# 3- allowed me to run the wizard successfully. now I will try the fix/clean/migrate/update etc | |
# System does pop up a message a few times saying "There were errors". I just reran it till this went away | |
#Possibly linked to the & in the name. Tried without it that - "Setup already complete" message appears. | |
#I don't think this is particularly relevant, since I plan to overwrite the DB - but may look into it | |
# test again | |
bench start | |
# | |
#Now set it to production mode | |
sudo bench setup production frappe | |
bench set-nginx-port site1.local 8238 | |
#nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y | |
bench setup nginx | |
sudo systemctl reload nginx | |
#Now it is running on 192.168.1.238:8238 | |
# | |
# | |
# | |
#https://frappe.io/docs/user/en/bench/resources/bench-commands-cheatsheet | |
# | |
#change password | |
#bench set-admin-password “your_desired_password_here” |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment