
Trying to develop large and medium PHP projects on Windows, in my opinion, is not entirely correct. Therefore, if PHP development is your main occupation, then most likely you have been on a Linux machine on a working machine for a long time and you do not know grief. But if for some reason you are also, like me, stuck to Windows, but you need to work with web projects, this article will help you set up and run a 100% full-fledged web development environment with any Linux software suite, docker, and with all this beautifully integrated into Windows.
Spoiler - for those who are too lazy to read a lotAfter years of working under all sorts of Denwer / OpenServer, tormenting with native Windows docker, VirtualBox, trying to use the Ubuntu subsystem in Windows and so on and so forth ... I finally found a bundle of software that allows you to raise a flawless Linux system on top of Windows and make working inside Linux is as organic as working with any Windows application.
')
And so, this
- VMware Player 7 to create a virtual machine
- Xubuntu 14.02 64-bit as a Linux subsystem
- VMware Tools
- VMware Unity mode
- A few simple settings to make everything convenient (see below)
Below is all the same, but deployed ...
A little history of TL DR
Once upon a time there was
Denver , Far manager and FTP. That was enough. Then ssh, git, phing, composer were connected - but all this anyway, with small dances with a tambourine, it was possible to configure in Windows and continue to live in the happy world. It was extremely simple, clear and easy.
Such a happy time lasted quite a long time. But at some point, the frantic race for new technologies started, which every year only gained momentum. Denver did not have time and did not want to keep up with the release of new versions of PHP, projects grew and became more complicated, the technology zoo multiplied in front of our eyes.
The salvation for some time was
OpenServer . Very adequate solution for Windows with a large number of tools and quite current software versions. It managed to hold out for several years. If you are a novice developer, sticking to Windows, if you have relatively simple projects, or web development is not your main occupation, then the choice in favor of OpenServer can be a very good solution for you. Simple, convenient and understandable.
But the technology zoo in our company continued to grow - nodeJS, elastic, different versions of PHP for different projects - from 5.6 to 7.1. A PHP 7.1 project started, but OpenServer does not keep up ... At the time of this writing, 7.1 support is already there, but it wasn’t. Yes, and update OpenServer lesson is not very pleasant, because with portability settings between versions they have a hard time.
A little poke, googled more advanced counterparts OpenServer. I did not find anything intelligible. Well, threw this thing, because For medium and large projects with lots of dependencies, this development path seems to be a dead end.
Ubuntu subsystem in Windows 10?
An attempt was made to configure the Ubuntu subsystem on Windows. Stumbled, tried to install and configure something. It does not work, it is buggy, you will not find intelligible documentation.
Docker on Windows?
I had to upgrade my home version to a professional to make everything work natively. A few days back with the settings, reconfiguration, settings. Well, plus dive into the docker. Works!
Seriously, the docker on Windows works quite well, and will most certainly go for small and medium-sized projects. At me all rested against file system performance in shared volumes. This bug has long been known and well described, for example, it appears on Windows and Mac.
In practice, on my machine with an SSD disk, it looked like this - opening the start page immediately after the default installation of Symfony 3 took an average of 1.5 seconds. The project on which I had to work, the simplest page opened for about 10-15 seconds, some heavy pages did not open at all. To work in such conditions I considered unreal.
There is a
docker-sync project, which is designed to solve the problem with the speed of the file subsystem. Instead of using shared volumes, docker-sync organizes bidirectional file synchronization between your local system and docker containers. Unfortunately, I never had a chance to try docker-sync in real work. By that moment, I was tired of the abundance of crutches with which my configuration of the development environment on Windows had overgrown and decided to give the virtual machines a chance again.
Virtual machine
“This is something to begin with!” The advanced reader will say, and will be almost right.
Of course, in the entire history of my web development on Windows, I have repeatedly tried to switch to using virtual machines. But none of those attempts were successful due to the significant deterioration of the User Experience, which I received when using virtual machines. I don’t know what it is connected with, maybe with the drawbacks of VirtualBox, which I used, maybe with crooked hands and laziness, but the fact remains that I tried Linux in VirtualBox, ran into some problems one by one, spat, threw everything and came back to your cozy windows.
Once again, turning to virtualization, I found a very promising instruction on installing Linux on the free version of WMVare Player.
The minimum set of requirements for a virtual machine for comfortable work looked like this:
- adequate speed
- Work with Linux applications as well as with normal Windows applications (unity mode in WMvare or Seamless mode in VirtualBox).
- normal clipboard operation between the host machine and the virtual machine in both directions
- shared files without brakes with synchronization in both directions
- full Linux environment with all the features, incl. nested docker virtualization
- Extremely desirable is a simple setup without dancing with a tambourine and searching for crutch solutions.
And now, finally, the stars came together in this version of the use of software:
- VMware Player 7.x. Necessarily need the 7th version. Later versions do not support Unity mode for Linux. Those. It is also possible to use it, but it will not be as convenient as with 7th. VMware Player is free for non-commercial use. Download the version you need by the link.
- As a guest Linux system, we take xubuntu 14.02 64-bit. You can download it here.
- After creating a virtual machine and installing the OS, you need to install VMware Tools. VMware itself will remind you of this during installation and after, but if you missed this point, then to install, click on the Player menu, then Manage and select Install VMware Tools.
- With VMware Tools, we can translate our virtual machine into Unity mode, and on any Linux application, create shortcuts on the desktop or pin it to the taskbar, just like a regular Windows application.
For even greater enjoyment of work, you should perform several additional settings of the virtual machine. To do this, in the Player, Manage menu, select Virtual Machine Settings. There inside
- Hardware, Network Adapter. Select the Bridged connection mode and check the Replicate physical network connection state option. In this mode, the virtual machine will look like a computer connected to your local network, and when you restart the machine, it will try to save its old IP address.
- In the Options tab, you can set up shared folders between yours and the virtual machine. Shared Folders are disabled by default.
- Well, in Options, Unity, you can uncheck Show Shows and Show badges, so that Linux windows do not stand out from the rest. Although it is not necessary.
So in a few pretty simple steps, we got a near-perfect Linux development environment that runs inside a virtual machine. At the same time, for us, any application from a virtual machine looks as if it is running in a Windows environment.
I really hope that you managed to install xubuntu in a virtual machine on your own, as well as cope with setting up the necessary software to run your web projects on Linux. To do this, simply follow any installation instructions for Nginx, Apache, MySQL, PHP and other applications on Ubuntu. Either use Docker, as I do now.
By the way, the application that I ran for 15 seconds and more in the docker containers on Windows, in a virtual machine, executes seconds in 3, i.e. 5 times faster. Of course, I would like more speed, but for now this is the best option I have found, and it is very convenient.
This article is largely based on material from
this video . If you want to see the full step-by-step instructions for installing and configuring a virtual machine, I recommend viewing it. Language - English, the author of the video - Nick Janetakis.