aboutsummaryrefslogtreecommitdiffstats
path: root/src/site-docs/adoc/fragments/install-guide/install.adoc
blob: 57d78739e744e79953f2eb5cba0a2ab7b2674334 (plain)
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
//
// ============LICENSE_START=======================================================
//  Copyright (C) 2016-2018 Ericsson. All rights reserved.
// ================================================================================
// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
// 
// SPDX-License-Identifier: CC-BY-4.0
// ============LICENSE_END=========================================================
//
// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
//

== Install APEX
APEX can be installed in different ways:

- Unix: automatically using `rpm` or `dpkg` from `.rpm` or `.deb` archive
- Windows, Unix, Cygwin: manually from a `.tar.gz` archive
- Windows, Unix, Cygwin: build from source using Maven, then install manually


=== Install with RPM and DPKG
The install distributions of APEX automatically install the system.
The installation directory is `/opt/app/policy/apex-pdp`.
Log files are located in `/var/log/onap/policy/apex-pdp`.
The latest APEX version will be available as `/opt/app/policy/apex-pdp/apex-pdp`.

For the installation, a new user `apexuser` and a new group `apexuser` will be created.
This user owns the installation directories and the log file location.
The user is also used by the standard APEX start scripts to run APEX with this user's permissions.

[width="100%",options="header",cols="a"]
|====================
| RPM Installation
|
[source%nowrap,sh,numbered,subs="attributes+"]
----
# sudo rpm -i apex-pdp-package-full-{release-version}.rpm
********************preinst*******************
arguments 1
**********************************************
creating group apexuser . . .
creating user apexuser . . .
********************postinst****************
arguments 1
***********************************************
----
|====================


[width="100%",options="header",cols="a"]
|====================
| DPKG Installation
|
[source%nowrap,sh,numbered,subs="attributes+"]
----
# sudo dpkg -i apex-pdp-package-full-{release-version}.deb
Selecting previously unselected package apex-uservice.
(Reading database ... 288458 files and directories currently installed.)
Preparing to unpack apex-pdp-package-full-{release-version}.deb ...
********************preinst*******************
arguments install
**********************************************
creating group apexuser . . .
creating user apexuser . . .
Unpacking apex-uservice ({release-version}) ...
Setting up apex-uservice ({release-version}) ...
********************postinst****************
arguments configure 
***********************************************
----
|====================

Once the installation is finished, APEX is fully installed and ready to run.


=== Install Manually from Archive (Unix, Cygwin)
Download a `tar.gz` archive.
Create a directory where APEX should be installed.
Extract the `tar` archive.
The following example shows how to install APEX in `/opt/apex` and create a link to `/opt/apex/apex` for the most recent installation.

[source%nowrap,sh,numbered,subs="attributes+"]
----
# cd /opt
# mkdir apex
# cd apex
# mkdir apex-full-{release-version}
# tar xvfz ~/Downloads/apex-pdp-package-full-{release-version}.tar.gz -C apex-full-{release-version}
# ln -s apex apex-pdp-package-full-{release-version}
----


=== Install Manually from Archive (Windows, 7Zip, GUI)
Download a `tar.gz` archive and copy the file into the install folder (in this example `C:\apex`).
Assuming you are using 7Zip, right click on the file and extract the `tar` archive.
Note: the screenshots might show an older version than you have.

image::install-guide/win-extract-tar-gz.png[Extract the TAR archive]

The right-click on the new created TAR file and extract the actual APEX distribution.

image::install-guide/win-extract-tar.png[Extract the APEX distribution]

Inside the new APEX folder you see the main directories: `bin`, `etc`, `examples`, `lib`, and `war`

Once extracted, please rename the created folder to `apex-full-{release-version}`.
This will keep the directory name in line with the rest of this documentation.


=== Install Manually from Archive (Windows, 7Zip, CMD)
Download a `tar.gz` archive and copy the file into the install folder (in this example `C:\apex`).
Start `cmd`, for instance typing `Windows+R` and then `cmd` in the dialog.
Assuming `7Zip` is installed in the standard folder, simply run the following commands (for APEX version {release-version} full distribution)

[source%nowrap,bat,numbered,subs="attributes+"]
----
>c:
>cd \apex
>"\Program Files\7-Zip\7z.exe" x apex-pdp-package-full-{release-version}.tar.gz -so | "\Program Files\7-Zip\7z.exe" x -aoa -si -ttar -o"apex-full-{release-version}"
----

APEX is now installed in the folder `C:\apex\apex-full-{release-version}`.



== Build from Source

=== Build and Install Manually (Unix, Windows, Cygwin)
Clone the APEX GIT repositories into a directory.
Go to that directory.
Use Maven to build APEX (all details on building APEX from source can be found in __APEX HowTo: Build__).
Install from the created artifacts (`rpm`, `deb`, `tar.gz`, or copying manually).

[IMPORTANT]
.Building RPM distributions
====
RPM images are only build if the `rpm` package is installed (Unix).
To install `rpm` run `sudo apt-get install rpm`, then build APEX.
====

The following example shows how to build the APEX system, without tests (`-DskipTests`) to safe some time.
It assumes that the APX GIT repositories are cloned to:

- Unix, Cygwin: `/usr/local/src/apex`
- Windows: `C:\dev\apex`


[width="100%",options="header",cols="5a,5a"]
|====================
| Unix, Cygwin | Windows
|
[source%nowrap,sh,numbered]
----
# cd /usr/local/src/apex
# mvn clean install -DskipTests
----
|
[source%nowrap,bat,numbered]
----
>c:
>cd \dev\apex
>mvn clean install -DskipTests
----
|====================

The build takes about 2 minutes without test and about 4-5 minutes with tests on a standard development laptop.
It should run through without errors, but with a lot of messages from the build process.
If build with tests (i.e. without `-DskipTests`), there will be error messages and stack trace prints from some tests.
This is normal, as long as the build finishes successful.

When Maven is finished with the build, the final screen should look similar to this (omitting some `success` lines):

[source%nowrap,sh,numbered,subs="attributes+"]
----
include::{adsite-main-dir}/site-docs/adoc/fragments/screens/mvn-install-skiptests.txt[mvn build, no tests]
----


The build will have created all artifacts required for an APEX installation.
The following example show how to change to the target directory and how it should look like.

[width="100%",options="header",cols="a"]
|====================
| Unix, Cygwin
|
[source%nowrap,sh,numbered]
----
# cd packages/apex-pdp-package-full/target
# ls -l
----

|
[source%nowrap,sh,numbered,subs="attributes+"]
----
include::{adsite-main-dir}/site-docs/adoc/fragments/screens/target-ls-unix.txt[successful build, ls, unix]
----


|====================


[width="100%",options="header",cols="a"]
|====================
| Windows
|
[source%nowrap,bat,numbered]
----
>cd packages\apex-pdp-package-full\target
>dir
----

|
[source%nowrap,sh,numbered,subs="attributes+"]
----
include::{adsite-main-dir}/site-docs/adoc/fragments/screens/target-ls-win.txt[successful build, ls, windows]
----


|====================

Now, take the `.deb` or the `.tar.gz` file and install APEX.
Alternatively, copy the content of the folder `install_hierarchy` to your APEX directory.