Windows WSL2 上に CentOS7でサーバ構築
2022/07/26
2022/07/28

CentOS8とはまた違った手順でCentOS7ではサーバ構築します。
WSL2 CentOS7のダウンロード
下記よりダウンロードして解凍し実行ができます。その作業で自動的にwslのイメージ登録が完了します
WSL2 CentOS7のダウンロードサーバ構築
systemtlは通常のsystemctlだとエラーになるので疑似的なsystemctlを用意します。またsystemedも同様にエラーになります。 通常だと対応策でメジャーなgenie systemedをインストールするところですがCentOS7だとインストールがうまく行きません。 ですのでpidのエラーが出ないように/lib/systemd/systemdをマウントして起動する方法をとります。
1 2 3 4 5 6 7 8 9 10 11 |
[root@spinaker itchy]# curl https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl.py >temp [root@spinaker itchy]# mv temp /usr/bin/systemctl [root@spinaker itchy]# chmod +x /usr/bin/systemctl [root@spinaker itchy]# yum install daemonize [root@spinaker itchy]# pip install psutil [root@spinaker itchy]# sudo -b unshare --pid --fork --mount-proc /lib/systemd/systemd --system-unit=basic.target [root@spinaker itchy]# yum install httpd [root@spinaker itchy]# yum install mariadb-server [root@spinaker itchy]# systemctl start httpd [root@spinaker itchy]# systemctl start mariadb [root@spinaker itchy]# mysql_secure_installation |