Skip to content

Commit 2594c9f

Browse files
committed
Fully updated the README.md
Added rust to installation Fixed version reporting. Installing all software is optional. Can be performed later by user in Linux.
1 parent 1d2d9a7 commit 2594c9f

19 files changed

+127
-100
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
The MIT License (MIT)
2-
Copyright (c) 2019 Kai Salmen
2+
Copyright (c) 2021 Kai Salmen
33

44
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
55

README.md

Lines changed: 35 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
Automated WSL 2 Development Machine
1+
Automated creation of WSL 2 Development Machine
22
===
33

4-
Welcome to the WSL Tooling repository.
4+
Welcome to the WSL Tooling repository. The aim of this project is to supply with the ability to autpmatically install a fully working WSL 2 development environment just by invoking a powershell script even without the `wsl --install` flag.
55

6-
This is a guide for an almost automatic setup and configuration of Ubuntu LTS for Windows Subsystem for Linux V2.
7-
The aim is to create a development environment that combines the best of both worlds without the need for an extra Virtual machine.
6+
I have fully reworked and updated the whole installation. Once your Windows is capabale of running WSL 2 instances, the Ubuntu LTS WSL 2 installation is fully automatic.
87

98

109
## Preparation
11-
This repository must be available on your local disk.
10+
This repository must be clone on your local disk.
1211

1312
### Enable Windows Subsystem for Linux V2 support
1413
***This step is only required if WSL support was never activated before on your Windows machine***
@@ -30,62 +29,54 @@ Set the default WSL version to 2. Open a powershell with administrative privileg
3029
## Installation
3130

3231
### Download and Install Ubuntu LTS (20.04)
33-
If not already done, open a new powershell with administrative privileges and install Ubuntu LTS.
34-
You need to provide a name (`<wslName>`) of the new wsl,
35-
the directory (`<wslInstallationPath>`) where the vhdx disk of the new WSL is stored,
36-
and you need to provide a `<username>` of the default user:
32+
If not already done, open a new powershell with administrative privileges and install Ubuntu LTS. You **need** to provide four arguments. If you don't specify them on command line, then the script will ask:
33+
- `<wslName>`: Provide a name for the WSL that is goind to be created (e.g. `devbox`)
34+
- `<wslInstallationPath>`: The directory where the vhdx disk of the new WSL is stored
35+
- `<username>`: the name of the user that is used when WSL distro is launched without `-u`
36+
- `<installAllSoftware>`: Tell if all software packages (see [Available Software](#Available-Software)) shall be installed or if `false` only a fully updated system with configured user is supplied
37+
For example, the command can look as follows:
3738
```powershell
38-
installUbuntuLTS.ps1 <wlsName> <wslInstallationPath> <username>
39+
installUbuntuLTS.ps1 devbox D:\WSL2\devbox kai true
3940
```
4041

42+
### Available Software Package
43+
If don't want to install all packages during initial WSL creation, you can install them one buy one. They are available here [./scripts](./scripts). These are currently available
44+
- Ubunut Base Package (git virt-manager firefox dbus-x11 x11-apps make unzip) ([scripts/install/installBasePackage.sh](./scripts/install/installBasePackage.sh))
45+
- docker &docker-compose ([scripts/install/installDocker.sh](./scripts/install/installDocker.sh))
46+
- OpenJDK 11 ([scripts/install/installOpenjdk.sh](scripts/install/installOpenjdk.sh))
47+
- Apache Maven ([scripts/install/installMaven.sh](./scripts/install/installMaven.sh))
48+
- n (node manager), Nodejs, npm & Typescript ([scripts/install/installNodejs.sh](./scripts/install/installNodejs.sh)
49+
- Rust and Cargo ([scripts/install/installRust.sh](./scripts/install/installRust.sh))
50+
- Deno ([scripts/install/installDeno.sh](./scripts/install/installDeno.sh))
51+
- Google Chrome ([scripts/install/installChrome.sh](./scripts/install/installChrome.sh))
4152

42-
### Further information
43-
It is possible to have different distributions at the same time. Use this [resource from Microsoft](https://docs.microsoft.com/en-us/windows/wsl/wsl-config) as starting point for further reading.
4453

45-
## Configuration
46-
Inside the "Ubuntu 18.04" application change directory to where this repository has been checked out (all Windows drives are available under `/mnt`).
47-
Automatically pre-configure Ubuntu 18.04 with the following script [setupWslUbuntu1804.sh](setupUbuntuLTS.sh):
48-
- It updates the system and removes unnecessary packages afterwards
49-
- It installs OpenJDK-8, Apache maven 3.6.x, node.js LTS from nodesource and makes them available system wide
50-
- It configures dbus for XServer usage including setup of environment variables in `/etc/profile.d`
51-
- It install git, virt-manager and firefox
52-
After the setup is complete and you restarted Ubuntu, Windows drives are available at `/` (e.g. `/c/Windows`).
54+
Firefox and other tools can be installed directly with Ubuntu's package manager `apt`. Some of the above scripts also use `apt` and apply additional configuration.
5355

54-
**Hint:** Firefox does not work properly with remote X. Set `browser.newtab.preload` to `false` in `about:config` to fix this issue."
56+
#### Removal
57+
Not available yet, but with fast a internet connection and fast SSD you have the WSL recreated in approx. five minutes. :sunglasses:
5558

56-
### Available Scripts
57-
More scripts are available for automated installation and configuration in the [./scripts](./scripts) directory:
58-
- maven ([scripts/install/installMaven.sh](./scripts/install/installMaven.sh))
59-
- Docker to be connected to Docker for Windows ([scripts/install/installDocker.sh](./scripts/install/installDocker.sh))
60-
- nodejs ([scripts/install/installNodejs.sh](./scripts/install/installNodejs.sh)
61-
- Google Chrome (buggy, disabled for now) ([scripts/install/installChrome.sh](./scripts/install/installChrome.sh))
62-
- OpenJDK 8 ([scripts/install/installOpenjdk8.sh](scripts/install/installOpenjdk.sh))
6359

64-
Firefox and other tools can be installed directly with Ubuntu's package manager `apt`. Some of the above scripts also use `apt` and apply additional configuration.
60+
## Usage
6561

66-
This list will be expanded in the future.
62+
### X-Server
63+
I recommend to use [VcXsrv](https://sourceforge.net/projects/vcxsrv/) (also available via chocolatey) to connect to user interfaces launched from WSL on display 0. The WSL linux setup configures everything properly. Use the following Powershell script to launch (it assume vcxsrv is installed at default location `C:\Program Files\VcXsrv\vcxsrv.exe`):
64+
```powershell
65+
.\scripts\xserver\xerver.ps1
66+
```
6767

6868
### Certificates
6969
Copy any certificates you require under `/usr/local/share/ca-certificates/` and the run the command:
7070
```bash
7171
sudo update-ca-certificates
7272
```
7373

74-
## Windows Integration
75-
76-
### X-Server
77-
Use [VcXsrv](https://sourceforge.net/projects/vcxsrv/) to connect to user interfaces launched from WSL on display 0. The setup configures everything properly. Just use the XLaunch in Mulit-Window mode and you are ready to go.
78-
79-
### Lauch shell scripts
80-
Set WSL as default bash execution:
81-
https://superuser.com/questions/1260528/associating-linux-shell-sh-scripts-on-windows-10-to-bash-or-wsl
82-
83-
### Console Emulator
84-
Use a console emulator like [ConEmu](https://conemu.github.io/) for a better working environment.
85-
86-
## Known issues
87-
When you use a VPN the wrong primary name resolution host is likely contained in `/etc/resolv.conf`. Comment the home/local address DNS host preventing proper name resolution in the connected VPN network.
74+
## Misc
75+
- My Terminal recommendation in 2021 clearly is [Microsoft Terminal](https://github.com/microsoft/terminal)
76+
- Overview of [WSL commands and launch configurations](https://docs.microsoft.com/en-us/windows/wsl/wsl-config)
77+
- For Development wiht Visual Studio Code use the `Remote - WSL` extension
8878

79+
Constructive feedback is appreciated!
8980

9081
Have fun!
9182

installSoftware.sh

Lines changed: 0 additions & 30 deletions
This file was deleted.

installUbuntuLTS.ps1

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
Param (
2-
[Parameter(Mandatory=$True)]
3-
[ValidateNotNull()]
4-
[string]$wslName,
5-
[Parameter(Mandatory=$True)]
6-
[ValidateNotNull()]
7-
[string]$wslInstallationPath,
8-
[Parameter(Mandatory=$True)]
9-
[ValidateNotNull()]
10-
[string]$username
2+
[Parameter(Mandatory=$True)][ValidateNotNull()][string]$wslName,
3+
[Parameter(Mandatory=$True)][ValidateNotNull()][string]$wslInstallationPath,
4+
[Parameter(Mandatory=$True)][ValidateNotNull()][string]$username,
5+
[Parameter(Mandatory=$True)][ValidateNotNull()][string]$installAllSoftware
116
)
127

138
curl.exe -L -o .\staging\ubuntuLTS.appx https://aka.ms/wslubuntu2004
@@ -24,12 +19,15 @@ Remove-Item .\staging\$wslName.zip
2419
Remove-Item -r .\staging\$wslName\
2520

2621
# Update the system
27-
wsl -d $wslName -u root -e scripts/install/installBasePackages.sh
22+
wsl -d $wslName -u root -- apt update`; apt upgrade -y
2823

2924
# create your user and add it to sudoers
3025
wsl -d $wslName -u root -e scripts/config/system/createUser.sh $username
3126

3227
# ensure WSL Distro is restarted when first used with user account
3328
wsl -t $wslName
3429

35-
wsl -d $wslName -u $username -e ./installSoftware.sh
30+
if ($installAllSoftware -ieq $true) {
31+
wsl -d $wslName -u root -- ./scripts/install/installBasePackages.sh
32+
wsl -d $wslName -u $username -- ./scripts/install/installAllSoftware.sh
33+
}

scripts/config/local/configureDbus.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
dbus_status=$(service dbus status)
44
if [[ $dbus_status = *"is not running"* ]]; then

scripts/config/local/configureDeno.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
export DENO_INSTALL="~/.deno"
44
export PATH="$DENO_INSTALL/bin:$PATH"

scripts/config/local/configureJvmEnv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
UPDATED_PATH=${PATH}
44

scripts/config/local/configureN.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
# Added by n-install (see http://git.io/n-install-repo).
44
export N_PREFIX="$HOME/n"; [[ :$PATH: == *":$N_PREFIX/bin:"* ]] || PATH+=":$N_PREFIX/bin"

scripts/config/system/prepareXServer.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ modifyBashrc "configureDbus.sh" ". ${HOMEDIR}/.local/bin/env/configureDbus.sh"
1212

1313
copyConfigureScript "configureXServer.sh"
1414
modifyBashrc "configureXServer.sh" ". ${HOMEDIR}/.local/bin/env/configureXServer.sh"
15-
addSudoers "${USERNAME} ALL=(root) NOPASSWD: ${HOMEDIR}/.local/bin/env/configureDbus.sh" "${USERNAME}_configureXServer"
15+
addSudoers "${USERNAME} ALL=(root) NOPASSWD: ${HOMEDIR}/.local/bin/env/configureDbus.sh" "${USERNAME}_configureDbus"

scripts/install/.installUtils.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ modifyBashrc () {
1212
echo ${writeString} >> ${HOMEDIR}/.bashrc
1313
. ${HOMEDIR}/.bashrc
1414
else
15-
echo "${HOMEDIR}/.bashrc is already properly configured."
15+
echo "${searchFor}: ${HOMEDIR}/.bashrc is already properly configured."
1616
fi
1717
}
1818

0 commit comments

Comments
 (0)