Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Leon Nunes
Leon Nunes

Posted on

     

Creating a Hugo site using Rootless Podman - Part 1

I'm fairly new to containers and I've tried using containers in the past, I've never really got the point, but I'm starting to see their worth. However, I don't like the idea of giving complete root access to the containers.

To get myself familiar with the whole concept I'm usingHugo, Hugo is one of the most popular open-source static site generators(Yep stole it from their website :D)

This assumes you have podman up and running on Centos or Archlinux or any distro of your choice, its fairly simple to setup if you need to.

Centos 7 or 8

yum install podmanordnf install podman
Enter fullscreen modeExit fullscreen mode

Archlinux

pacman -Syu podmanor yay -Syu podman
Enter fullscreen modeExit fullscreen mode

Ubuntu

sudo apt-get install hugo
Enter fullscreen modeExit fullscreen mode

So theofficial docs suggest installing hugo either on your local machine using your favorite package manager or you can use it via podman.

Once again they have official packages in the repo so nocurl -sSL URL| bash is required here.
You can get started by following the guides here forCentos,ArchLinux andUbuntu or Debian.

To get started I use the suggesteddocker image, its fairly simple to get started for example if you want to create a new hugo blog you can simply do this.

$ mkdir blog$ cd blog
Enter fullscreen modeExit fullscreen mode
podman run --rm -it -v $(pwd):/src:z klakegg/hugo:0.82.0 new site quickstartTrying to pull docker.io/klakegg/hugo:0.82.0...Getting image source signaturesCopying blob e09912d331e4 done  ...Writing manifest to image destinationStoring signaturesCongratulations! Your new Hugo site is created in /src/quickstart.
Enter fullscreen modeExit fullscreen mode

Where the flags mean the following

--rm Remove container after exiting-d Detach after running-i Interactive-t Provides a TTY-v $(pwd):/src:z This mounts the current working directory to the /src directory in the container. klakegg/hugo:0.82.0   Image Name"new site"   Performs hugo new sitequickstart   Site Name
Enter fullscreen modeExit fullscreen mode

The:Z and:z Are quite important when it comes to SELinux, basically:z lets the containers change the SELinux contexts from what I've seen and the:Z doesn't more information hereSelinux With Containers. Please do not disable SELinux incase you get some errors. Remove the:z if you're not using SELinux.

If the installation has completed successfully you should see the following.

Just a few more steps and you're ready to go:1. Download a theme into the same-named folder.   Choose a theme from https://themes.gohugo.io/ or   create your own with the "hugo new theme <THEMENAME>" command.2. Perhaps you want to add some content. You can add single files   with "hugo new <SECTIONNAME>/<FILENAME>.<FORMAT>".3. Start the built-in live server via "hugo server".Visit https://gohugo.io/ for quickstart guide and full documentation.```That's it you have your initial project ready!! Pat yourself on the back cause it was fun.In the next post I will show you how to create posts, install a theme and build the static site using hugo and then finally serve the websites using Apache, stay tuned.
Enter fullscreen modeExit fullscreen mode

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

He/Him. Dabbling in Service Meshes, API Gateways and Devops/Hardware/Homelabs
  • Location
    Remote
  • Education
    Doesn't Matter
  • Pronouns
    he/him
  • Work
    Customer Sucess Engineer
  • Joined

More fromLeon Nunes

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp