"Want to spin up Ubuntu VMs from Windows 10's command line?" - God no! That sounds horrible! I want to start in Linux and end in Linux. I don't care what distro.
Want to spin up Ubuntu VMs from Windows 10's command line, eh? We'll need to see a Multipass
Windows 10 developers have been gifted yet another way of running Linux on their desktop in the form of Canonical's Multipass. Users of Microsoft's OS have been spoiled for choice as the software maker has sought to persuade developers that these days it prefers to snuggle up to rather than stomp on penguin-based life. …
COMMENTS
-
-
Tuesday 22nd January 2019 11:29 GMT Jason Bloomberg
I want to start in Linux and end in Linux
Then this is not for you. However not everyone wants to start in Linux and end in Linux nor has the luxury of being able to do so.
I can understand how some Penguinistas aren't happy about Windows still keeping its foot in the door but that's the reality of how things are. I primarily develop for Windows as that's the bigger market for what my company produces but we also support Linux and WSL has been a real boon in assisting with that. And Multipass may help some more.
-
Tuesday 22nd January 2019 11:29 GMT naive
I love WSL, since it made scripting on Windows usable after 30 years :)
WSL can also use Windows *.exe files.
/mnt/c/Windows/System32/systeminfo.exe | grep -i "System boot" | awk '{print $4}' | sed 's/,//'
10-1-2019
The elegance and simplicity of bash scripting is hard to beat.
Try that in PowerShell.
-
Tuesday 22nd January 2019 12:10 GMT Spoonsinger
Re: Try that in PowerShell.
The term '/mnt/c/Windows/System32/systeminfo.exe' is not recognized as the name of a cmdlet, function, script file, oroperable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:39+ /mnt/c/Windows/System32/systeminfo.exe <<<< | grep -i "System boot" | awk '{print $4}' | sed 's/,//' + CategoryInfo : ObjectNotFound: (/mnt/c/Windows/System32/systeminfo.exe:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
All looiks good to me :-)
-
-
Tuesday 22nd January 2019 13:45 GMT barstewardsquad
Re: I love WSL, since it made scripting on Windows usable after 30 years :)
There are probably simpler and more elegant ways but this works for me.
date([management.managementdatetimeconverter]::ToDateTime((Get-WmiObject win32_operatingsystem).LastBootUpTime)) -Format dd-M-yyyy
I would normally do the date as yyyyMMdd but wanted to match it to the OP's format.
Mine is the one with a windows VM on linux because Azure modules don't work properly on Linux Powershell
-
Tuesday 22nd January 2019 19:17 GMT doublelayer
Re: I love WSL, since it made scripting on Windows usable after 30 years :)
Powershell is nice and powerful, it can do a lot of the scripting things that CMD couldn't do before, but could they make the commands shorter? When I've written PS code, I've either ended up with monstrous lines of code to run a few commands or I store everything (really everything) in a bunch of confusingly-named temporary variables in the interest of readability. I know you can have long and terrible lines in shell scripts too, but they're less common in my experience.
-
Wednesday 23rd January 2019 14:04 GMT phuzz
Re: I love WSL, since it made scripting on Windows usable after 30 years :)
You can use aliases in pretty much the same way as you would on Linux, but yes, by default the command names are verbose.
Perhaps the Windows devs still haven't calmed down from finally being able to use more than 8.3 filenames?
-
-
Tuesday 22nd January 2019 21:40 GMT Anonymous Coward
Re: I love WSL, since it made scripting on Windows usable after 30 years :)
$(Get-CimInstance -ClassName win32_operatingsystem).lastbootuptime | get-date -format d
Which gives you (as a date-time object):
1/22/2019
Or, I can use systeminfo, grab the line I want, split it and pick out the bit I want from that:
$(systeminfo.exe | Select-String "System Boot Time" | out-string).Split(" ,")[12]
1/22/2019
(Computer is in US, so date format is wrong).
-
Wednesday 23rd January 2019 14:02 GMT phuzz
Re: I love WSL, since it made scripting on Windows usable after 30 years :)
Try that in PowerShell.
Ok then:
Get-CimInstance -ClassName win32_operatingsystem | select lastbootuptime
(Note how instead of having to manipulate strings using multiple programs, we just grab the one field we're interested in, which is returned as a DateTime so we don't have to reformat it if we wanted to use it in a script.)
-
-
-
-
-
This post has been deleted by its author
-
-
-
Tuesday 22nd January 2019 12:25 GMT RuffianXion
Webservers?
Quick question to all of you. Would I be able to use one of these Ubuntu VMs to operate a LAMP web server from my WIn10 desktop? It wouldn't need to be always on as I'd only use it for testing websites in development and enabling clients to view WIP sites. I currently use a repurposed old E-Machines PC as my test server, but it would be nice to not have to have a separate box.
-
Tuesday 22nd January 2019 13:52 GMT naive
Re: Webservers?
With the default WSL it is simple:
apt-get update
apt-get install apache2
Add website in the apache configuration.
service apache2 start
Before using apt-get, it maybe necessary to set the proxy
export http_proxy=http://<addres>:port
export https_proxy=http://<addres>:port
Maybe Windows firewall may have to be setup to allowing incoming port 80/443 traffic.
-
-
Tuesday 22nd January 2019 19:22 GMT doublelayer
Re: Webservers?
Quick answer: yes.
Long question: Why? You could run any OS with webserver in your VM solution of choice. You could exactly virtualize your server environment and share the network connection, thus having local access. If it is a server you don't mind setting up, you could also run apache and any other dependencies (definitely MySQL and PHP but a lot of other tools are supported) directly on windows. I've done it*, and setup is very fast and it works the same unless you have some specifically Linux backends.
*We needed an internal server. They put the windows image on a machine and put it somewhere I couldn't change it. What was I going to do?
-
Wednesday 23rd January 2019 03:05 GMT 000whacksplat
Re: Webservers?
I’m an engineer for a large enterprise cloud backup and recovery platform. Before this project I had never seen much beyond the basic VM setups. But our customers have some very cool and imaginative VM configurations. Trying to figure out how to support backing all of this data up on the guest and host levels to allow for everything from a single file revision recovery to a bare metal recovery has taught me so much about what can be done with VMs. (It has also taught me that VMware makes strong people openly weep.)
-
-
Tuesday 22nd January 2019 19:43 GMT katrinab
Re: Webservers?
I’m sure it is just fine for what it needs to do. I have a 9yo Proliant Microserver which definitely wasn’t the fastest around when I bought it. It’s fine, except that it only has a VGA monitor port, and I’d like to throw out the old monitor I keep in the cupboard in case I am unable to connect to it remotely.
-
Thursday 24th January 2019 11:18 GMT Smoking Man
Re: Webservers?
I remember a customer engineer connecting hist notebook to a server vga (and keyboard/mouse) port with this device:
https://www.startech.com/Server-Management/KVM-Switches/Portable-USB-PS-2-KVM-Console-Adapter-for-Notebook-PCs~NOTECONS01
Enables a laptop to act as a KVM device. Nice and useful gimmick, just not the cheapest one.
-
-
Wednesday 23rd January 2019 12:22 GMT stungebag
Re: Webservers?
I've got several LAMP VMs on an external SSD that I do web development on in Hyper-V. No special distros or integration needed. I use FTP to get stuff in and out and the Linux console where necessary. A much cleaner solution than running the servers directly on your Windows box.
Hyper-V makes it very easy to open several simultaneous consoles and, with snapshots, you can work on several parallel projects on the same VM.
I find Hyper-V works well, but there's always Dropbox if you prefer.
-
Tuesday 22nd January 2019 13:39 GMT Anonymous Coward
Nothingburger
This doesn't look like a big advance over using az-cli on WSL or even in a VirtualBox or VMware VM (Hyper-V crashes my company provided Win 10 machine, which I'd like to blame on the usual corporate controlled ecosystem being predictably behind by several builds, but have also experienced in both the latest stable and previews on our home systems -- Hyper-V is just NRFPT on the desktop). Of course both stumble badly over the Windows filesystem when their userlands have to interact directly with files "on the other side", as they lack the compensating bits available in free tools like Git for Windows. But maybe that's just my tied-to-Windows-by-corporate-decree workflow. Not that it really matters, only a select few Windows admins have access to our Azure account anyway, and I doubt they'd know a container if it bit them on the a**. Not blaming them really, it's MS that rolled out an accounts platform that assumes everyone who uses it can sign up with their own Corporate Card and rack up $100's in service charges a day _while in development_. Then they wonder why AWS is still eating their lunch.
-
This post has been deleted by its author
-
Wednesday 23rd January 2019 03:03 GMT W. Anderson
backward concept
The clear case has never been made for installing Linux or a Linux subsystem "inside" Windows 10 as the convoluted process as described above leaves everything to be desired.
On the other hand, installing Linux as a "dual boot" in it's own parttion on a Windows 10 computer has proven to be simpler and significantly more efficient and reliable than the nonsense explained in this article.
The whole concept of Linux "inside" Windows is cogently noted by statement from an IBM Fellow some years ago as (paraphrasing) "building a stone or brick house (Libux) on a wood or twigs foundation (Windows). Nonsensical in it's core precept".
Windows only users certainly need to get a life.
-
Wednesday 23rd January 2019 09:53 GMT Teiwaz
Re: backward concept
Another way of running 'Linux on Windows......
It just seems to me to be another example as to how the world in general has everything ass-backwards.
OK, I don't use Windows an awful lot, but when I do, I seem to be put through at least a reboot or two before I can start, and one other during the course of the day, for one reason or another.
-
-
Wednesday 23rd January 2019 16:00 GMT TiddlyPom
Why use Hyper-V or even Windows for that matter?
Alternatively you could run VMs in VirtualBox (on Windows) and not bother with Hyper-V at all or you could install Docker for Windows and use containers instead. Even better you could not bother with Windows at all, run a Linux distribution as your main OS (Linux Mint, Ubuntu, Fedora, openSUSE - have a look at DistroWatch for ideas) and run Windows as a VM when you have to and use KVM (which is more efficient than either Hyper-V or VirtualBox). I have been running Linux as my main OS for over a decade now and would never look back. Not for everybody but works for me.
-
Wednesday 23rd January 2019 17:26 GMT cdegroot
Re: Why use Hyper-V or even Windows for that matter?
Docker for Windows/Mac (it really doesn't matter) is super slow. Comparable with WSL - disk access is emulated and that just puts the handbrake on things. I've tried various approaches for developing on my Win10 laptop (because games, Lightroom, and so on), and I settled on running a full-screen Linux under Hyper/V on a second virtual desktop. It's very fast.
I don't think KVM is more efficient than Hyper-V - both are, AFAIK, hypervisors rather than oldskool virtualization engines and performance should be ballpark the same. Whether you boot Win10 or Linux first shouldn't make too much difference because from the point of view of the hypervisor it ends up being just another client OS and Linux-under-Hyper-V-under-Windows and Windows-under-KVM-under-Linux both have a root hypervisor and then two OSes running underneath that. At least, that's what I understood about this whole business when I last checked how stuff worked :-)
Back on topic: I really don't like Hyper-V's management UI, so this will hopefully help.
-
-
Wednesday 23rd January 2019 16:41 GMT cmaurand
I see all your points, but ...
I have two solutions in place. I have a windows machine running virtualbox. commandline, folder sharing, gui, etc. I've been using it for years. so to multipass...yawn. The second solution is a small machine that is running Ubuntu 18.04 LTS with KVM installed. I have Windows installed in a virtual machine for whatever I might need out of Windows. None of my old copies of Office will activate any longer, but OpenOffice and LibreOffice fill that void along with Thunderbird for email. I'm not in want. I have an app for my Canon DSLR which will only run on Windows or Mac so that's why the virtual. The only thing that doesn't work on Linux is Spectrum''s flash app that it uses for it's streaming service. I'm not missing anything there.