MkDocs Material - Install
Guide: Installing MkDocs Material on Ubuntu
Abstract
This guide explains how to install MkDocs Material on Ubuntu using two methods: Docker Compose and Native Installation. Choose the method that best suits your environment.
Method 1: Install MkDocs Material with Docker Compose
Prerequisites:
Steps:
-
Prepare the directory structure
Create a directory for MkDocs Material: -
Create the Docker Compose file
Example content for
Create acompose.yml
file:compose.yml
:Save and exit:services: mkdocs: image: squidfunk/mkdocs-material restart: unless-stopped ports: - "8000:8000" volumes: - /home/docker/mkdocs/data:/docs stdin_open: true tty: true
Ctrl + X
, thenY
, and pressEnter
. -
Set up MkDocs data structure
Add content to
Create directories and files for MkDocs:mkdocs.yml
as needed. Save and exit.
Create a directory for your documentation:
-
Start the container
Navigate back to the MkDocs directory: -
Access MkDocs
Open a browser and go tohttp://<server-ip>:8000
to view your MkDocs Material site.
Method 2: Install MkDocs Material Natively
Prerequisites:
- Python and pip installed. If not, install them first:
Steps:
-
Install MkDocs Material
Use pip to install the MkDocs Material package: -
Create a new MkDocs project
Replace
Run the following command to create a new site:<site-name>
with your desired project name. -
Navigate to the project folder
-
Serve the site locally
Start the development server: -
Access MkDocs
Open a browser and go tohttp://127.0.0.1:8000
to view your MkDocs Material site.
Tip
By adding the parameter -a <ip address:port>
you can specify on with ip address and port the site will be hosted. Example is mkdocs serve -a 192.168.0.123:7976
Conclusion
You’ve now set up MkDocs Material on Ubuntu using either Docker Compose or native installation. Choose Docker Compose for isolated and repeatable setups or native installation for simplicity.