install ispconfig 3.2.5 on ubuntu 20.04 in WSL.

Discussion in 'Tips/Tricks/Mods' started by nhybgtvfr, Jul 28, 2021.

  1. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    if you want to install a local ispconfig server on your windows system, maybe for testing / dev work.
    maybe you don't want to use a full vmware / virtualbox etc vps for it, and just want to run in in a WSL linux shell.
    if you've already tried doing this with the new automated install, you'll have noticed it doesn't work. the first problem you'll notice is with the mysql password generation which starts throwing errors.

    the problem is the automated install script uses systemd commands, which just aren't available.
    if your using WSL version 1, you can't fix this, their is no systemd support available, you'll need to update your system to WSL2.
    i'm not giving instructions for that here, there's plenty of them you can google. i'm assuming your starting point is a windows system already running WSL2.

    if you follow the automated install, you'll still notice the same problems, this is because you need to add systemd support into the instance.

    i downloaded the ubuntu 20.04.appx file, extracted it, and imported that into wsl, giving it the instance name 'ispconfig', i now start it from a .bat file containing the line 'wsl --distribution ispconfig', but installing ubuntu/debian from the microsoft store should be no different, apart from the final step....

    first, start your wsl linux instance, since i start from the .bat file, i am straight into the instance as root, if you're starting the ubuntu/debian app directly, you'll be as a normal user, and will need to sudo to root. then install the required micrososft packages:

    Code:
    wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
    sudo dpkg -i packages-microsoft-prod.deb
    rm packages-microsoft-prod.deb
    apt-get update;
    apt-get install -y apt-transport-https
    apt-get install -y dotnet-sdk-5.0
    
    use this 1st line for debian (10), follow instructions here for earlier debian releases: Install .NET on Debian - .NET | Microsoft Docs
    Code:
    wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
    
    the final line installs the entire .net sdk, if you're ok with just the runtime, you can change this package to aspnetcore-runtime-5.0 instead

    now we need to add the repo for the wsl packages (wsl-transdebian)
    Code:
    wget -O /etc/apt/trusted.gpg.d/wsl-transdebian.gpg https://arkane-systems.github.io/wsl-transdebian/apt/wsl-transdebian.gpg
    
    chmod a+r /etc/apt/trusted.gpg.d/wsl-transdebian.gpg
    
    cat << EOF > /etc/apt/sources.list.d/wsl-transdebian.list
    deb https://arkane-systems.github.io/wsl-transdebian/apt/ $(lsb_release -cs) main
    deb-src https://arkane-systems.github.io/wsl-transdebian/apt/ $(lsb_release -cs) main
    EOF
    
    apt update
    
    then install the final package:
    Code:
    install -y systemd-genie
    
    the final step is to automatically start genie on every shell session, to do this, i edit roots' .profile file, adding the lines:
    Code:
    # Are we in the bottle?
    if [[ ! -v INSIDE_GENIE ]]; then
      read -t 3 -p "yn? * Preparing to enter genie bottle (in 3s); abort? " yn
      echo
    
      if [[ $yn != "y" ]]; then
        echo "Starting genie:"
        exec /usr/bin/genie -s
      fi
    fi
    
    this will start genie every time unless you stop it within the first 3 seconds.
    again, if you're using the normal ubuntu/debian wsl app link to start your shell, you may need to add this to both root's .profile and your normal user account's .profile. i've not tested this using a microsoft store installed instance.

    from this point on, just follow the automated install instructions as normal. i now have a working ispconfig install on a wsl instance, and access the control panel directly from a windows browser using https://localhost:8080.
    note that obviously this will only use a self-signed cert, but now you have a fully working website dev environment without installing xamp on windows, and it's much easier to create new sites, switch php versions etc than with xamp / flywheel local etc.

    credit: after repeated failures, a working systemd setup was put together from instruction pulled from these pages:
    GitHub - arkane-systems/genie: A quick way into a systemd "bottle" for WSL
    Install .NET on Ubuntu - .NET | Microsoft Docs
    wsl-transdebian | A repository for WSL-only apt packages. (arkane-systems.github.io)
    Automatically start genie on every shell session · arkane-systems/genie Wiki · GitHub
     
    Last edited: Jul 28, 2021
    Fire Fox, Jesse Norell, Th0m and 2 others like this.

Share This Page