{"id":129,"date":"2017-04-16T10:54:00","date_gmt":"2017-04-16T13:54:00","guid":{"rendered":"https:\/\/www.linuxpro.com.br\/2017\/04\/install-hexo-on-ubuntu\/"},"modified":"2026-09-08T02:28:46","modified_gmt":"2026-09-08T05:28:46","slug":"install-hexo-on-ubuntu","status":"publish","type":"post","link":"https:\/\/www.linuxpro.com.br\/en\/2017\/04\/install-hexo-on-ubuntu\/","title":{"rendered":"Installing Hexo on Ubuntu"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" alt=\"Mascote do LinuxPro despejando uma pilha de arquivos de texto no funil do Hexo, que os transforma no site pronto exibido no notebook\" src=\"\/wp-content\/uploads\/2026\/09\/hexo-v3.webp\" width=\"1052\" height=\"652\" \/><\/p>\n<div style=\"background:#fff8e1;border-left:4px solid #8b1a1a;padding:.8em 1em;margin:1em 0\"><strong>Note (2026):<\/strong> The original howto installed Node with nvm <code data-no-translation=\"\">v0.35.1<\/code> on Ubuntu 16.04\/18.04. Hexo 8.x requires Node <strong>\u2265 20.19<\/strong>. Below: nvm 0.40.7, current LTS, <code data-no-translation=\"\">hexo-cli<\/code> without sudo, and the official workflow (init, server, generate). This site ran Hexo for years and migrated to WordPress in 2026 \u2014 the generator remains useful for static blogs.<\/div>\n<p>Hexo is a static site generator in Node.js: Markdown goes in, HTML comes out, no database. GitHub Pages, Netlify, an nginx pointing to <code data-no-translation=\"\">public\/<\/code>. In September 2026 the npm package <code data-no-translation=\"\">hexo<\/code> is at <strong>8.1.2<\/strong>. The official CLI remains <code data-no-translation=\"\">npm install -g hexo-cli<\/code> \u2014 but <em>without<\/em> root.<\/p>\n<p><!-- more --><\/p>\n<p><iframe style=\"width:100%;aspect-ratio:16\/9;border:0\" src=\"https:\/\/www.youtube-nocookie.com\/embed\/Ii4le3TJqTw\" allowfullscreen loading=\"lazy\"><\/iframe><\/p>\n<h2>Node via nvm (do not use sudo npm)<\/h2>\n<p>Hexo 8.0+ requires Node 20.19 or newer. Ubuntu apt lags behind. nvm 0.40.7 (18 August 2026) installs the LTS in your home directory:<\/p>\n<pre data-no-translation=\"\"><code class=\"language-bash\" data-no-translation=\"\">sudo apt update\nsudo apt install -y build-essential git curl\ncurl -o- https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.40.7\/install.sh | bash\nsource ~\/.bashrc\nnvm install --lts\nnvm use --lts\nnode -v\nnpm -v\n<\/code><\/pre>\n<p>If you see <code data-no-translation=\"\">EACCES<\/code> with global npm, the prefix is wrong \u2014 do not fix it with sudo. nvm already points npm to <code data-no-translation=\"\">~\/.nvm<\/code>. Alternative: <a href=\"https:\/\/github.com\/Schniz\/fnm\">fnm<\/a>.<\/p>\n<pre data-no-translation=\"\"><code class=\"language-bash\" data-no-translation=\"\">npm install -g hexo-cli\nhexo version\n<\/code><\/pre>\n<h2>First blog<\/h2>\n<p><code data-no-translation=\"\">hexo init<\/code> clones the starter (Landscape theme) and installs dependencies with npm, yarn or pnpm \u2014 whichever is in PATH:<\/p>\n<pre data-no-translation=\"\"><code class=\"language-bash\" data-no-translation=\"\">hexo init ~\/src\/blog\ncd ~\/src\/blog\nhexo new \"Ol\u00e1, Hexo\"\nhexo server\n<\/code><\/pre>\n<p>Open <code data-no-translation=\"\">http:\/\/localhost:4000<\/code>. The draft is in <code data-no-translation=\"\">source\/_posts\/<\/code>, Markdown + front-matter. Generate static files:<\/p>\n<pre data-no-translation=\"\"><code class=\"language-bash\" data-no-translation=\"\">hexo generate\n# ou: hexo g\nls public\/\n<\/code><\/pre>\n<p>The <code data-no-translation=\"\">public\/<\/code> is what nginx or Pages serves. Do not commit this folder \u2014 the <code data-no-translation=\"\">.gitignore<\/code> in the starter already ignores it.<\/p>\n<h2>Publish<\/h2>\n<p>GitHub Pages, in 2026, uses an Action, not just <code data-no-translation=\"\">hexo-deployer-git<\/code> in <code data-no-translation=\"\">gh-pages<\/code>. The official docs: <a href=\"https:\/\/hexo.io\/docs\/github-pages\">hexo.io\/docs\/github-pages<\/a>. Deployment via rsync\/git still exists:<\/p>\n<pre data-no-translation=\"\"><code class=\"language-bash\" data-no-translation=\"\">npm install hexo-deployer-git --save\n# _config.yml \u2192 deploy: type: git \/ repo: \/ branch:\nhexo clean &amp;&amp; hexo deploy\n<\/code><\/pre>\n<p>An nginx on the VPS: <code data-no-translation=\"\">root \/caminho\/do\/blog\/public;<\/code> and <code data-no-translation=\"\">hexo generate<\/code> in cron or CI. No PHP, no MariaDB.<\/p>\n<h2>Wrap-up<\/h2>\n<p>Node LTS, <code data-no-translation=\"\">hexo-cli<\/code> under your user, <code data-no-translation=\"\">hexo init<\/code>, <code data-no-translation=\"\">hexo s<\/code>, <code data-no-translation=\"\">hexo g<\/code>. Not the nvm 0.35 and Ubuntu 16.04 from the original post. Docs: <a href=\"https:\/\/hexo.io\/docs\/\">hexo.io\/docs<\/a> \u00b7 <a href=\"https:\/\/github.com\/hexojs\/hexo\">github.com\/hexojs\/hexo<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Hexo is a static site generator in Node.js: Markdown goes in, HTML comes out, no database. GitHub Pages, Netlify, or nginx pointing to public\/. In September 2026, the hexo npm package is at 8.1.2. The official CLI remains npm install \u2026 <a title=\"Installing Hexo on Ubuntu\" class=\"read-more\" href=\"https:\/\/www.linuxpro.com.br\/en\/2017\/04\/install-hexo-on-ubuntu\/\" aria-label=\"Read more about Instalando Hexo no Ubuntu\">Read more<\/a><\/p>","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[54,68,4,35],"class_list":["post-129","post","type-post","status-publish","format-standard","hentry","category-howtos","tag-hexo","tag-html","tag-linux","tag-www"],"_links":{"self":[{"href":"https:\/\/www.linuxpro.com.br\/en\/wp-json\/wp\/v2\/posts\/129","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxpro.com.br\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxpro.com.br\/en\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxpro.com.br\/en\/wp-json\/wp\/v2\/comments?post=129"}],"version-history":[{"count":6,"href":"https:\/\/www.linuxpro.com.br\/en\/wp-json\/wp\/v2\/posts\/129\/revisions"}],"predecessor-version":[{"id":1075,"href":"https:\/\/www.linuxpro.com.br\/en\/wp-json\/wp\/v2\/posts\/129\/revisions\/1075"}],"wp:attachment":[{"href":"https:\/\/www.linuxpro.com.br\/en\/wp-json\/wp\/v2\/media?parent=129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxpro.com.br\/en\/wp-json\/wp\/v2\/categories?post=129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxpro.com.br\/en\/wp-json\/wp\/v2\/tags?post=129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}