プロジェクト

全般

プロフィール

Ubuntu管理

OS情報

OSバージョンの確認

  • /etc/os-releaseファイルを開くとバージョンが記載:表示
  • lsb_release -a コマンドを実行: 表示

ロケール

日本語ロケール

参考資料
https://hiro20180901.hatenablog.com/entry/2022/02/13/180000

$ sudo apt install language-pack-ja
  :
$ sudo update-locale LANG=ja_JP.utf8
  :
$ sudo apt install manpages-ja manpages-ja-dev
  :

パッケージ管理システム

apt

aptのリポジトリ設定

/etc/apt/source.list にリポジトリサーバーのURLが定義されています。
デフォルトでは、archive.ubuntu.comが設定されています。例

deb http://archive.ubuntu.com/ubuntu/ jammy main restricted

Ubuntuのaptリポジトリのミラーサイト一覧は次で公開されています。
https://launchpad.net/ubuntu/+archivemirrors

パッケージの更新

  • apt update
    リポジトリに最新情報を取りに行き、更新のあるパッケージを特定します。
  • apt upgrade
    更新のあるパッケージをリポジトリから取得し、更新します。

パッケージの検索

  • apt search 検索キーワード(パッケージ名の部分一致)
  • apt list パッケージ名

パッケージ情報

  • apt show パッケージ名

インストール済みのパッケージ表示

  • apt list --installed

アプリケーション

データベース

PostgreSQL

標準リポジトリには、

  • postgresql 16+257build1.1
  • postgresql-16 16.6
  • インストール
    sudo apt install postgresql

Dockerコンテナ

Docker Engineのインストール

Docker Engineは、アプリケーションをコンテナ化・実行するのに使います。

https://docs.docker.com/engine/install/ubuntu/

dockerのパッケージのリポジトリ情報を追加
~$ sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
~$ ls -l /etc/apt/keyrings/
total 4
-rw-r--r-- 1 root root 3817 Apr  5 19:32 docker.asc
~$ echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
~$ cat /etc/apt/sources.list.d/docker.list
deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu   noble stable
~$ sudo apt update

apt updateを実行して、今追加したdockerリポジトリ情報を取得します。

docker関連パッケージのインストール
~$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
コンテナの実行テスト
~$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
e6590344b1a5: Pull complete
Digest: sha256:7e1a4e2d11e2ac7a8c3f768d4166c2defeb09d2a750b010412b6ea13de1efb19
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.
  :


25日前に更新