# Install the hub
PHP, Apache, the clone and its submodules, tools/mmo.php.
- **You will have:** the hub running at , and `php tools/mmo.php` answering.
- **You need:** a Linux or Windows machine you administer, git, and access to the framework's repositories.
These steps are for Ubuntu. On Windows, the hub's README gives the same steps with Windows' tools.
## 1. PHP and its modules
PHP 8.3 at least, 8.5 recommended. Ubuntu 26.04 ships PHP 8.5; on Ubuntu 22.04 or 24.04, add the `ondrej/php`
PPA first (`sudo add-apt-repository -y ppa:ondrej/php && sudo apt update`).
```bash
sudo apt install -qy git unzip zip apache2 php8.5-cli php8.5-common libapache2-mod-php8.5 php8.5-curl php8.5-gd php8.5-imagick php8.5-intl php8.5-mbstring php8.5-mongodb php8.5-mysql php8.5-sqlite3 php8.5-xml php8.5-zip
echo "phar.readonly = 0" | sudo tee -a /etc/php/8.5/mods-available/phar.ini
```
`phar.readonly = 0` matters: the libraries are released as `.phar` packages, and PHP refuses to write them
otherwise.
Install phpunit as well: every project and every library has its test suite.
## 2. Apache
Every application routes its requests through its `.htaccess`, so Apache needs `mod_rewrite` and
`AllowOverride All`. Serve the folder that holds your repositories, `~/dev/src` here:
```bash
sudo a2enmod php8.5 rewrite
sudo tee /etc/apache2/sites-available/000-dev.conf > /dev/null <
ServerName localhost
DocumentRoot "$HOME/dev/src"
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
EOF
sudo a2dissite 000-default && sudo a2ensite 000-dev
sudo usermod -a -G www-data $(whoami)
sudo usermod -a -G $(whoami) www-data
sudo systemctl restart apache2
```
The two `usermod` lines let Apache and you write the same folders: an application compiles its stylesheet into
its `www/bin`.
> On Ubuntu 26.04, Apache's service protects your home folder (`ProtectHome=read-only`) and forbids PCRE's JIT.
> The hub's README gives the two settings that lift this.
You can skip Apache altogether at first: PHP's built-in server runs one project at a time (**Your first
project** shows how).
## 3. Get the sources
> The framework's code is private: access to its repositories comes with a Hydra Agency contract. Without one,
> the [playground](https://www.mmoframework.fr/en/playground), these guides and the MCP server let you try it.
The hub and every library, each library a git submodule:
```bash
mkdir -p ~/dev/src/MMO && cd ~/dev/src/MMO
git clone git@github.com:MarcMouret/MMOFramework.git master --recurse-submodules
```
The hub is then `~/dev/src/MMO/master`, which is the address Apache gives it. Some libraries may be private: if
you cannot read one, skip it between `init` and `update`:
```bash
git submodule init
git config submodule.libs/ocr.update none
git submodule update
```
## 4. Check it works
The hub is a developer's only: create your account first, from the hub's folder. The first time, this also makes
the key pair signing the sessions and the folder of the accounts, this machine's only, never versioned; its password is
printed once, keep it in your password manager:
```bash
cd ~/dev/src/MMO/master
php tools/mmo.php hub-account --username= --email=
```
Open and log in: the hub lists every library, with its documentation, its demo and the
state of its repository. Then the command line:
```bash
php tools/mmo.php help
php tools/mmo.php check
```
`help` lists every command; `check` says, library by library, what each one is still missing. A library that
needs a service you have not installed (MongoDB for mmo.mongodb, `pdftk` for mmo.pdf, Tesseract for mmo.ocr)
still loads: you only need those services when you use the library.
## Common mistakes
- **« The hub has no account yet » (503) on every page.** Create the first one: `php tools/mmo.php hub-account`. A
forgotten password is given again by `php tools/mmo.php hub-account --username= --reset`.
- **A blank page or a 404 on every url.** `mod_rewrite` is off, or `AllowOverride` is not `All`: the
`.htaccess` is ignored.
- **"you must deactivate [phar.readonly]".** `phar.readonly = 0` was not written to the ini file PHP reads
(`php --ini` lists them).
- **"Failed to open stream: Read-only file system" in `www/bin`.** Ubuntu 26.04's `ProtectHome` (above).
- **An empty `libs/` folder.** The clone was made without `--recurse-submodules`: run
`git submodule update --init`.
## Going further
- Next: **Your first project**.