Projekt

Allgemein

Profil

Setup erpnext14 » Historie » Version 4

Jeremias Keihsler, 17.10.2023 11:50

1 1 Jeremias Keihsler
h1. Setup erpnext14
2
3
<pre><code class="shell">
4 2 David Ayers
# install Ubuntu Server
5
# German
6
# German no dead keys
7
# Ubuntu Server
8
# enp1s0:
9
# <static net>/<net>
10
# <static IP>
11
# <static gateway>
12
# <dns IP 1>,<dns IP 2>,<dns IP 3>
13
# -with LVM full disk
14
# <hostname>
15
# frappe <SecretPassword>
16
# Install openssh server
17
# Retrieve SSH key from Launchpad
18
# Do not allow password
19
20
sudo apt update
21
sudo apt full-upgrade
22
# unattended-upgrades.service
23
24 1 Jeremias Keihsler
sudoedit /etc/hosts
25 2 David Ayers
# add line
26
# <static IP>   <hostname.domain>
27
28
sudo apt install etckeeper
29
sudo git config --global --edit
30
# name = root
31
# email = <hostname.domain>
32
33
# my personal prefrences
34 1 Jeremias Keihsler
sudo apt install emacs-nox
35
export EDITOR=emacs
36 2 David Ayers
37
sudoedit /etc/inputrc
38
# "\e[5~": history-search-backward
39
# "\e[6~": history-search-forward
40
41
# setup core services
42
sudo apt install locate aptitude apticron fail2ban rkhunter chkrootkit
43
logwatch atop nmap arp-scan arping
44
# Postfix als Satellitensystem einrichten
45
# <hostname>.<domain>
46
# <smtp-relay>.<domain>
47
48 1 Jeremias Keihsler
sudoedit /etc/aliases
49 2 David Ayers
#root:         noc@domain
50
#alert:        alert@domain
51
sudo newaliases
52
53
sudoedit /etc/postfix/generic
54
#root@<hostname>.<domain>         noc@domain
55
#frappe@<hostname>.<domain>       noc@domain
56
57 1 Jeremias Keihsler
sudoedit /etc/postfix/main.cf
58 2 David Ayers
# smtp_generic_maps = hash:/etc/postfix/generic
59
60 1 Jeremias Keihsler
sudo postmap /etc/postfix/generic
61 2 David Ayers
62
63 1 Jeremias Keihsler
sudo apt install backup-manager
64 2 David Ayers
# /var/archives
65
# /etc /home/frappe /usr/local /var/backups
66
67
sudoedit /etc/ssh/sshd_config
68
#PermitRootLogin prohibit-password
69
70
71 1 Jeremias Keihsler
sudoedit /etc/rkhunter.conf
72 2 David Ayers
# MAIL-ON-WARNING=alert
73
# ALLOW_SSH_ROOT_USER=prohibit-password
74
# SCRIPTWHITELIST=/usr/bin/lwp-request
75
# ALLOWHIDDENDIR=/etc/.git
76
# ALLOWHIDDENFILE=/etc/.gitignore
77
# ALLOWHIDDENFILE=/etc/.etckeeper
78 1 Jeremias Keihsler
sudo rkhunter --propupd
79
sudo rkhunter --check --sk
80 2 David Ayers
81
82 1 Jeremias Keihsler
83
# ERPnext
84 3 David Ayers
# based on https://discuss.erpnext.com/t/erpnext-14-installation-development-productions-ubuntu-server-22-04/92922
85
86 1 Jeremias Keihsler
sudo ufw allow 22,25,143,80,443,3306,3022,8000/tcp
87
sudo ufw enable
88 2 David Ayers
89
sudo apt install python3-minimal build-essential python3-setuptools
90
sudo apt install python3-dev python3.10-dev python3-setuptools python3-
91
pip python3-distutils redis-server
92 1 Jeremias Keihsler
sudo apt install python3.10-venv
93 2 David Ayers
sudo apt update
94
95 1 Jeremias Keihsler
sudo apt install xvfb libfontconfig wkhtmltopdf
96 2 David Ayers
97
sudo passwd root
98
99
sudo apt install mariadb-server mariadb-client
100
sudo mysql_secure_installation
101
# pwd
102
# Switch to unix_socket authentication: Y
103
# Change the root password? [Y/n] y
104
# password: pwd
105
# Remove anonymous users? [Y/n] y
106
# Disallow root login remotely? [Y/n] y
107
# Remove test database and access to it? [Y/n] y
108
109
# Reload privilege tables now? [Y/n] y
110
111
mysql -u root -p
112
ALTER USER root@localhost IDENTIFIED VIA mysql_native_password;
113
SET PASSWORD = PASSWORD(‘pwd’);
114
FLUSH PRIVILEGES;
115
quit
116
rm .mysql_history
117
118 3 David Ayers
sudoedit /etc/mysql/mariadb.conf.d/90-erpnext.cnf
119 2 David Ayers
#[mysqld]
120
#character-set-client-handshake = FALSE
121
#character-set-server = utf8mb4
122
#collation-server = utf8mb4_unicode_ci
123
124 1 Jeremias Keihsler
#[mysql]
125 2 David Ayers
#default-character-set = utf8mb4
126
127 3 David Ayers
128 2 David Ayers
sudo reboot
129
130 3 David Ayers
# NODE JS & NPM
131 2 David Ayers
wget https://deb.nodesource.com/setup_16.x
132
less setup_16.x
133
# Wow... add someones key to be trusted by system apt to install nodejs :-/ not cool but lets just get done.
134
chmod +x setup_16.x
135
sudo -E setup_16.x
136
sudo apt install nodejs
137
138
cd
139
tee -a ~/.bashrc<<EOF
140
PATH=$PATH:~/.local/bin/
141 1 Jeremias Keihsler
EOF
142 2 David Ayers
source ~/.bashrc
143
144 3 David Ayers
# BENCH DIRECTORY
145 2 David Ayers
sudo mkdir /home/bench
146
sudo chown -R frappe /home/bench
147 1 Jeremias Keihsler
cd /home/bench
148 2 David Ayers
sudo npm install -g yarn
149 1 Jeremias Keihsler
150 3 David Ayers
# FRAPPE
151 1 Jeremias Keihsler
pip3 install frappe-bench
152 3 David Ayers
bench init frappe --verbose --frappe-branch v14.4.3 #https://github.com/frappe/frappe/tags
153 1 Jeremias Keihsler
cd frappe
154 3 David Ayers
bench start
155 1 Jeremias Keihsler
156 3 David Ayers
# SITE CREATION
157
cd /home/bench/frappe
158
bench new-site <hostname>.<domain>
159
bench use <hostname>.<domain>
160
bench migrate
161 4 Jeremias Keihsler
</code></pre>
162 2 David Ayers
163 4 Jeremias Keihsler
h3. backup and load into test-site
164 2 David Ayers
165 4 Jeremias Keihsler
also have a look at: https://www.it-management-kirchberger.at/manuals-tutorials/server-centos-7/erpnext/todo.html
166 1 Jeremias Keihsler
167 4 Jeremias Keihsler
To create a staging site from a production site backup:
168
169
<pre><code class="shell">
170
cd <frappe/erpnext Verzeichnis>
171
mkdir ~/backup/
172
173
bench --site prod.example.net set-maintenance-mode on
174
bench --site prod.example.net set-config pause_scheduler 1
175
bench --site prod.example.net backup --with-files --compress --backup-path ~/backup/ 
176
# notice: Database Public & Private from stdout
177
bench --site prod.example.net set-maintenance-mode off
178
179
restore into other Staging instance:
180
181
bench new-site staging.example.net
182
bench --site staging.example.net set-maintenance-mode on
183
184
bench --site staging.example.net restore ~/backup/YYYYMMDD_HHMMSS-prod.example.net-database.sql.gz
185
  --with-public-files  ~/backup/YYYYMMDD_HHMMSS-prod.example.net-files.tar.gz
186
  --with-private-files ~/backup/YYYYMMDD_HHMMSS-prod.example.net-private-files.tar.gz
187
  MySQL root password:
188
189
bench --site staging.example.net mute_emails true
190
bench --site staging.example.net set-maintenance-mode off
191
rm -r ~/backup/
192 1 Jeremias Keihsler
</code></pre>