いろいろやってみるにっき

てきとーに生きている奴の日記

古いエントリのサムネイル画像がリンク切れになってたりするけど、チマチマ修正中


WSL2のUbuntuにXAMPPをインストールして動かす

ちょっとしたWebアプリのテスト環境が欲しかったので、XAMPPをWSL2に入れてみた。いつもXAMPPをインストールするときはGUIありでインストールしていたので全部CUIにするのは初チャレンジ。

今回は増殖させたUbuntu18.04。なので最初からrootユーザ。

 

ダウンロード

今回はXAMPP 7.4.6.-0を使った。

root@EAGLEII:/tmp# wget https://www.apachefriends.org/xampp-files/7.4.6/xampp-linux-x64-7.4.6-0-installer.run
--2021-03-09 08:48:34--  https://www.apachefriends.org/xampp-files/7.4.6/xampp-linux-x64-7.4.6-0-installer.run
Resolving www.apachefriends.org (www.apachefriends.org)... 3.214.239.247, 107.21.1.2, 3.212.81.116
Connecting to www.apachefriends.org (www.apachefriends.org)|3.214.239.247|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://downloadsapachefriends.global.ssl.fastly.net/7.4.6/xampp-linux-x64-7.4.6-0-installer.run?from_af=true [following]
--2021-03-09 08:48:35--  https://downloadsapachefriends.global.ssl.fastly.net/7.4.6/xampp-linux-x64-7.4.6-0-installer.run?from_af=true
Resolving downloadsapachefriends.global.ssl.fastly.net (downloadsapachefriends.global.ssl.fastly.net)... 151.101.109.194
Connecting to downloadsapachefriends.global.ssl.fastly.net (downloadsapachefriends.global.ssl.fastly.net)|151.101.109.194|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 156230349 (149M) [binary/octet-stream]
Saving to: ‘xampp-linux-x64-7.4.6-0-installer.run’

xampp-linux-x64-7.4.6-0-insta 100%[=================================================>] 148.99M  11.1MB/s    in 13s

2021-03-09 08:48:49 (11.1 MB/s) - ‘xampp-linux-x64-7.4.6-0-installer.run’ saved [156230349/156230349]

 

インストール

chmod +xしてから実行。聞いてきた質問は全部 y で答えた。

root@EAGLEII:/tmp# chmod +x ./xampp-linux-x64-7.4.6-0-installer.run
root@EAGLEII:/tmp# ./xampp-linux-x64-7.4.6-0-installer.run
----------------------------------------------------------------------------
Welcome to the XAMPP Setup Wizard.

----------------------------------------------------------------------------
Select the components you want to install; clear the components you do not want
to install. Click Next when you are ready to continue.

XAMPP Core Files : Y (Cannot be edited)

XAMPP Developer Files [Y/n] :y

Is the selection above correct? [Y/n]: y

----------------------------------------------------------------------------
Installation Directory

XAMPP will be installed to /opt/lampp
Press [Enter] to continue:

----------------------------------------------------------------------------
Setup is now ready to begin installing XAMPP on your computer.

Do you want to continue? [Y/n]: y

----------------------------------------------------------------------------
Please wait while Setup installs XAMPP on your computer.

 Installing
 0% ______________ 50% ______________ 100%
 #########################################

----------------------------------------------------------------------------
Setup has finished installing XAMPP on your computer.

 

ユーザの設定

お好きなユーザに設定。

root@EAGLEII:/tmp# chown -R shigeo:shigeo /opt/lampp

 

パーミッションの変更

777にする。

root@EAGLEII:/tmp# chmod -R 777 /opt/lampp

 

XAMPPを起動する

GUIの起動画面だとエラーになる。

root@EAGLEII:/tmp# /opt/lampp/manager-linux-x64.run
Unknown Error no display name and no $DISPLAY environment variable

Windows側でX Serverを動かせばいいんだろうけど、今回はめんどくさいのでコマンドライン起動する。

root@EAGLEII:/tmp# /opt/lampp/lampp start
Starting XAMPP for Linux 7.4.6-0...
XAMPP: Starting Apache...already running.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...Warning: World-writable config file '/opt/lampp/etc/my.cnf' is ignored
ok.
root@EAGLEII:/tmp# Warning: World-writable config file '/opt/lampp/etc/my.cnf' is ignored
Warning: World-writable config file '/opt/lampp/etc/my.cnf' is ignored

なんかワーニング出てる気がするけど起動したっぽい。

 

XAMPPの確認

Windows側のブラウザで接続してみる。localhostであっさりつながった。

f:id:shigeo-t:20210309091620p:plain

 

複数立てるならポート番号を変えるとかしなきゃいけないけど、1PCで1サーバだけならこんな感じでしょ。

XAMPPの実験

XAMPPの実験

 
お時間あったら、他のエントリもクリックして頂ければ幸いです。