{"id":567,"date":"2023-09-28T23:27:14","date_gmt":"2023-09-28T14:27:14","guid":{"rendered":"http:\/\/blog.gurees.net\/?p=567"},"modified":"2023-10-07T10:42:53","modified_gmt":"2023-10-07T01:42:53","slug":"centos-stream9%e3%81%a7lxc%e3%82%92%e5%8b%95%e3%81%8b%e3%81%99","status":"publish","type":"post","link":"https:\/\/blog.gurees.net\/?p=567","title":{"rendered":"CentOS Stream9\u3067LXC\u3092\u52d5\u304b\u3059\u2460"},"content":{"rendered":"\n<p>\u4eee\u60f3\u5316\u3068\u3044\u3048\u3070ESXi\u3084Proxmox\u3092\u4f7f\u3063\u3066\u3044\u305f\u306e\u3067\u3059\u3002<\/p>\n\n\n\n<p>ESXi\u306fvCenter\u3092\u4f7f\u3048\u3070vMotion\u3067\u30e9\u30a4\u30d6\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u304c\u3067\u304d\u307e\u3059\u304c\u3001\u6709\u6599\u3067\u3059\u3002<br>Proxmox\u306f\u4eee\u60f3\u30de\u30b7\u30f3\u3068LXC\u30b3\u30f3\u30c6\u30ca\u3092\u6271\u3048\u3066\u3001\u4eee\u60f3\u30de\u30b7\u30f3\u306f\u30e9\u30a4\u30d6\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3082\u3067\u304d\u307e\u3059\u304c\u3001\u30b3\u30f3\u30c6\u30ca\u306f\u30e9\u30a4\u30d6\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u304c\u4eca\u306e\u3068\u3053\u308d\u3067\u304d\u306a\u3055\u305d\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3068\u306f\u3044\u3048\u3001LXC\u306f\u8d77\u52d5\u3084\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3082\u65e9\u304f\u4fbf\u5229\u306a\u306e\u3067Proxmox\u3067\u306fLXC\u3092\u6700\u8fd1\u3088\u304f\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002\u305b\u3063\u304b\u304f\u306a\u306e\u3067LXC\u3092CentOS \u3067\u30db\u30b9\u30c8\u3057\u305f\u304f\u306a\u3063\u305f\u306e\u3067\u3001\u305d\u306e\u8a18\u9332\u3067\u3059\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>\u74b0\u5883\u306fCentOS Stream9\u3092\u6700\u5c0f\u69cb\u6210\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3001SELinux\u3092\u7121\u52b9\u306b\u3057\u305f\u72b6\u614b\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>LXC\u306f\u6a19\u6e96\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u306f\u306a\u304f\u3001EPEL\u306a\u306e\u3067\u3001EPEL\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3068\u3001LXC\u95a2\u9023\u306e\u30c4\u30fc\u30eb\u3092\u5165\u308c\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># dnf install epel-release -y\n# dnf install lxc lxc-templates container-selinux wget tar -y<\/pre>\n\n\n\n<p>LXC\u306e\u8d77\u52d5\u3068\u81ea\u52d5\u8d77\u52d5\u3092\u6709\u52b9\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># systemctl enable --now lxc.service<\/pre>\n\n\n\n<p>\u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u3063\u3066\u307f\u307e\u3059\u3002&#8211;template download\u3067\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3001&#8211;dist\u4ee5\u964d\u3067CentOS Stream9\u306ex64\u7248\u3092\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># lxc-create --template download -n test_container -- --dist centos --release 9-Stream --arch amd64\nDownloading the image index\nDownloading the rootfs\nDownloading the metadata\nThe image cache is now ready\nUnpacking the rootfs\n\n---\nYou just created a Centos 9-Stream x86_64 (20230927_07:08) container.<\/pre>\n\n\n\n<p>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u30b3\u30f3\u30c6\u30ca\u306f\u4ee5\u4e0b\u306e\u30da\u30fc\u30b8\u3092\u53c2\u8003\u306b\u3059\u308b\u3068\u4ed6\u306e\u30c7\u30a3\u30b9\u30c8\u30ea\u30d3\u30e5\u30fc\u30b7\u30e7\u30f3\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/images.linuxcontainers.org\/\">https:\/\/images.linuxcontainers.org\/<\/a><\/p>\n\n\n\n<p>\u4f5c\u6210\u3057\u305f\u30b3\u30f3\u30c6\u30ca\u3092\u8d77\u52d5\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># lxc-start --name test_container\nlxc-start: test_container: lxccontainer.c: wait_on_daemonized_start: 877 Received container state \"ABORTING\" instead of \"RUNNING\"\nlxc-start: test_container: tools\/lxc_start.c: main: 306 The container failed to start\nlxc-start: test_container: tools\/lxc_start.c: main: 309 To get more details, run the container in foreground mode\nlxc-start: test_container: tools\/lxc_start.c: main: 311 Additional information can be obtained by setting the --logfile and --logpriority option<\/pre>\n\n\n\n<p>\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u30aa\u30d7\u30b7\u30e7\u30f3\u4f7f\u3048\u3068\u3044\u3046\u3053\u3068\u306a\u306e\u3067\u3001\u3064\u3051\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># lxc-start -n test_container -o \/tmp\/lxc-test_container.log\nlxc-start: test_container: lxccontainer.c: wait_on_daemonized_start: 877 Received container state \"ABORTING\" instead of \"RUNNING\"\nlxc-start: test_container: tools\/lxc_start.c: main: 306 The container failed to start\nlxc-start: test_container: tools\/lxc_start.c: main: 309 To get more details, run the container in foreground mode\nlxc-start: test_container: tools\/lxc_start.c: main: 311 Additional information can be obtained by setting the --logfile and --logpriority options\n\n# cat \/tmp\/lxc-test_container.log\nlxc-start test_container 20230927131955.996 ERROR    network - network.c:netdev_configure_server_veth:710 - No such file or directory - Failed to attach \"vethifBqSc\" to bridge \"lxcbr0\", bridge interface doesn't exist\nlxc-start test_container 20230927131956.913 ERROR    network - network.c:lxc_create_network_priv:3413 - No such file or directory - Failed to create network device\nlxc-start test_container 20230927131956.987 ERROR    start - start.c:lxc_spawn:1843 - Failed to create the network\nlxc-start test_container 20230927131956.108 ERROR    lxccontainer - lxccontainer.c:wait_on_daemonized_start:877 - Received container state \"ABORTING\" instead of \"RUNNING\"\nlxc-start test_container 20230927131956.121 ERROR    lxc_start - tools\/lxc_start.c:main:306 - The container failed to start\nlxc-start test_container 20230927131956.125 ERROR    lxc_start - tools\/lxc_start.c:main:309 - To get more details, run the container in foreground mode\nlxc-start test_container 20230927131956.129 ERROR    lxc_start - tools\/lxc_start.c:main:311 - Additional information can be obtained by setting the --logfile and --logpriority options\nlxc-start test_container 20230927131956.288 ERROR    start - start.c:__lxc_start:2074 - Failed to spawn container \"test_containe<\/pre>\n\n\n\n<p>lxcbr0\u304c\u306a\u3044\u3088\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u306d\u3002\u30b3\u30f3\u30c6\u30ca\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u30d6\u30ea\u30c3\u30b8\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u304c\u69cb\u6210\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u305d\u308c\u3092\u4f7f\u304a\u3046\u3068\u3057\u3066\u3001\u30d6\u30ea\u30c3\u30b8\u3092\u4f5c\u3063\u3066\u306a\u3044\u306e\u3067\u30a8\u30e9\u30fc\u306b\u306a\u3063\u305f\u308f\u3051\u3067\u3059\u306d\u3002<\/p>\n\n\n\n<p>\u30d6\u30ea\u30c3\u30b8\u3092\u6709\u52b9\u306b\u3059\u308b\u306e\u306b\u3001LXC\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \/etc\/sysconfig\/lxc\nUSE_LXC_BRIDGE=\"false\"\n\u2193\nUSE_LXC_BRIDGE=\"true\" <\/pre>\n\n\n\n<p>LXC\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30b5\u30fc\u30d3\u30b9\u306fdnsmasq\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># dnf install dnsmasq -y<\/pre>\n\n\n\n<p>LXC\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30b5\u30fc\u30d3\u30b9\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># systemctl enable --now lxc-net.service<\/pre>\n\n\n\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u306flxcbr0\u3068\u3044\u3046\u540d\u524d\u3067\u30d6\u30ea\u30c3\u30b8\u304c\u8d77\u52d5\u3057\u307e\u3059\u3002\u30d6\u30ea\u30c3\u30b8\u304c\u8d77\u52d5\u3057\u305f\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># ip a\n11: lxcbr0: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000\n    link\/ether 00:16:3e:00:00:00 brd ff:ff:ff:ff:ff:ff\n    inet 10.0.3.1\/24 brd 10.0.3.255 scope global lxcbr0\n       valid_lft forever preferred_lft forever<\/pre>\n\n\n\n<p>\u30d6\u30ea\u30c3\u30b8\u304c\u8d77\u52d5\u3057\u305f\u72b6\u614b\u3067\u30b3\u30f3\u30c6\u30ca\u3092\u3082\u3046\u4e00\u5ea6lxc-start\u3092\u3059\u308b\u3068\u8d77\u52d5\u3067\u304d\u307e\u3059\u3002\u8d77\u52d5\u5f8c\u4f55\u3082\u51fa\u529b\u3055\u308c\u306a\u3051\u308c\u3070\u6b63\u5e38\u306a\u306e\u3067\u3001lxc-attach\u3067\u30b3\u30f3\u30c6\u30ca\u306b\u30a2\u30bf\u30c3\u30c1\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># lxc-start --name test_container\n# lxc-attach --name test_container\n[root@test_container \/]# ip a\n1: lo: &lt;LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000\n    link\/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\n    inet 127.0.0.1\/8 scope host lo\n       valid_lft forever preferred_lft forever\n    inet6 ::1\/128 scope host\n       valid_lft forever preferred_lft forever\n2: eth0@if12: &lt;BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000\n    link\/ether 00:16:3e:5c:51:64 brd ff:ff:ff:ff:ff:ff link-netnsid 0\n    inet6 fe80::b903:38eb:eef1:1021\/64 scope link noprefixroute\n       valid_lft forever preferred_lft forever<\/pre>\n\n\n\n<p>\u7121\u4e8b\u30a2\u30bf\u30c3\u30c1\u51fa\u6765\u305f\u3089exit\u3067\u629c\u3051\u3066\u3001lxc-stop\u3067\u505c\u6b62\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[root@test_container \/]# exit\n# lxc-stop --name test_container<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4eee\u60f3\u5316\u3068\u3044\u3048\u3070ESXi\u3084Proxmox\u3092\u4f7f\u3063\u3066\u3044\u305f\u306e\u3067\u3059\u3002 ESXi\u306fvCenter\u3092\u4f7f\u3048\u3070vMotion\u3067\u30e9\u30a4\u30d6\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u304c\u3067\u304d\u307e\u3059\u304c\u3001\u6709\u6599\u3067\u3059\u3002Proxmox\u306f\u4eee\u60f3\u30de\u30b7\u30f3\u3068LXC\u30b3\u30f3\u30c6\u30ca\u3092\u6271\u3048\u3066\u3001\u4eee\u60f3\u30de\u30b7\u30f3\u306f\u30e9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32,19],"tags":[],"class_list":["post-567","post","type-post","status-publish","format-standard","hentry","category-container","category-linux"],"_links":{"self":[{"href":"https:\/\/blog.gurees.net\/index.php?rest_route=\/wp\/v2\/posts\/567","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.gurees.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.gurees.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.gurees.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.gurees.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=567"}],"version-history":[{"count":4,"href":"https:\/\/blog.gurees.net\/index.php?rest_route=\/wp\/v2\/posts\/567\/revisions"}],"predecessor-version":[{"id":580,"href":"https:\/\/blog.gurees.net\/index.php?rest_route=\/wp\/v2\/posts\/567\/revisions\/580"}],"wp:attachment":[{"href":"https:\/\/blog.gurees.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=567"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.gurees.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=567"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.gurees.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}