---
description: Installation and requirements guide
---

# Installation

## Server prerequisites

* Docker
* Linux
* [Golang 1.21 or later](https://go.dev/dl/)

The Monarch server was primarily developed and tested on Ubuntu. Native installation of the server will only work on **Linux systems** (specifically, systems that allow direct access to Docker containers via interface). However, the Monarch client has been tested on and can run on Mac OS and Windows.&#x20;

> _Note: Installing Monarch in a container will work on other **Unix-like** systems, however, you'd need to specify which ports you'd be likely to open in the install script, so that the host machine (if any) would give external connections access to the container. These ports would be your HTTP(S) and multiplayer endpoints, specified in the Monarch configuration file._&#x20;

For system requirements, see the requirements for Docker Desktop on [Linux](https://docs.docker.com/desktop/install/linux-install/).

## Installing Monarch server

[You can install Monarch from GitHub](https://github.com/pygrum/monarch). Once cloned, with bash, run `scripts/install-monarch.sh`.\
The Docker network for monarch containers, encryption keys / certificates as well as the SQL container instance for storage will be set up automatically. The monarch binary is saved as `$HOME/.local/bin/monarch`.&#x20;

```bash
# run on the server
git clone https://github.com/pygrum/monarch && \
    cd monarch && \
    bash scripts/install-monarch.sh
```

Alternatively, you may install monarch in a Linux container with `scripts/docker-install-monarch.sh`. In this case, Monarch is started with a script in `$HOME/.local/bin` called `monarch.sh`. It is important to remember that if this container is running in a host, then it will need to be given access to certain ports for HTTP(S) and multiplayer listeners.

Once installation has finished, you may wish to edit the default configuration placed in `$HOME/.monarch/monarch.yaml.`

```yaml
# Default configuration for monarch. Consider changing these values after installation (~/.monarch/monarch.yaml)
debug: false
loglevel: 2 # 1: debug 2: info 3: success 4: warn 5: error 6: fatal
certfile: monarch-cert.pem # files are relative to monarch home directory (~/.monarch)
keyfile: monarch-key.pem
cacert: ca-cert.pem # signing cert and key
cakey: ca-key.pem

interface: 0.0.0.0 # main interface monarch binds to for operations

httpport: 8000
httpsport: 4433
multiplayerport: 1337
tcpport: 8888
# the deadline for socket reads in milliseconds. This must be set as data sent through sockets is received in chunks
tcpdeadline: 20

# configuration for HTTP(S) c2 endpoints
httpconfig: monarch_http.json

session_timeout_minutes: 60 # time until re-registration

installdir: agents
# gitusername: # set me: used to install private repositories
# gitpat: # set me: used to install private repositories
ignoreconsolewarnings: false

mysqladdress: 172.20.0.3 # default mysql container address
mysqlusername: root
mysqlpassword: monarch
```

## Installing Monarch client

### Runs on

* Windows
* Linux
* MacOS

The monarch client is just a binary, which can be downloaded from the [releases](https://github.com/pygrum/monarch/releases/latest) page. All that's required to start the client is the configuration file generated by the server.
