-
Notifications
You must be signed in to change notification settings - Fork 0
/
Installation.txt
398 lines (300 loc) · 12.9 KB
/
Installation.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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
*** LifeLog Requirements ***
- Web Server (any will do that supports CGI perl execution)
- SQLite
- Perl Modules (Run the provided ./install_modules.sh)
- git (git clone https://github.com/wbudic/LifeLog)
-- Note - Perl and some modules might take time to install
as they are fetched and tested for your computer.
- Provided sudo ./install.sh will do most stuff for you explained in this old doc.
### Obtain from GIT repository latest stable release with:
##
git clone https://github.com/wbudic/LifeLog.git
##
###
# Optional install cpanm to make installing other modules easier.
# You need to type these commands into a Terminal emulator (Mac OS X, Win32, Linux)
sudo apt install cpanminus
# Install SQLite
sudo cpan DBD::SQLite;
# or download latest from: https://www.sqlite.org/download.html
# Optional but recommended install a ProgresSQL database server and driver see: Installation_ProgresSQL.txt
##
# To compile install from source latest Perl Language Interpreter, to local home.
# Note I do not recommended now to compile build install
# for the whole system, if it comes with perl. Systems can come and go.
# Your $HOME directory is important.
#
# Example:
$ mkdir ~/dev; cd ~/dev
$ wget https://www.cpan.org/src/5.0/perl-5.34.0.tar.gz
$ sudo tar -xzf perl-5.34.0.tar.gz
$ cd perl-5.34.0
$ ./Configure -Dusethreads -des -Dprefix=~$HOME/localperl
$ sudo make
$ sudo make test
$ sudo make install
# Once it is installed in $HOME/localperl you can run:
$ rm -rf ~/dev/perl-5.34.0
# Modify vim ~/.bashrc to have:
PATH="/home/will/localperl/bin${PATH:+:${PATH}}"; export PATH;
# We use sudo to cpan install stuff for the whole system.
# This is currently located at:
export PERL5LIB=/usr/local/share/perl/5.30.0/
./Configure -des \
-Duse64bitall \
-Dcccdlflags='-fPIC' \
-Dcccdlflags='-fPIC' \
-Dccdlflags='-rdynamic' \
-Dlocincpth=' ' \
-Duselargefiles \
-Dusethreads \
-Duseshrplib \
-Dd_semctl_semun \
-Dusenm \
-Dprefix=~$HOME/localperl
## Development Environment Perl Install
# Developer? Install VSCode, not from flatpack. Use Microsoft site -> https://code.visualstudio.com/
Requirements: G++ and gcc compilers, and Gcc-4.8 GNU Compiler
# Install Perl, properly, don't use the distro provided perl interpreter (might be outdated or has missing modules).
This best is explained? If running under sudo and cgi based scripts, you will be using the system wide or provided installation of perl.
If logged in shell as normal user issue, 'perl -v', you might be getting a different user updated version of it.
To troubleshoot, you can compare, issue, '/usr/bin/perl -v', best is if both return same, version.
Solution already provided for this is to use /usr/bin/local/perl executable which should be the latest if installing the latest perl.
Notice - Most web server configuration files, require cgi settings to point to right perl executable.
If still experiencing problems, running provided ./install_modules.sh was probably not issued, and could solve requirements.
##
sudo apt install perlbrew
##
#https://learn.perl.org/installing/unix_linux.html
curl -L http://xrl.us/installperlnix | bash
# Perl compiled based on your hardware infrastructure now, is Very Good.
#Developer? Switch to it, and cpan modules:
# Perlbrew allowes you to switch to newer (securer) patched versions of perl.
# Example bellow builds from a $HOME/dev/perl-5.30.1.tar.gz source code archive
# a descent perl installation for development on your machine.
perlbrew install ~/dev/perl-5.30.1.tar.gz --thread --multi --64int --64all --no-patchperl --debug
#switch to it in a terminal.
perlbrew use 5.30.1
sudo apt install libperl-critic-perl
#libperl-dev is required for the lang server
sudo apt install libperl-dev
sudo apt-get install zlib1g-dev
sudo cpan Perl::LanguageServer
NOTICE -> Above Perl installation and modules can take time as they build (get compiled) and are tested
using your computers configuration and hardware for optimal performance.
The Perl::LanguageServer, can fail in tests, as it is development specific, this can be ignored.
# Install OpenSSL (Optional, used by backup routines)
https://www.openssl.org/
Avoid: sudo apt install openssl
Install preferably by building. Older versions have not all options.
i.e.:
curl -c https://www.openssl.org/source/openssl-1.1.1l.tar.gz | tar -xz
cd openssl-1.1.1l;
export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
./configure linux-x86_64 --prefix=/usr/local --openssldir=/usr/local
make
make test
sudo make install
cd ..
rm -rf openssl-1.1.1l
# LifeLog Required Perl modules.
# Since 2.4 To get to work with latest installed perl version, (not the roots/system wide one).
perl -v
#v5.30.0 or grater is preferred.
# Following is a way to install modules if not having sudo access.
perl -MCPAN -e 'install DBI'
perl -MCPAN -e 'install CGI'
perl -MCPAN -e 'install CGI::Session'
perl -MCPAN -e 'install DBD::Pg'
perl -MCPAN -e 'install Syntax::Keyword::Try'
perl -MCPAN -e 'install DateTime::Format::SQLite'
perl -MCPAN -e 'install Capture::Tiny'
perl -MCPAN -e 'install Text::CSV';
perl -MCPAN -e 'install Regexp::Common'
perl -MCPAN -e 'install Gzip::Faster'
perl -MCPAN -e 'install CGI:Session'
perl -MCPAN -e 'install Crypt::CBC'
perl -MCPAN -e 'install Crypt::Blowfish'
# Following is instruction is for system wide perl installation.
# In most cases the following will work fine if having sudo access, and no intension to upgrade perl.
# On some systems, is you have the PERL5LIB env. variable set, installed modules might not be found.
# Without setting this env. var. explicitly, normal location of these should be the /usr/local/share/perl/5.3* directory, available to all users.
# Without sudo running "cpan" you might have to set this PERL5LIB={path} in .bashrc to include your users home directory.
#
###
# since 1.8 switched to:
# before was -> sudo cpanm Try::Tiny;
sudo cpan Exception::Class
sudo cpan Log::Log4per
sudo cpan Syntax::Keyword::Try
sudo cpan DateTime;
sudo cpan DateTime::Format::Human::Duration
sudo cpan DateTime::Format::SQLite;
sudo cpan Text::CSV;
sudo cpan Number::Bytes::Human;
sudo cpan Gzip::Faster;
sudo cpan Number/Bytes/Human.pm;
sudo cpan Regexp::Common;
sudo cpan JSON;
sudo cpan Switch;
sudo cpan IPC::Run;
sudo cpan Syntax::Keyword::Try;
sudo cpan Text::Markdown
sudo cpan Crypt::Blowfish;
sudo cpan Compress::Zlib;
sudo cpan IO::Compress::Gzip;
sudo cpan IO::Prompter;
sudo cpan IO::Interactive;
sudo cpan -T DBD::Pg;
sudo cpan CGI CGI::Session;
#Install next after installing desired ciphers, we use Blowfish only.
sudo cpan Crypt::CBC;
#Install DBI module
sudo cpan DBI;
sudo cpan DBD::SQLite;
#For PostgreSQL see Installation_PostgreSQL.txt before installing perl driver:
#cpan DBD::Pg;
#Final Perl Installation Notes
This perl setup might take time and efforts. But, it is worth it.
You get it build and tested professionally, based on your hardware.
Platforms supported, Windows, Unix (all), Mac.
Installing perl as an developer, requires no sudo.
But hence can't run server (system level) like.
If developer and running perlbrew, recommended is to use
cpan to install required modules.
#Upgrade Instructions
To upgrade to newer version of this software requires data migration.
Before installing newer version scripts, perform an data export.
cd /home/{user}/thttpd_dev/dbLifeLog
sqlite3 -csv data_log.db "select * from LOG;" > current_log.csv
## You should run module install, after every upgrade/update just in case something is missing:
#
#
./install_modules.sh
#
## Note, install modules doesn't require any restarts or reboots, this is perl baby.
## However, allow some time as it also tests these, to make sure all is running fine.
##Install LifeLog Independently
cd /home/{user}/
git clone https://github.com/wbudic/LifeLog
mkdir /home/{user}/thttpd_dev/dbLifeLog
chmod +x /home/{user}/thttpd_dev/cgi-bin/*.cgi
Copy from /home/{user}/LifeLog/htdocs/cgi-bin to /home/{user}/thttpd_dev/htdocs/cgi-bin
if doing development. Copy also the /home/{user}/LifeLog/.git to /home/{user}/thttpd_dev/
Access the webserver cgi-bin. http://localhost:8080/cgi-bin/main.cgi
(this might redirect to login.cgi or config.cgi in the future)
##Install LifeLog Dependably (not automatic, manual developer way)
cd /home/{user}/
git clone https://github.com/wbudic/LifeLog
run thttpd with:
cd LifeLog; ./startDevWebServer.sh
##Import CSV Exported File
This requires all CGI working. As it will create a brand new database for you.
Once created you must import the from above example current_log.csv
cd /home/{user}/thttpd_dev/dbLifeLog
see: http://www.sqlitetutorial.net/sqlite-import-csv/
Example (data_dev1_2_log.db would be created as the latest version by the CGI created):
cd /home/{user}/thttpd_dev/dbLifeLog
sqlite3 data_dev1_2_log.db
sqlite> .mode csv
sqlite> .import current_log.csv LOG;
sqlite> select * FROM LOG;
sqlite>.quit
Note exporting/importing of other tables is similar, but not recommended.
#Current Latest Development Branch
git fetch && git checkout dev.1.3
#Install thttpd_dev as an Linux System Service
Not recommended, but the thttpd development environment for LifeLog
can be installed to start on reboot.
sudo cp startDevWebServer.sh /etc/init.d/
Modify the following to the path of your development environment
where thttpd.conf file is in /etc/init.d/startDevWebServer.sh
Modify line -> cd /home/will/thttpd_dev
vim /etc/init.d/startDevWebServer.sh
Install as service with:
sudo update-rc.d startDevWebServer.sh defaults
#Developer Notes
* For vscode. Before installing perl, and perl::LanguageServer extension.
*$ sudo cpan -r Perl::LanguageServer
* This will recompile and test the language server with the system default installation of perl you have.
* With out the -r option, you might have experimental features compatibilities issues.
##Automate GIT Push
vim your ./LifeLog/.git/conf file to include:
[remote "origin"]
url = https://{user}:{password}github.com/wbudic/LifeLog.git
...
Where {user} and {password} are your git login credentials.
Don't worry, these credentials are not uploaded. And someone must have
access to your computers login to specifically hack to obtain them.
##Troubleshoot Data Problems
To reset factory defaults, for categories and configuration.
You might need to delete data in some tables.
Issue either the bellow statements externally.
sqlite3 data_{alias}_log.db "delete from CAT;"
sqlite3 data_{alias}_log.db "delete from CONFIG;"
Subsequent versions of LifeLog software might require this operation.
You can export and modify your added categories via an CSV file.
Making sure the ID first column across all entries has a unique number.
#Install AUTO_LOGIN
On a personal network or small network, you might prefer to auto login when browsing to the LifeLog,
instead of entering every time user name and password. It makes sense, as you are the only one using it,
don't need that extra security.
Other scenario is that the LifeLog in an Office Environment is accessed by multiple people.,
using same alias and password. Don't need to have any extra security as the alias and password is known.
Modify, in dbLifeLog/main.cnf
Look for <<AUTO_LOGIN<>
And change have your general login credential's. i.e.:
<<AUTO_LOGIN<admin/password_123>
Then login one last time, and enable AUTO_LOGIN at the configuration page.
## Install tiny thttpd web server ##
Note - This is still recommended, if not willing to configure or have to run
a heavier more complex web server configuration.
The recommendation is to skip this webserver and install LightHTTPD,
which is more modern and maintained.
https://acme.com/software/thttpd/
wget https://acme.com/software/thttpd/thttpd-2.29.tar.gz
tar -xvzf thttpd-2.29.tar.gz
cd thttpd-2.29/
sudo groupadd www
./configure
sudo mkdir /usr/local/man/man1
sudo make
sudo make install
#rm thttpd-2.29.tar.gz
#rm -rf thttpd-2.29
Create an mkdir ~/thttpd_dev directory.
Run server using this config file, where {user} is your home login location.
# This section overrides defaults
dir=/home/{user}/thttpd_dev/htdocs
user={user}
logfile=/home/{user}/thttpd_dev/log/thttpd.log
pidfile=/home/{user}/thttpd_dev/run/thttpd.pid
# This section _documents_ defaults in effect
port=8080
# nosymlink# default = !chroot
# novhost
# nocgipat
# nothrottles
host=0.0.0.0
charset=utf-8
cgipat=**.cgi
After modifying the thttpd.conf
you'll have to modify the startDevWebServer.sh to reflect your setup before running the script.
The full URL to the LifeLog is the following link (if not working try without cgi-bin, and proceed with further installation):
#
#
http://localhost:8080/cgi-bin/
#
#
## Network Troubleshooting ##
With some server software/hardware the following setting, might help if experiencing an lag.
### Modify sysctl.conf:
sudo vim /etc/sysctl.conf
So it lists later:
sudo sysctl -p
net.ipv4.tcp_no_metrics_save = 1
net.core.netdev_max_backlog = 5000
net.ipv4.tcp_rmem = 10240 87380 12582912
net.core.wmem_max = 12582912
net.core.rmem_max = 12582912
net.ipv4.tcp_window_scaling = 1