A clean install with WSL2 / Ubuntu 20.10 for developers : PHP / Node.js / Rust / Others
- Add WSL2 and update to latest ubuntu version
- Optional - Install zsh & oh-my-zsh
- Update nano
- PHP
- Volta
- Rust & cargo
- Other tools
sudo apt update && sudo apt upgrade -y && sudo nano /etc/update-manager/release-upgrades
Change lts to normal.
Reboot WSL with wsl --shutdown
in powershell/cmd.
sudo do-release-upgrade
Answer yes to each question, Ubuntu will restart by itself.
You can now check your version with lsb_release -a
.
sudo visudo
Replace %admin ALL=(ALL) ALL
by %admin ALL=(ALL) NOPASSWD: ALL
.
https://docs.microsoft.com/fr-fr/windows/wsl/wsl-config
sudo nano /etc/wsl.conf
[interop]
enabled=false # enable launch of Windows binaries; default is true
appendWindowsPath=false # append Windows path to $PATH variable; default is true
[wsl2]
swap=0
In Powershell: wsl --shutdown
.
sudo apt install zsh && chsh -s $(which zsh) && sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
/!\ You need to have the clock correctly configured.
You need gcc
, libncurses-dev
and make
packages.
sudo apt install gcc libncurses-dev make
Uninstall nano, its dependencies and its config files. Does not affect personal files and the logs.
sudo apt-get autoremove --purge nano
wget https://www.nano-editor.org/dist/v5/nano-5.6.tar.gz && tar -zxvf nano-5.6.tar.gz && cd nano-5.6
./configure && sudo make install
cd .. && sudo rm -rf nano-5.6 nano-5.6.tar.gz
Add ppa:ondrej/php to always get the latest PHP version available.
sudo add-apt-repository ppa:ondrej/php && sudo apt update && sudo apt upgrade -y
Install PHP with a specific version.
sudo apt install php8.0 -y
Add the extensions you want. Unzip is used by composer.
sudo apt install php-{amqp,apcu,curl,gd,intl,mbstring,mysql,pgsql,redis,sqlite3,xdebug,xml,zip} unzip -y
https://doc.ubuntu-fr.org/php#modules
nano /etc/php/8.0/cli/php.ini
Install a utility for manipulating .ini files.
sudo apt install crudini
Now you can easily edit your configuration. Example:
sudo crudini --set /etc/php/8.0/cli/php.ini Date date.timezone "Europe/Paris"
sudo crudini --set /etc/php/8.0/cli/php.ini PHP realpath_cache_ttl 600
curl -sLO https://github.com/gordalina/cachetool/releases/latest/download/cachetool.phar && chmod +x cachetool.phar && sudo mv cachetool.phar /usr/bin/cachetool
https://github.com/phpbrew/phpbrew#requirement
wget -O composer-setup.php https://getcomposer.org/installer
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
curl https://get.volta.sh | bash && source ~/.bashrc && volta install node yarn
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh && source $HOME/.cargo/env
Git is already installed. Just think to configure your .gitconfig and global .gitignore.
Docker is already available if Docker Desktop is installed on windows and use WSL2 engine.
curl -sS https://get.symfony.com/cli/installer | bash && sudo mv $HOME/.symfony/bin/symfony /usr/local/bin/symfony
See all versions:
npm -v && yarn -v && php -v && composer -V && docker -v && docker-compose -v && git --version && cargo -V
httpie & jq
sudo apt install httpie jq
bat https://github.com/sharkdp/bat
sudo apt install bat && sudo ln -s /usr/bin/batcat /usr/bin/bat
exa https://github.com/ogham/exa Build from source to get latest features.
git clone https://github.com/ogham/exa.git && cd exa && cargo build --release
sudo cp target/release/exa /usr/bin/exa && cd .. && rm -rf exa