-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathERPNextOnUbuntu1604.txt
274 lines (184 loc) · 7.08 KB
/
ERPNextOnUbuntu1604.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
Last updated: 6 July 2017
Linux: Ubuntu 16.04
Install Pre-requisites
Python 2.7
MariaDB 10+ I will use MySQL instead.
Nginx (for production)
Nodejs
Redis
cron (crontab is required)
wkhtmltopdf with patched Qt (for pdf generation)
sudo apt-get -y update && sudo apt-get -y upgrade
sudo apt-get -y install git
sudo apt-get -y install curl
sudo apt-get -y install vim
# Install python 2.7
sudo apt-get -y install python-minimal
sudo apt-get -y install python-pip
sudo apt-get -y install libmysqlclient-dev
#################################################################
# Install MySQL
sudo apt-get -y install mysql-server
sudo mysql_secure_installation
#################################################################
# Install MariaDB 10+
sudo apt-get -y install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://ftp.osuosl.org/pub/mariadb/repo/10.1/ubuntu xenial main'
sudo apt-get update
sudo apt-get -y install mariadb-server mariadb-client
sudo apt-get install libmysqlclient-dev
#### Not #### sudo apt-get install python2.7-mysqldb
#install Nginx
sudo apt-get -y install nginx
sudo ufw allow 'Nginx Full'
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx
sudo certbot certonly --webroot --webroot-path=/var/www/html -d www.example.com
sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
# REF
https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04
#install NVM
sudo apt-get -y install build-essential libssl-dev
#Goto Github check nvm install latest version
https://github.com/creationix/nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
or
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
#logout and login again to run new bash profile
source .profile
nvm ls-remote
#look for latest stable npm version
nvm install 6.11.0
################################ Example install in normal user account ############################
[NON ROOT USER AS WELL]
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
source ~/.profile
nvm install 6.11.0
################################ END Example ############################
#install Redis server
sudo apt-get install build-essential tcl
#Ref: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04
#Ref: https://www.digitalocean.com/community/tutorials/how-to-secure-your-redis-installation-on-ubuntu-14-04
cd /tmp
curl -O http://download.redis.io/redis-stable.tar.gz
tar xzf redis-stable.tar.gz
cd redis-stable
make
make test
sudo make install
###
###Configure Redis
###
sudo mkdir /etc/redis
sudo cp /tmp/redis-stable/redis.conf /etc/redis
sudo vim /etc/redis/redis.conf
# look for supervised
# change it
supervised systemd
# look for dir
# change it
dir /var/lib/redis
sudo vim /etc/systemd/system/redis.service
######################## redis.service #######################
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
[Install]
WantedBy=multi-user.target
#################################################
sudo adduser --system --group --no-create-home redis
sudo mkdir /var/lib/redis
sudo chown redis:redis /var/lib/redis
sudo chmod 770 /var/lib/redis
sudo systemctl start redis
sudo systemctl status redis
sudo systemctl enable redis
###########################################
echo "digital-ocean" | sha256sum
Redis Key: 960c3dac4fa81b4204779fd16ad7c954f95942876b9c4fb1a255667a9dbe389d
##### Install wkhtmltopdf ############
#sudo apt-get install xvfb libfontconfig wkhtmltopdf
# ubuntu 16.04 name is Xenial
sudo apt-get install libxrender1 fontconfig xvfb
# install Chinese fonts
sudo apt-get install fonts-wqy-microhei ttf-wqy-microhei fonts-wqy-zenhei ttf-wqy-zenhei
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz -P /tmp/
cd /opt/
sudo tar xf /tmp/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
sudo ln -s /opt/wkhtmltox/bin/wkhtmltopdf /usr/bin/wkhtmltopdf
######################################
# install Bench [ NON ROOT USER ]
git clone https://github.com/frappe/bench bench-repo
sudo pip install -e bench-repo
bench init frappe-bench && cd frappe-bench
bench new-site www.demo.com
bench get-app erpnext https://github.com/frappe/erpnext
bench --site www.demo.com install-app erpnext
bench start
############# if you are using MySQL, you should use add following config ###############
[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
sql-mode=""
[mysql]
default-character-set = utf8mb4
##########################################################################################
sudo service mysql restart
############## If you are using SMTP from Mandrill, modify following config in /sites/site_name.com/site_config.json #############
{
"": "",
"db_name": "24bf68e341ce0fbd",
"db_password": "3u9sKWQGZbPznbje",
"limits": {
"space_usage": {
"backup_size": 1.0,
"database_size": 10.05,
"files_size": 2.0,
"total": 13.05
}
},
"mail_login": "mandrill username",
"mail_password": "lasdjflj23oijrl23jr",
"mail_port": 587,
"mail_server": "smtp.mandrillapp.com",
"use_ssl": 1,
"auto_email_id":"test@example.com"
}
###########################################################
############### If you ready to Production ################
## Ref: https://frappe.github.io/frappe/user/en/bench/guides/setup-production.html
sudo apt-get install supervisor
sudo service supervisor restart
bench setup supervisor
sudo ln -s `pwd`/config/supervisor.conf /etc/supervisor/conf.d/frappe-bench.conf
sudo bench setup sudoers $(whoami)
bench setup nginx
sudo ln -s `pwd`/config/nginx.conf /etc/nginx/conf.d/frappe-bench.conf
##
Note: When you restart nginx after the configuration change, it might fail if you have another configuration with server block as default for port 80 (in most cases for the nginx welcome page). You will have to disable this config. Most probable places for it to exist are /etc/nginx/conf.d/default.conf and /etc/nginx/conf.d/default.
##
#
################ Build Multiple ERP Sites base on hostname #########################
#https://github.com/frappe/bench/wiki/Multitenant-Setup
bench config dns_multitenant on
bench new-site site2name
bench setup nginx
sudo service nginx reload
############### Remove Site #######################
# Frist, Change default site
bench use sitename2
bench drop-site [sitename]
you need the root mysql password in order to remove it. There is a backup being kept in /home/frappe/frappe-bench/archived_sites/[sitename]
Without having tried it I assume that you (once having decided never to need that site ever again) just can remove/delete that archive folder