Skip to content

Instantly share code, notes, and snippets.

@2xyo
Last active August 26, 2024 20:39
Show Gist options
  • Save 2xyo/08c941b79a3b240da7d4a647061f8e88 to your computer and use it in GitHub Desktop.
Save 2xyo/08c941b79a3b240da7d4a647061f8e88 to your computer and use it in GitHub Desktop.
OpenCTI Ubuntu 24.04 - Dev VM
# Fresh Ubuntu 24.04 with Virtualbox 7.0.14
# Download https://releases.ubuntu.com/noble/ubuntu-24.04-live-server-amd64.iso - 2,6GB
## https://discourse.ubuntu.com/t/ubuntu-24-04-lts-noble-numbat-release-notes/39890
## Config
### 10 vCPU
### 32Go RAM
### 64Mo graphic card
### 100Go HDD
##
###Boot CD
## Install Ubuntu
## lang : English
## keyboard France French
## Minimal Install download updates
### Eras disk and install Ubuntu + use LVM
### time : paris
### user : localadmin
#Boot
##Terminal
sudo apt update && sudo apt full-upgrade -y
# installation Virtualbox guest addition
sudo apt install -y vim openssh-server
sudo reboot
# Installation of docker
## https://docs.docker.com/engine/install/ubuntu/
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# https://docs.docker.com/engine/install/linux-postinstall/
sudo usermod -aG docker $USER
newgrp docker
docker run hello-world
# https://opencti-platform.github.io/docs/development/installation
Generate a uniq UUID token
```console
cat /proc/sys/kernel/random/uuid >$HOME/.opencti_token
export OPENCTI_TOKEN=$(cat $HOME/.opencti_token)
```
```console
sudo apt update && sudo apt full-upgrade -y
VERSION=node_12.x
DISTRO="$(lsb_release -s -c)"
```
curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
echo "deb https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
sudo echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install -y nodejs yarn python3 python3-pip
cd
git clone https://github.com/OpenCTI-Platform/docker.git
cd docker
sudo systemctl start docker
# docker-compose -f ./docker-compose-dev.yml up
cd
git clone https://github.com/OpenCTI-Platform/opencti.git
cd opencti
cd opencti-platform/opencti-graphql
yarn install
cd ../opencti-front
yarn install
cd ../../opencti-worker/src
pip3 install -r requirements.txt
sed s/ChangeMe/${OPENCTI_TOKEN}/g config.yml.sample > config.yml
# python3 worker.py
# error ! api is down, not started
cd ../../opencti-platform/opencti-graphql/
#dos2unix config/default.json
sudo apt install -y jq moreutils
jq '.app.admin.token = $newtoken' --arg newtoken ${OPENCTI_TOKEN} config/default.json > config/development.json
jq '.app.admin.password = $newtoken' --arg newtoken password config/development.json | sponge config/development.json
jq '.minio.access_key = $newtoken' --arg newtoken ChangeMeAccess config/development.json | sponge config/development.json
jq '.minio.secret_key = $newtoken' --arg newtoken ChangeMeKey config/development.json | sponge config/development.json
#yarn start # or yarn install ?
sudo sysctl -w vm.max_map_count=262144
echo vm.max_map_count=262144 |sudo tee -a /etc/sysctl.d/90-OpenCTI.conf
# Install & start a terminator terminal with 1 windows per/process
# https://terminator-gtk3.readthedocs.io/en/latest/
sudo apt install terminator
# first step, start services :
## opencti-dev-grakn
## opencti-dev-redis
## opencti-dev-elasticsearch
## opencti-dev-minio
## opencti-dev-rabbitmq
cd $HOME/docker
docker-compose -f ./docker-compose-dev.yml up
# start graphql backend
cd $HOME/opencti/opencti-platform/opencti-graphql
yarn start
# start the python worker (link between rabbitmq and graphql)
cd $HOME/opentci/opencti-worker/src/
python3 worker.py
# start frontend
cd $HOME/opencti/opencti-platform/opencti-frontend
yarn start
# start worker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment