0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Vagrantでalmalinuxの仮想マシンを手軽に立ち上げる

Posted at

はじめに

Vagrantは、仮想マシンを簡単に構築できるツールです。この記事では、Vagrantを使用してAlmaLinuxの仮想マシンを立ち上げる方法について説明します。AlmaLinuxは、CentOSをベースにしたLinuxディストリビューションであり、Red Hat Enterprise Linux(RHEL)と互換性があります。

Vagrantを使えば、手軽にAlmaLinuxの仮想マシンを立ち上げ、様々な環境での開発やテストを行うことができます。

動作環境

  • ubuntu 22.04(ホストOS)
  • vagrant 2.3.4
  • almalinux 9.1(ゲストOS)

参考サイト

必要なパッケージについては参考サイトなどを参考にすべて揃っていることとします。

環境の初期化

vagrant init almalinux/9コマンドで環境の初期化をします。

$ vagrant init almalinux/9

カレントディレクトリにVagrantfileが作成されます。このVagrantfileを修正して以下のようにします。

Vagarntfile
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "almalinux/9"

  config.vm.provider "libvirt" do |vb|
    vb.cpus = "4"
    vb.memory = "4096"
  end
end

仮想マシンの起動

vagrant upコマンドで仮想マシンを作成・起動します

$ vagrant up
Bringing machine 'default' up with 'libvirt' provider...
==> default: Box 'almalinux/9' could not be found. Attempting to find and install...
    default: Box Provider: libvirt
・
・

vagrant statusコマンドで起動しているか確認できます。状態がrunningになっていれば起動しています。

$ vagrant status
Current machine states:

default                   running (libvirt)

動作確認

試しにvagrant sshコマンドで仮想マシンにログインしてみましょう。

$ vagrant ssh

cat /etc/redhat-releaseコマンドでalmalinux 9.1であることが確認できました。

[vagrant@localhost ~]$ cat /etc/redhat-release 
AlmaLinux release 9.1 (Lime Lynx)
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?