Skip to content

Linux

systemdで「起動と有効化」(start&enable)を同時に実行する

systemdベースのLinuxでサービスの起動と有効化を実施する場合、例えば以下のように実行します。

systemctl enable docker.service
systemctl start docker.service

RedHat Enterprise Linuxのドキュメントであるブート時のシステムサービス起動の有効化に記載されていますが、enable --nowを指定することで「起動と有効化」を同時に実行することができます。

systemctl enable --now docker

Ubuntuのqcow2イメージサイズを拡張する

Ubuntu Cloud Images 24.04 LTS Daily Buildからダウンロードしたqcow2イメージをベースに、init-osでカスタマイズして検証に利用しています。しかし「Dockerをインストールする」という手順を追加したところ、ストレージの消費量が1GB以上増えてしまったようで、カスタマイズ時にエラーが発生するようになってしまいました。イメージサイズを拡張することで回避しましたので、その手順をメモしておきます。

dfimageでDockerコンテナイメージからDockerfileを復元する

Dockerfile From Image (dfimage)を使うとDockerコンテナからDockerfileを復元することができます。dfimage自体がDockerコンテナとして提供されており、Dockerエンジンがあれば利用可能です。ただ、毎回Dockerコンテナを実行するのは大変なので、ショートカットするには「エイリアスを設定する」「Pythonスクリプト経由で利用する」といった方法があるようです。今回は後者の「Pythonスクリプト経由で利用する」方法をメモします。

dfimageは仕組み上、Dockerを事前にインストールしておく必要があります。

Ubuntu 24.04LTS へ peco をインストールする

peco は Python で書かれた percol をベースに、同じコンセプトを Go 言語で実装したもの、だそうです。 percol も peco もかなり歴史があり、開発されてから 10 年程度経過しているようです。 peco の GitHub には以下のように書かれています。

peco (pronounced peh-koh) is based on a python tool, percol. percol was darn useful, but I wanted a tool that was a single binary, and forget about python. peco is written in Go, and therefore you can just grab the binary releases and drop it in your $PATH.

peco can be a great tool to filter stuff like logs, process stats, find files, because unlike grep, you can type as you think and look through the current results.

For basic usage, continue down below. For more cool elaborate usage samples, please see the wiki, and if you have any other tricks you want to share, please add to it!

今回は peco を Ubuntu 24.04LTS へインストールする手順をメモしておきます。