@@ -13,27 +13,7 @@ export class GuideLinuxAgentComponent implements OnInit {
13
13
@Input ( ) serverId : number ;
14
14
@Input ( ) version : string ;
15
15
token : string ;
16
-
17
- architectures = [
18
- {
19
- id : 1 , name : 'Ubuntu 16/18/20+' ,
20
- install : this . getCommandUbuntu ( 'utmstack-linux-agent' ) ,
21
- uninstall : this . getUninstallCommand ( 'utmstack-linux-agent' ) ,
22
- shell : ''
23
- } ,
24
- {
25
- id : 2 , name : 'Centos 7/Red Hat Enterprise Linux' ,
26
- install : this . getCommandCentos7RedHat ( 'utmstack-linux-agent' ) ,
27
- uninstall : this . getUninstallCommand ( 'utmstack-linux-agent' ) ,
28
- shell : ''
29
- } ,
30
- {
31
- id : 3 , name : 'Centos 8/AlmaLinux' ,
32
- install : this . getCommandCentos8Almalinux ( 'utmstack-linux-agent' ) ,
33
- uninstall : this . getUninstallCommand ( 'utmstack-linux-agent' ) ,
34
- shell : ''
35
- }
36
- ] ;
16
+ architectures = [ ] ;
37
17
38
18
constructor ( private federationConnectionService : FederationConnectionService ) { }
39
19
@@ -49,51 +29,72 @@ export class GuideLinuxAgentComponent implements OnInit {
49
29
} else {
50
30
this . token = '' ;
51
31
}
32
+ this . loadArchitectures ( ) ;
52
33
} ) ;
53
34
}
54
35
55
36
getCommandUbuntu ( installerName : string ) : string {
56
37
const ip = window . location . host . includes ( ':' ) ? window . location . host . split ( ':' ) [ 0 ] : window . location . host ;
57
38
58
39
return `sudo bash -c "apt update -y && apt install wget -y && mkdir -p /opt/utmstack-linux-agent && \
59
- wget --no-check-certificate --header='connection-key: ${ this . token } ' -P /opt/utmstack-linux-agent \
40
+ wget --no-check-certificate --header='connection-key: <secret> ${ this . token } </secret> ' -P /opt/utmstack-linux-agent \
60
41
https://${ ip } :9001/private/dependencies/agent/${ installerName } && \
61
42
chmod -R 777 /opt/utmstack-linux-agent/${ installerName } && \
62
- /opt/utmstack-linux-agent/${ installerName } install ${ ip } ${ this . token } yes"` ;
43
+ /opt/utmstack-linux-agent/${ installerName } install ${ ip } <secret> ${ this . token } </secret> yes"` ;
63
44
}
64
45
65
46
getCommandCentos7RedHat ( installerName : string ) : string {
66
47
const ip = window . location . host . includes ( ':' ) ? window . location . host . split ( ':' ) [ 0 ] : window . location . host ;
67
48
68
49
return `sudo bash -c "yum install wget -y && mkdir -p /opt/utmstack-linux-agent && \
69
- wget --no-check-certificate --header='connection-key: ${ this . token } ' -P /opt/utmstack-linux-agent \
50
+ wget --no-check-certificate --header='connection-key: <secret> ${ this . token } </secret> ' -P /opt/utmstack-linux-agent \
70
51
https://${ ip } :9001/private/dependencies/agent/${ installerName } && \
71
52
chmod -R 777 /opt/utmstack-linux-agent/${ installerName } && \
72
- /opt/utmstack-linux-agent/${ installerName } install ${ ip } ${ this . token } yes"` ;
53
+ /opt/utmstack-linux-agent/${ installerName } install ${ ip } <secret> ${ this . token } </secret> yes"` ;
73
54
}
74
55
75
56
getCommandCentos8Almalinux ( installerName : string ) : string {
76
57
const ip = window . location . host . includes ( ':' ) ? window . location . host . split ( ':' ) [ 0 ] : window . location . host ;
77
58
78
59
return `sudo bash -c "dnf install wget -y && mkdir -p /opt/utmstack-linux-agent && \
79
- wget --no-check-certificate --header='connection-key: ${ this . token } ' -P /opt/utmstack-linux-agent \
60
+ wget --no-check-certificate --header='connection-key: <secret> ${ this . token } </secret> ' -P /opt/utmstack-linux-agent \
80
61
https://${ ip } :9001/private/dependencies/agent/${ installerName } && \
81
62
chmod -R 777 /opt/utmstack-linux-agent/${ installerName } && \
82
- /opt/utmstack-linux-agent/${ installerName } install ${ ip } ${ this . token } yes"` ;
63
+ /opt/utmstack-linux-agent/${ installerName } install ${ ip } <secret> ${ this . token } </secret> yes"` ;
83
64
}
84
65
85
66
getUninstallCommand ( installerName : string ) : string {
86
67
return `sudo bash -c "/opt/utmstack-linux-agent/${ installerName } uninstall || true; \
87
- systemctl stop UTMStackAgent 2>/dev/null || true; systemctl disable UTMStackAgent 2>/dev/null || true; \
88
- rm /etc/systemd/system/UTMStackAgent.service 2>/dev/null || true; systemctl stop UTMStackRedline 2>/dev/null || true; \
89
- systemctl disable UTMStackRedline 2>/dev/null || true; rm /etc/systemd/system/UTMStackRedline.service 2>/dev/null || true; \
90
- systemctl stop UTMStackUpdater 2>/dev/null || true; systemctl disable UTMStackUpdater 2>/dev/null || true; \
91
- rm /etc/systemd/system/UTMStackUpdater.service 2>/dev/null || true; systemctl stop UTMStackModulesLogsCollector 2>/dev/null || true; \
92
- systemctl disable UTMStackModulesLogsCollector 2>/dev/null || true; \
93
- rm /etc/systemd/system/UTMStackModulesLogsCollector.service 2>/dev/null || true; \
94
- systemctl daemon-reload 2>/dev/null || true; \
95
- echo 'Removing UTMStack Agent dependencies...' && sleep 10 && rm -rf /opt/utmstack-linux-agent && \
96
- echo 'UTMStack Agent dependencies removed successfully.'"` ;
68
+ systemctl stop UTMStackAgent 2>/dev/null || true; systemctl disable UTMStackAgent 2>/dev/null || true; \
69
+ rm -f /etc/systemd/system/UTMStackAgent.service 2>/dev/null || true; \
70
+ systemctl stop UTMStackModulesLogsCollector 2>/dev/null || true; \
71
+ systemctl disable UTMStackModulesLogsCollector 2>/dev/null || true; \
72
+ rm -f /etc/systemd/system/UTMStackModulesLogsCollector.service 2>/dev/null || true; \
73
+ systemctl daemon-reload 2>/dev/null || true; \
74
+ echo 'Removing UTMStack Agent dependencies...' && sleep 10 && rm -rf /opt/utmstack-linux-agent 2>/dev/null || true; \
75
+ echo 'UTMStack Agent dependencies removed successfully.'"` ;
97
76
}
98
77
78
+ private loadArchitectures ( ) {
79
+ this . architectures = [
80
+ {
81
+ id : 1 , name : 'Ubuntu 16/18/20+' ,
82
+ install : this . getCommandUbuntu ( 'utmstack_agent_service' ) ,
83
+ uninstall : this . getUninstallCommand ( 'utmstack_agent_service' ) ,
84
+ shell : ''
85
+ } ,
86
+ {
87
+ id : 2 , name : 'Centos 7/Red Hat Enterprise Linux' ,
88
+ install : this . getCommandCentos7RedHat ( 'utmstack_agent_service' ) ,
89
+ uninstall : this . getUninstallCommand ( 'utmstack_agent_service' ) ,
90
+ shell : ''
91
+ } ,
92
+ {
93
+ id : 3 , name : 'Centos 8/AlmaLinux' ,
94
+ install : this . getCommandCentos8Almalinux ( 'utmstack_agent_service' ) ,
95
+ uninstall : this . getUninstallCommand ( 'utmstack_agent_service' ) ,
96
+ shell : ''
97
+ }
98
+ ] ;
99
+ }
99
100
}
0 commit comments