Non Docker Environment
Install K2 Agents on Node/VM/EC2 in non docker environment.
Prerequisites
In case of a restricted environment, please allow following access on the host:
Access to https://k2io.net through your firewall.
Create (if does not exist) a user and group on your host which will be used to run the K2 Agents.
The non-docker installer performs installation in the following manner,
Systemd based deployment
Process based deployment
The installer checks if user level systemd is enabled and functional, and if so, it creates services for the respective agent. Otherwise, it switches to process based installation, where it starts processes for the respective agents, and along with that, it also configures a cron-job to maintain the processes. So, in case a process gets stopped for any reason, the cron-job will start it at the next check.
To setup user level systemd management is as follows, Please follow steps from below page.
User Manager Systemd ServiceConfiguration
Download K2 Installer from Installation view in K2 SaaS Portal by signing in with your username and password
Download the zip of VM installation files from installation section of your k2 manager account
Unzip the file using the following command.
unzip vm-all.zip
Configure the permissions of VM installation files.
After extracting the zip file please change the owner & group of the directory using the user & group created (as asked in the prerequisites).
chown -R user_name:group_name k2install
Change the permissions of the extracted k2install directory, using the below command.
sudo chmod 755 k2install
Add the user and group in env.properties file which is to be used to run k2 agents (as asked in prerequisites) Edit the env.properties file and add the user name and user group as shown below.
k2_user_name=user_name
k2_user_group=user_group
Installation
Install K2 Agent
bash k2install.sh -i segment
Verify Installation
If K2 Agents Installed As A Root User
Ensure that the K2 Prevent-Web agent is running on the host system.
Use the systemctl status prevent-web-agent command to get information about the K2 Prevent-Web agent. If the output shows the running status of the service, as in the following output, you have K2 Prevent-Web agent running.
[root@SC-IntCC-003 ~]# systemctl status prevent-web-agent prevent-web-agent.service - K2 segment agent Loaded: loaded (/etc/systemd/system/prevent-web-agent.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2020-02-19 12:11:34 UTC; 1min 20s ago
If the machine does not have a K2 Prevent-Web agent running, it will show the below output.
[root@SC-IntCC-003 ~]# systemctl status prevent-web-agent Unit prevent-web-agent.service could not be found.
If K2 Agents Installed As A Non-Root User
Use the service prevent-web-agent status command to get information about the Prevent-Web agent. If the output shows the running status of the service, as in the following output, you have Prevent-Web agent running.
$ systemctl --user status prevent-web-agent prevent-web-agent.service - K2 prevent web agent Loaded: loaded (/home/centos/.config/systemd/user/prevent-web-agent.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2021-08-05 12:11:34 UTC; 1min 20s ago
OR
$ ps -ef | grep "com.k2cybersecurity.intcodeagent.Runner" | grep -v grep centos 28238 28054 9 03:50 ? 00:00:36 /usr/bin/java -server -XX:MaxMetaspaceSize=100M -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+UseContainerSupport -XX:NativeMemoryTracking=summary -XX:+HeapDumpOnOutOfMemoryError -Xms200m -Xmx700m -Djava.net.useSystemProxies=true -Dhttp.nonProxyHosts=localhost|127.0.0.*|::1 -cp /K2-IntcodeAgent-jar-with-dependencies.jar com.k2cybersecurity.intcodeagent.Runner
If the machine does not have a Prevent-Web agent running, it will show the below output.
$ systemctl --user status prevent-web-agent Unit prevent-web-agent.service could not be found
OR
$ ps -ef | grep "com.k2cybersecurity.intcodeagent.Runner" | grep -v grep $
What Next ?
Congratulations, You have successfully installed K2 Platform on your premises.
Install Language Agents
Please download and attach the language agent based on your application type.
Java
Node/VM/EC2Node
Node/VM/EC2Ruby
Node/VM/EC2PHP
Node/VM/EC2Last updated
Was this helpful?