wifky!

wsl2でamazonlinux2023_minimal

C:\wsl\test>type set_al.cmd

@echo off

set distribution=wsl
wsl --unregister %distribution%

rem amazonlinux2023 https://cdn.amazonlinux.com/al2023/os-images/latest/
set container=https://cdn.amazonlinux.com/al2023/os-images/2023.9.20251208.0/container-minimal/al2023-container-minimal-2023.9.20251208.0-x86_64.tar.xz
curl -L -o %~dp0\rootfs.tar.xz %container%
wsl --import %distribution% %~dp0 %~dp0rootfs.tar.xz --version 2

wsl --shutdown
wsl -s %distribution%


dnf update -y
dnf -y install vim tar \
sudo passwd \
openssh-server openssh-clients

とりあえずユーザー追加。

adduser -G wheel taku;passwd taku


#dnf update -y
#dnf -y install vim sudo
#curl -o /usr/bin/busybox https://busybox.net/downloads/binaries/1.35.0-x86_64-linux-musl/busybox
#chmod 755 /usr/bin/busybox
#busybox adduser -G wheel taku;busybox passwd taku

default化は後で楽ができるようにここで書いておくが、いったんコメントアウト。

cat <<EOF > /etc/wsl.conf
[boot]
systemd=true
#[user]
#default=taku
EOF


sudo ln -s /usr/bin/vim /usr/bin/vi
sudo sed -i -e 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config

HTTPD Setting


dnf -y install httpd
mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.bak


cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
grep -v -e '^\s*#' -e '^\s*$' /etc/httpd/conf/httpd.conf.bak > /etc/httpd/conf/httpd.conf
dnf -y install perl-CGI

<Directory "/var/www/html">
Options Indexes FollowSymLinks ExecCGI
AllowOverride all
Require all granted
</Directory>

AddHandler cgi-script .cgi

chown taku /var/www/html
ln -s /var/www/html /home/taku/htdocs

かちゅぼーどを入れたい

https://spelunker2.wordpress.com/2020/02/21/katjusha/

PHP7がいる

PHP7
systemctl enable httpd

Restart wsl

コンテンツ・・・?

phpinfo

cat <<EOF > /var/www/html/phpinfo.php
<?php phpinfo(); ?>
EOF

日本語化

sudo dnf install langpacks-ja
sudo localectl set-locale LANG=ja_JP.UTF-8