Ubuntu mkdocs 설치

Ubuntu mkdocs 설치


python , python-pip mkdocs 설치

https://www.mkdocs.org Site 에 설치법이 있지만 ubuntu에서 할때는 apt 로 패키지 관리가 좀더 편합니다. 🙂

test@docker-test:~$ sudo apt install python python-pip mkdocs



mkdocs Test

test@docker-test:~$ mkdocs new my-project
INFO    -  Creating project directory: my-project
INFO    -  Writing config file: my-project/mkdocs.yml
INFO    -  Writing initial docs: my-project/docs/index.md
test@docker-test:~$ cd my-project/
test@docker-test:~/my-project$ mkdocs build

test@docker-test:~/my-project$ mkdocs --help
Usage: mkdocs [OPTIONS] COMMAND [ARGS]...

  MkDocs - Project documentation with Markdown.

  -V, --version  Show the version and exit.
  -q, --quiet    Silence warnings
  -v, --verbose  Enable verbose output
  -h, --help     Show this message and exit.

  build      Build the MkDocs documentation
  gh-deploy  Deploy your documentation to GitHub Pages
  new        Create a new MkDocs project
  serve      Run the builtin development server


mkdocs serve 로 할때는 일반 유저로도 상관이 없지만 –dev-addr 로 실행할때는 sudo 를 사용해야 합니다.

mkdocs serve 로 Site 를 운영하지 않으며 Github 및 nignx Site 와 연동하여 사용하시면 됩니다. 🙂

test@docker-test:~/my-project$ mkdocs serve
INFO    -  Building documentation...
[I 180909 20:03:45 server:271] Serving on
[I 180909 20:03:45 handlers:58] Start watching changes
^C[I 180909 20:03:46 server:291] Shutting down...
test@docker-test:~/my-project$ sudo mkdocs serve --dev-addr
INFO    -  Building documentation...
[I 180909 20:03:47 server:271] Serving on
[I 180909 20:03:47 handlers:58] Start watching changes
^C[I 180909 20:03:50 server:291] Shutting down...




pip upgrade

test@docker-test:~/Workspace/mkdocs$ pip list
pip (8.1.1)
setuptools (20.7.0)
wheel (0.29.0)
You are using pip version 8.1.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

test@docker-test:~/Workspace/mkdocs$ pip list
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main

ssh 재접속후 확인 
test@docker-test:~$ pip list
Package    Version
---------- -------
pip        18.0
setuptools 20.7.0
wheel      0.29.0



pip 패키지 설치시 –user 를 사용해야 합니다.

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/futures-3.2.0.dist-info'
Consider using the `--user` option or check the permissions.

test@docker-test:~/Workspace/mkdocs/wiki/wiki$ pip install mkdocs-rtd-dropdown --user
Successfully installed Jinja2-2.10 Markdown-2.6.11 MarkupSafe-1.0 PyYAML-3.13 backports-abc-0.5 click-6.7 futures-3.2.0 livereload-2.5.2 mkdocs-1.0.4 mkdocs-rtd-dropdown-1.0.2 singledispatch- six-1.11.0 tornado-5.1



pip 패키지 설치후 ssh 재접속을 통하여 정상적인 적용이 가능 합니다. 

pip 패키지 설치후 바로 mkdocs build 시 아래와 같은 메시지를 확인 할수 있습니다.

test@docker-test:~/Workspace/mkdocs/wiki/wiki$ mkdocs build
WARNING -  Config value: 'nav'. Warning: Unrecognised configuration name: nav
ERROR   -  Config value: 'theme'. Error: Unrecognised theme.

Aborted with 1 Configuration Errors!



ssh 재접속후 mkdocs build

test@docker-test:~/Workspace/mkdocs/wiki/wiki$ mkdocs build
INFO    -  Cleaning site directory
INFO    -  Building documentation to directory: /home/test/Workspace/mkdocs/wiki/wiki/site



material theme 사용시

site : https://squidfunk.github.io/mkdocs-material/

$ vi mkdocs.yml
name: 'material'
language: 'kr'

$ pip install mkdocs-material --user
$ mkdocs build





답글 남기기