Skip to content

Configuration and tooling to set up a freh WSL-Distro

Notifications You must be signed in to change notification settings

LKnulp/wslIgnite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WSL-Ignite

  This is a set of configuration files and tools to quickly set up a fresh WSL-Distro.
  It's created to use it on Windows 10/11 with WSL1, apache2 and PHP ^7.4.

WARNING: This set was createt and tested to the best of our knowledge and belief. Althoug, make sure you know what you're doing.
Never use this at critical infrastructure like production-environment, etc!

Contents

1. How to use


  It is suggested to clone this repository into your home-directory.

$ cd ~
$ git clone [email protected]:LKnulp/wslIgnite.git ./wslIgnite
$ cd wslIgnite

2. Installation


2.1 Installation by script

  If you want to use the install-script call spark.sh.
  If you specified a different name of the directory or used a whole different path, please make sure to update
  the spark.conf before runing the installation.

$ sudo ./spark.sh

  See

$ sudo ./spark.sh -h

  to learn how to modify the installation.

  Make sure to run

source ~/.bashrc

  after the installation finished to enable all new configuration and aliases.
  Additionally, all installed config files which may need you attention, will be opened in VS-Code.
  Please make sure to check them and especially add WSL_USER and WSL_EMAILwhithin the wslIgnite.conf.


2.2 Manual install

  Although the installation by script is recommended, if you want to perform the installation manually, you can find the steps here.


2.3 Removing

  You can remove all changes, links and files created by the install by calling

$ sudo ./spark.sh -r

  Don't worry, you don't have to give the uninstall the exact same parameters as used for install.
  The script will complain that locations cannot be removed but it will succeed anyway.

3. What's in here


wslIgnite/............................ Your wslIgnite-package directory, may vary on the clone-name you choose.
│
├── fuel/............................. Holds all the files for local use/ change after copying and linking.
│   │
│	├── .bash_aliases.example......... A suggestion for useful shortcuts
│   │
│	├── changePHP.sh.example.......... A tool to change the active PHP-version for CLI and apache2 in one command
|	│
|	├── configPHP.sh.example.......... A tool to change basic setting of a PHP-version to make local-dev easier.
│   │                                  For CLI and apache2
|	|
|	├── spark.conf.example............ Configuration for the install-script
|	|
│	├── tmux.conf.example............. A very basic tmux configuration to make live easier (mouse-support)
│   │
│	├── vhost.sh.example.............. A tool to create or remove vhosts (directories and configuration) for apache2
│   │
│	├── vimrc.example................. A very basic vim configuration to make it look better
│   │
|	├── wsl.conf.example.............. A basic configuration of WSL to make networking easier
│   │
│	└── wslIgnite.conf.example........ A configuration for the tool-scripts included here
│
├── ***.bash_aliases
│
├── .gitignore
│
├── ***changePHP.sh
│
├── ***configPHP.sh
│
├── README.md
│
├── ***spark.conf..................... The configuration for the install-script
│
├── spark.sh.......................... The install-script
│
├── ***tmux.conf
│
├── ***vhost.sh
│
├── ***vimrc
│
├── wsl-install.md.................... A collection of steps and tips to make WSL1 a local DEV-environment
│
├── ***wsl.conf
│
└── ***wslIgnite.cfg

3.1 General


Each file (*.example) within the fuel-directory will be copied into the root directory by the spark.sh install script for you.
Also, all of these (potentially) copied files are added to the .gitignore by default, to give you the ability to modify them the way you want.
All of these config-files and tool-scripts will then be made usable by creating sym-links at the preferred locations all over the WSL-distro.

Attention: At the moment, this package is created an maintained to support a WSL1-instance of Ubuntu 18/20/22 on a Windows-hostsystem 10/11.
Moreover it assumes that an apache2 webserver as well as VS-Code is used.

3.2 Tmux


This basic config was grabbed from https://juliu.is/a-simple-tmux/

If you choose to install this, a sym-link within your $HOME-directory named .tmux.conf will be created,
pointing to the copied .tmux.conf within the root of this package.

3.3 Vim


This basic config was grabbed from https://www.freecodecamp.org

If you choose to install this, a sym-link within your $HOME-directory named .vimrcwill be created,
pointing to the copied .vimrc within the root of this package.

3.4 Aliases


This is just a set of bash-aliases which were found useful over the time. Feel free to extend or change them by your flavor.

If you choose to install this, a sym-link within your $HOME-directory named .bash_aliases will be created, pointing to the copied .bash_aliases within the root of this package.

Among other things, aliases are included to give you quick access (VS-Code) to the different config files of this package as well as a shortcut to edit the windows hosts-file.

It also sets a new code for you PS1 promt. If you dont want this, just remove the last line in the .bash_aliases file.

If a $HOME/.bash_aliases-file already exists, the install-script will take care, that your current custom aliases
are prependet to those suggestet by this package. Your previous .bash_aliases is then replaced by the sym-link.

3.5 ChangePHP


This was created by the need of having a shortcut for this task in the meantime. Consider to use docker for instance.

If you choose to install this, a sym-link at /usr/local/bin/changePHP will be created,
pointing to the copied changePHP.sh within the root of this package.

3.6 Vhost


This was originally grabbed from https://github.com/RoverWire/virtualhost and adapted to the needs in WSL.

If you choose to install this, a sym-link at /usr/local/bin/vhost will be created,
pointing to the copied vhost.sh within the root of this package.

vhost will create or remove:

  • vhost directory
  • document-root directory (if specified) with phpinfo-file
  • apache2 vhost configuration
  • reloading apache2 (add or remove vhost from apache2)
  • open Windows hosts file in VS-Code for quick editing

3.7 wsl.conf


This file holds basic configuration for the WSL-distribution and was created using documentation. Extend or change it by your needs.

If you choose to install this option, a sym-link at /etc/wsl.conf will be created,
pointing to the copied wsl.conf within the root of this package.

Attention: If you are using this on a Win10 host, make sure to remove the last line of this file as it only works correctly with Win11
and can cause unexpected behavior on Win10.

3.7.1 resolv.conf


Attention: This is only for documentation and not an acutal feature of this install script.

If you encounter any network problems related to unresolvable names by DNS, check /etc/resolv.conf.
You may add some nameservers in the form nameserver 1.1.1.1 each in an new line.
Use wsl --shutdown in PowerShell to terminate WSL and restart it.
Check DNS-resolve by pinging an actual Domain ping heise.de.

3.8 wslIgnite.conf


This file is used to hold any configuration for the tools within this package.
Change it by your needs, expecally to make the vhost-script working if you don't have a default WSL-installation (different Linux-Distro, etc.).

Attention: Make sure that this file exists in the same directory as the actual tool-script-executables as they are searching for it next to themself.
But don't worry, the fact that executables are called as sym-links is covered.
So for exaple if you have the default /usr/local/bin/vhost => $HOME/wslIgnite/vhost.sh, vhost want's the wslIgnite.conf at $HOME/wslIginte/wslIgnite.conf.

3.9 ConfigPHP


This tool was createt to have a shortcut for editing the most importatnt things of a fresh installed php-version for local-development.

If you choose to install this, a sym-link at /usr/local/bin/configPHP will be created,
pointing to the copied configPHP.sh within the root of this package.

configurePHP will set the folowing directives at apache2/php.ini & cli/php.ini:

  • memory_limit : 1024M (not for cli-ini as it is -1)
  • post_max_size : 2048M
  • upload_max_filesize: 2048M

4. Manual Installation


4.1 wslIgnite-conf

$ cp $HOME/wslIgnite/fuel/wslIgnite.conf.example $HOME/wslIgnite/wslIgnite.conf
$ nano $HOME/wslIgnite/wslIgnite.conf

4.2 bash-aliases

$ cp $HOME/wslIgnite/fuel/.bash_aliases.example $HOME/wslIgnite/.bash_aliases
$ echo $HOME/wslIgnite/.bash_aliases >> $HOME/.bash_aliases
$ echo $HOME/.bash_aliases > $HOME/wslIgnite/.bash_aliases
$ rm $HOME/.bash_aliases
$ ln -sf $HOME/wslIgnite/.bash_aliases $HOME/.bash_aliases
$ nano $HOME/wslIgnite/.bash_aliases
$ source $HOME/.bashrc

4.3 tmux-conf

$ cp $HOME/wslIgnite/fuel/tmux.conf.example $HOME/wslIgnite/tmux.conf
$ ln -sf $HOME/wslIgnite/tmux.conf $HOME/.tmux.conf

4.4 vimrc

$ cp $HOME/wslIgnite/fuel/vimrc.example $HOME/wslIgnite/vimrc
$ mkdir -p $HOME/.vim $HOME/.vim/autoload $HOME/.vim/backup $HOME/.vim/colors $HOME/.vim/plugged
$ ln -sf $HOME/wslIgnite/vimrc $HOME/.vimrc
$ cd $HOME/.vim/colors
$ curl -o molokai.vim https://raw.githubusercontent.com/tomasr/molokai/master/colors/molokai.vim

4.5 vhost

$ cp $HOME/wslIgnite/fuel/vhost.sh.example $HOME/wslIgnite/vhost.sh
$ sudo ln -sf $HOME/wslIgnite/vhost.sh /usr/local/bin/vhost

4.6 changePHP

$ cp $HOME/wslIgnite/fuel/changePHP.sh.example $HOME/wslIgnite/changePHP.sh
$ sudo ln -sf $HOME/wslIgnite/changePHP.sh /usr/local/bin/changePHP

4.7 wsl-conf

$ cp $HOME/wslIgnite/fuel/wsl.conf.example $HOME/wslIgnite/wsl.conf
$ sudo ln -sf $HOME/wslIgnite/wsl.conf /etc/wsl.conf
$ nano $HOME/wslIgnite/wsl.conf

4.8 config.php

$ cp $HOME/wslIgnite/fuel/configPHP.sh.example $HOME/wslIgnite/configPHP.sh
$ sudo ln -sf $HOME/wslIgnite/configPHP.sh /usr/local/bin/configPHP

About

Configuration and tooling to set up a freh WSL-Distro

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages