Skip to content

Instantly share code, notes, and snippets.

@jazzyjackson
Last active September 18, 2019 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jazzyjackson/b131083919d5ad75d8250540729e275b to your computer and use it in GitHub Desktop.
Save jazzyjackson/b131083919d5ad75d8250540729e275b to your computer and use it in GitHub Desktop.

https://www.tecmint.com/install-mariadb-in-centos-7/ https://www.vultr.com/docs/how-to-install-erpnext-open-source-erp-on-centos-7 http://ask.xmodulo.com/install-python3-centos.html

issues https://discuss.erpnext.com/t/easy-install-fails-at-task-bench-python3-bench-init-for-develop/34975/9 frappe/bench#796

So it's 2019 and you want ERPNext

Modern software is a chaotic system. Every installation script makes assumptions about what dependencies will exist and changes are not handled well. Long story short, installation scripts written 6 months ago may not work today.  These code snippets will walk you through how I had to adapt a tutorial on setting up ERPNext in production while installation script failed for 5 different reasons (Python3 vs Python, ENOMEM, mariadb5 doesn't allow usernames over 16 characters)

Creating a new sudoer

First thing is the main tutorial almost starts form scratch, but it assumes I have a sudo user besides root. So here's what to run to create your principal user account.

adduser yournamehere
usermod -aG wheel yournamehere
passwd yournamehere

passwd will prompt you to type in a password that will allow this account to run commands as sudo. For security purposes, your keyboard input is not displayed on the screen, you just have to trust you got it right.

Installing MariaDB 10.3

The tutorial went pretty smoothly from here, but I eventually discovered that ERPnext requires MariaDB 10, not MariaDB 5 installed without specifying version, so before running yum install MariaDB-server we must create a file directing yum where to get the files: In a file called /etc/yum.repos.d/MariaDB.repo paste:

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1


Source

Now you can run the following without issue (for now!)

sudo yum groupinstall -y "Development tools"
sudo yum install -y redhat-lsb-core git python-setuptools python-devel openssl-devel libffi-devel
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
sudo pip install --upgrade pip setuptools
sudo pip install ansible
sudo yum -y install mariadb mariadb-server mysql-devel
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
sudo mysql_secure_installation

This last command will ask you for the root password, but this is first time running it so there is none, hit enter. Now it will ask you to enter a strong password for root access to the database. Create one. Then a few more questions to turn off anonymous access and insecure test databases.

Installing NodeJS, Nodejs and Redis

This worked well from the tutorial, I added the last line because Frappe installation scripts expect yarn to exist.

sudo curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
sudo yum -y install nginx nodejs redis
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl start redis
sudo systemctl enable redis
sudo npm install -g yarn

Installing Python3

cd ~
sudo yum install yum-utils
sudo yum-builddep python 
curl -O https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
tar xf Python-3.5.0.tgz
cd Python-3.5.0
./configure
make
sudo make install

Source

Installing Bench

Create a user for bench

sudo adduser yournamehere -d /opt/bench
sudo passwd yournamehere
sudo usermod -aG wheel yournamehere
sudo su - yournamehere
cd ~ # make sure your home dir is /opt/bench 
git clone https://github.com/frappe/bench bench-repo
sudo pip install -e bench-repo

Install ERPNext

Don't forget to change erp.example.com to your actual domain (oh and get your domain pointing to the server before continuing)

bench init erpnext && cd erpnext
bench new-site erp.example.com
bench get-app erpnext https://github.com/frappe/erpnext
bench --site erp.example.com install-app erpnext
sudo yum -y install supervisor
sudo systemctl start supervisord
sudo systemctl enable supervisord
sudo bench setup production YOURBENCHUSERNAMEFROMBEFORE
@jazzyjackson
Copy link
Author

For key collation_server. Expected value utf8mb4_unicode_ci, found value latin1_swedish_ci
For key character_set_server. Expected value utf8mb4, found value latin1

@jazzyjackson
Copy link
Author

should be

collation-server=utf8mb4_unicode_ci
character-set_server=utf8mb4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment