0
0

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.

LXD で Debian 11 を使う

Last updated at Posted at 2023-09-22

PHP7.4 を使うために、仮想環境に Debian 11 をインストールする方法です。
Chromebook の Linux 環境と同じになります。

インストールが完了してログインすると次のようになります。

$ ssh debian11.local
Linux debian11 6.2.0-33-generic #33-Ubuntu SMP PREEMPT_DYNAMIC Tue Sep  5 14:49:19 UTC 2023 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Sep 22 17:22:50 2023 from 10.112.67.1

uchida@debian11:~$ cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

OS のインストール

lxc launch images:debian/11/amd64 debian11

root のパスワードを設定

lxc exec debian11  -- bash

login

$ lxc console debian11
To detach from the console, press: <ctrl>+a q

debian11 login:

Login 後の設定

ユーザーの作成

adduser --uid 1200 uchida
gpasswd -a uchida sudo

sshd のインストール

sudo apt install ssh

avahi のインストール

sudo apt install avahi-daemon

avahi が動けば、次のようにしてログインができます。

ssh debian11.local

タイムゾーンの設定

sudo timedatectl set-timezone Asia/Tokyo

パスワードなしで、sudo が実行できるようにする

sudo visudo
(省略)
%sudo ALL=(ALL:ALL) NOPASSWD:ALL
(省略)

PHP のインストール

sudo apt install php

必要なライブラリーのインストール

sudo apt install php-mbstring php-mysql php-curl php-xml
sudo apt install php-fpm php-gd php-bz2 php-zip

確認

$ php -v
PHP 7.4.33 (cli) (built: Jun  9 2023 16:51:37) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies

MariaDB のインストール

sudo apt install mariadb-server

確認

$ sudo mariadb -uroot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 31
Server version: 10.5.19-MariaDB-0+deb11u2 Debian 11

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?