This is a guide on how to configure Windows 10 using the Fall Creators Update released in October 2017. I will be using Ubuntu for the Linux Subsystem.
Ubuntu
- Turn on Windows Subsystem for Linux in the Windows Feature
- Restart Windows so it fully installs it
- Then go to the Windows Store app and download and install Ubuntu
- Launch it from the Windows Store screen. Terminal will open and will ask you questions to configure the environment such as username and password.
- You should update Ubuntu with the usual commands
sudo apt-get update
sudo apt-get upgrade -y - Install build essentials
sudo apt-get install build-essential -y
PHP7
Now your environment is up to date. The next step is to get PHP7 installed. Depending on the version of Ubuntu, you may not have access to the latest version of PHP. Just add a repository and install it. For this guide, I will be install PHP7.1.
- sudo apt-get install -y python-software-properties
- sudo add-apt-repository -y ppa:ondrej/php
- sudo apt-get update -y
- sudo apt-get install -y php7.1 php7.1-cli php7.1-common php7.1-mbstring php7.1-gd php7.1-mysql php7.1-mcrypt php7.1-zip php7.1-xml
NodeJS
- curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash –
- sudo apt-get install -y nodejs
Composer
Instructions can be found at https://getcomposer.org/download/. Please note, step 2 below changes. The hash value is generated automatically. Step 5 will move and rename the command so it is accessible throughout the environment. Step 6 will test it if it works.
- php -r “copy(‘https://getcomposer.org/installer’, ‘composer-setup.php’);”
- php -r “if (hash_file(‘SHA384’, ‘composer-setup.php’) === ‘[this is where the hash goes – do not copy this verbatim – go to the link above’) { echo ‘Installer verified’; } else { echo ‘Installer corrupt’; unlink(‘composer-setup.php’); } echo PHP_EOL;”
- php composer-setup.php
- php -r “unlink(‘composer-setup.php’);”
- sudo mv composer.phar /usr/local/bin/composer
- composer about
Laravel
Please be careful with copying and pasting. The quotes sometimes gets pasted with a different font – thus ending in a different result. After installation, make sure you add the path to your profile file (~/.profile) with step 3. If there’s already a line that exist, just add it. Keep in mind that each path is separated by a colon (:) and ends with $PATH.
- composer global require “laravel/installer”
- pico ~/.profile
- export PATH=~/.config/composer/vendor/bin:$PATH
- source ~/.profile
MySQL Server
Install MySQL server and follow the on-screen instructions. If the server is not started or you get a mysqld.sock error, you probably need to start the service. The command is in step 3.
- sudo apt-get install mysql-server -y
- sudo service mysql start
- sudo mysql_secure_installation
To help manage your database, download MySQL Workbench from https://dev.mysql.com/downloads/workbench/. You may need to download some prerequisite software from Microsoft.
Click on the Download Prerequisites button and it will take you to https://dev.mysql.com/resources/wb62_prerequisites.html. This page will list a couple of software but all I download is the Visual C++ Redistrubatble for Visual Studio 2015. Meeting that requirement seems to be enough for me. I download the 64bit version to match my operating system. Once installed, run the MySQL Workbench installer again and you should have no problem.
Create a new connection. The default values should work. All you have to do is provide the password.
Make sure that Ubuntu is running and that the MySQL service is also running or you won’t be able to connect.
That’s about it. I’m glad WSL is out of beta. So far it’s been running well.
I tried Virtualbox with Ubuntu workstation and after the Creator’s Update, it stopped working. I can log in but it won’t load the desktop on the console window. Oddly enough, the preview window shows the desktop loaded.
I also tried Homestead but I get an error with the shared folder. I run npm commands and it tells me that it can’t delete and write because of permission denied. I also tried Hyper-V and Ubuntu workstation is horrible on it. Moving the mouse lags. I’ve given it 2 CPU and 6GB of ram. I used different drivers – nothing.
I also posted a different way to develop Laravel on Windows check it out here. It works for the most part but it’s not as clean with SSH keys and GIT repositories. That article is actually pretty popular based on my analytics. I’m a bit surprised since I don’t really recommend using Windows for development unless you’re using Microsoft technology. It’s just a huge headache. We’ll see how well this environment last. Fortunately for me I have Apple computers and can run Ubuntu on spare hardware. This guide is just for my curiousity and to help others. Also, I like being able to use “better” hardware than my Apple devices.
Leave a Reply