[Script] Turn your Linux VPS/Server into Windows Server automatically using Shell script

askbhimani

Newbie
Joined
Feb 26, 2015
Messages
5
Reaction score
0
My be one way, it is possible
For that you have to install any VNC Server software on your VPS/Dedi
search on Google or Youtube with "install vnc server on windows" for more details.
I already tried vncserver on windows but it doesn't work.
 
Last edited:

askbhimani

Newbie
Joined
Feb 26, 2015
Messages
5
Reaction score
0
Open Source Github Project/Repository URL :
https://github.com/mediabots/Linux-to-Windows-with-QEMU

A Shell Script for Auto installation of Windows Server into a Linux Server.

A Shell Script to Auto install Windows Server on your Linux System. [Right now, it supports 2012 R2 < evaluation/180 days trial > copy]

Script would use QEMU-KVM portable software for Virtualization purpose. Since QEMU is a portable s/w, so it can reside in temporary RAM.

Actually script is semi-automatic. All Linux commands part(such as downloading Windows ISO image, gathering system info, choosing disk/partition, managing RAM , attaching required windows s/w in CDROM) would be handled by script automatically.

And rest of the windows part(clicking, selecting, setting Administrator password ) need to be done manually by any Free VNC windows software.

After Windows Installation completed, you would find a Power Shell script under CD-ROM, called "EnableRDP.ps1". By running it you would be able to enable Remote Desktop on your Windows server, so after that you would be able to connect your Windows server through Windows "Remote Desktop Application" App :)

I also attached Firefox App on CD-ROM, install that, so you don't need to face "Internet Explorer" horrible setting experience!


Requirements

A SSH client such as Putty : https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

A VNC software such as RealVNC : https://www.realvnc.com/en/connect/download/vnc/

A VPS or Dedicated server with Ubuntu OS Installed.

At least 30GB Free disk space in your system.

Virtualization of your VPS or Server must be enabled. Run below coammnd :

Code:
echo $(egrep '^flags.*(vmx|svm)' /proc/cpuinfo | wc -l)

if output is greater than 0, then Virtualization is enabled :D

Either should have access of root user OR run with su (super user)

How to Run the Script

Just run below five commands one after another :
Code:
su

mkdir /media/script && mount -t tmpfs -o size=1m tmpfs /media/script

wget -P /media/script https://raw.githubusercontent.com/mediabots/Linux-to-Windows-with-QEMU/master/mediabots_Ubuntu-to-Windows.sh

chmod +x /media/script/*

/media/script/mediabots_Ubuntu-to-Windows.sh

Screen-shots step by step

1) Download Putty(SSH client) from here : https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
2) Run Putty.exe file and connect to your Linux Server IP address (with port 22)
lPVhvhm.png

Login with your Linux Server Credential.
3) Run the Script. [ Read -> "How to Run the Script" section of this topic ]
KGejlQu.png

4) If your Server/VPS RAM size > 5 GB
Script would ask , whether you would like to delete existing Linux OS or not
-> I opted for [No]
LFwowrx.png

Script has done its work
5) now Download & install VNC [ https://www.realvnc.com/en/connect/download/viewer/ ]
and open your VPS/Server IP with port 0
Tc6NAGt.png

in my case my VPS IP was 51.15.229.233
4) Now you would see, Windows installation is on the process
k2tLHAR.png

5) Click/Choose options which I highlighted
5m02t3j.png

mpixbrf.png

Choose "Windows Server 2012 R2 SE (with GUI)"
Qk8W93v.png

yllbhw7.png

PRydybd.png

eksRoWZ.png

KOdQxNn.png

Set password for user : Administrator
Create a 16 to 20 Character long strong password
VsEPiSI.png

dLJze9n.png

login to Windows Server with your password
v9zWnwj.png

tR6CXfk.png

Windows Server installed successfully :D
W7olVM3.png

Enable Remote Desktop through ebableRDP.ps1 power shell script
Also install Firefox for browsing
TXKbKTX.png

In case .ps1 script prompt like this
BT2bQOz.png

press Y and Enter
---
Job Done :)
Enjoy
-------------------------------------------------------

Demo Video


or

https://bit.ly/Linux-to-Windows

Disclaimer

For few cases, due to RAID configuration of the hard disk, if you had chosen to delete existing Linux OS & install Windows OS on entire hard disk. On your VNC , you might see, Windows installation failing.

If you are facing such issue; Exit from the script & Re-run it & in this time just opt for installing Windows OS without deleting Linux OS. And it would work :D

In case, portable QEMU-KVM app stopped/closed, your Widows-Server would not be accessible. To access it again, you require to run the QEMU-KVM app again with proper parameters.

Run below command :

Code:
cat /details.txt

Copy the Output of the above result and Paste it & press Enter button. It would run the QEMU-KVM again. So your Windows Server would be accessible again :D

If you required a reboot of your Windows Server, just reboot it from Windows Server reboot option. Don't reboot your server from Server Hosting Control-panel. Otherwise QEMU App would get stopped.

If you had opted for removing your old Linux OS, you would get Windows server with full HDD capacity. But RAM would not be full, because QEMU resides on RAM.

Updates

Right now, Script supporting Ubuntu Distro only.

But very soon I would add the support for all popular Linux Distros too.

So stay tuned.

--
Hope you guys like it.
If you are a developer, you are welcome to contribute in the project

Feel free to ask any question

Don't forget to share your thoughts

Thank you
Hello Sir,

How to predefine RAM size and CORE size for windows in this script?
I have 8 GB RAM 4 CORE Ubuntu VPS so if i want to keep my windows ram size 6 GB and CORE size 2 so how is it possible?
 
Last edited:

sohom

Supreme Member
Joined
May 26, 2013
Messages
1,315
Reaction score
607
Website
www.mediabots.net
I already tried vncserver on windows but it doesn't work.

of course it would work. You have to follow right guide.
I have not tested, since I never required once. But from Internet search, I can say, it is possible.
So search hardly on Google & Youtube. You might find a solution too.

Hello Sir,

How to predefine RAM size and CORE size for windows in this script?
I have 8 GB RAM 4 CORE Ubuntu VPS so if i want to keep my windows ram size 6 GB and CORE size 2 so how is it possible?

I am guessing, you have not chosen "delete my existing Linux OS" option during installation of the script.
In that case if you are a general Linux user, kill current QEMU-KVM process id.
Otherwise, Reboot your Linux OS.

Then, on your Linux system, where you have installed Windows OS.
Run below command:
cat /details.txt
it would give you full command to run the Windows OS.

Now change two parameters :

1)For CPU Cores:
-M pc -smp cores=4
change from "cores=4" to "cores=2" or whatever(<5)

2)For RAM
-m 7xxxM
change from "7xxxM" to 6144M

Note- here xxx can be any number

After changing those two parameters, you would have a new quemu-kvm command.
Now, run that updated quemu-kvm command
 
Last edited:

makeenithar

Newbie
Joined
Dec 1, 2020
Messages
13
Reaction score
0
thank you so much for the wonderful tutorial. Anyhow, i am wonder can we install windows 10 enterprise ltsc instead of ws2012r2?
 

sohom

Supreme Member
Joined
May 26, 2013
Messages
1,315
Reaction score
607
Website
www.mediabots.net
thank you so much for the wonderful tutorial. Anyhow, i am wonder can we install windows 10 enterprise ltsc instead of ws2012r2?

Yes, you can try https://www.microsoft.com/en-us/evalcenter/evaluate-windows-10-enterprise , but you have to figure out how to enable RDP in W10, Search on Youtube, you might find something useful.
It has 90 days evolution(free) copy. But other Windows Server OS are offering 180 days free copy.
NOTE-
Windows 10 is similar to Windows Server 2019
 

makeenithar

Newbie
Joined
Dec 1, 2020
Messages
13
Reaction score
0
Yes, you can try https://www.microsoft.com/en-us/evalcenter/evaluate-windows-10-enterprise , but you have to figure out how to enable RDP in W10, Search on Youtube, you might find something useful.
It has 90 days evolution(free) copy. But other Windows Server OS are offering 180 days free copy.
NOTE-
Windows 10 is similar to Windows Server 2019
sorry because i am new to this. if my link is mediabot.com/winltsc.iso what will be the setup of this?

su

mkdir /media/script && mount -t tmpfs -o size=1m tmpfs /media/script

wget -P /media/script https://raw.githubusercontent.com/mediabots/Linux-to-Windows-with-QEMU/master/mediabots_Ubuntu-to-Windows.sh

chmod +x /media/script/* /media/script/mediabots_Ubuntu-to-Windows.sh
 

makeenithar

Newbie
Joined
Dec 1, 2020
Messages
13
Reaction score
0
i am having the timeout connection but 20.4 and 18.4 ubuntu. i try to put the command on putty this gives me error


[email protected]:~# f or i in $(ps aux | grep -i "qemu-system" | head -2 | cut -f7 -d" ") ; do echo "killing process id : "$i ; kill -9 $i ; done
bash: syntax error near unexpected token `do'
 

sohom

Supreme Member
Joined
May 26, 2013
Messages
1,315
Reaction score
607
Website
www.mediabots.net
Its okay
after running 3 commands one after another
Code:
su -
mkdir /media/script && mount -t tmpfs -o size=1m tmpfs /media/script
wget -P /media/script https://raw.githubusercontent.com/mediabots/Linux-to-Windows-with-QEMU/master/mediabots_Linux-to-Windows.sh

You have to stop.
and edit mediabots_Linux-to-Windows.sh file using (vim or nano file editor)
for example :-
Code:
sudo vim /media/script/mediabots_Linux-to-Windows.sh

and only change line no.35 & 39
just replace "http://download.microsoft.com/downl...RVER_EVAL_EN-US-IR3_SSS_X64FREE_EN-US_DV9.ISO" with "https://software-download.microsoft..._CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso"

for both occasions. (without quotes)

Only after done editing and saving the .sh file.
run rest of the commands:
Code:
chmod +x /media/script/*
/media/script/mediabots_Linux-to-Windows.sh

NOTE- Search on Youtube, how to use vim or nano file editor.
 

makeenithar

Newbie
Joined
Dec 1, 2020
Messages
13
Reaction score
0
thank you. i have successfully change the to ltsc iso.

now the only problem i am encountering is windows cant be installed on driver 0 partaion 1. the partation need to be formatted ntfs.. my question is it safe to format my disk will it not affected my bootable windows made? what is the safest way to do it since in your videos you didnot encouter this kind of problem.. thanks in advance
 

makeenithar

Newbie
Joined
Dec 1, 2020
Messages
13
Reaction score
0
i have got 80gb with 0 free space according windows manager installer.. at the same time with cannot install on partaion 1
 

sohom

Supreme Member
Joined
May 26, 2013
Messages
1,315
Reaction score
607
Website
www.mediabots.net
thank you. i have successfully change the to ltsc iso.

now the only problem i am encountering is windows cant be installed on driver 0 partaion 1. the partation need to be formatted ntfs.. my question is it safe to format my disk will it not affected my bootable windows made? what is the safest way to do it since in your videos you didnot encouter this kind of problem.. thanks in advance

Go there
Read "How Script works?" column

When you are in option 2 and your Server doesn't comes with multiple partitions. Then it is totally safe to do Format, etc any drive. Because the drive is virtual and created by the Script itself.
In other cases, you would lose all the data of the partition or drive.

Now, in case, you are unable to choose a particular drive or partition. It is because of Drivers.
And it can be available from here https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso
But, I did not attach it with the Script.

So if you are using a Dedicated Server & if you have access of IKVM or IPMI
or If your Server has VMWare ESXI installation option, the I would suggest you to follow my other Youtube tutorials to install Windows Server
 

makeenithar

Newbie
Joined
Dec 1, 2020
Messages
13
Reaction score
0
thank you.. same error cannot create partataion.. i guess i need to change my vps since it does not have these ipmi, ikvm, esxi in its hosting site panel...
 

sohom

Supreme Member
Joined
May 26, 2013
Messages
1,315
Reaction score
607
Website
www.mediabots.net
thank you.. same error cannot create partataion.. i guess i need to change my vps since it does not have these ipmi, ikvm, esxi in its hosting site panel...

Generally Dedicated Server provider provides those things. Though not all providers!
 

mrankin

Jr. VIP
Jr. VIP
Joined
Oct 17, 2008
Messages
1,639
Reaction score
771
Website
maxproxies.com
Thought I'd give this a try on a small dedicated server. All went well for a while and was able to connect via VNC but Window gives me an error and won't continue;
G0bGXN4.png


Hitting Enter takes me back to this;
xNTnods.png


I assume it's due to a drive/driver not working as expected but not sure how to fix from within Ubuntu.

Found possible answer on https://superuser.com/questions/678511/error-0xc0000098-when-dual-booting-ubuntu-alongside-windows-7 and followed guide to install boot repair on Ubuntu https://help.ubuntu.com/community/Boot-Repair.
Running boot-repair then gave this response -
Code:
# boot-repair
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused
/usr/share/boot-sav/bs-cmd.sh: line 17: 29632 Segmentation fault      ${G2S}${DEBBUG}${G2SVERBOSE} -g /usr/share/boot-sav/boot-sav.glade -s "/usr/share/boot-sav/$APPNAME.sh $*" --combobox="@@[email protected]@col" --combobox="@@[email protected]@col" --combobox="@@[email protected]@col" --combobox="@@[email protected]@col" --combobox="@@[email protected]@col" --combobox="@@[email protected]@col" --combobox="@@[email protected]@col" --combobox="@@[email protected]@col" --combobox="@@[email protected]@col" --combobox="@@[email protected]@col" --combobox="@@[email protected]@col"
 
Last edited:

jokowi

Regular Member
Joined
Aug 27, 2014
Messages
292
Reaction score
97
how to install virtualization on gcloud vps?

my result is not greater than 0
 

avfizade

Newbie
Joined
Jan 27, 2021
Messages
1
Reaction score
0
Nice share OP :)
It working perfectly for Digitalocean

I am unable to use it on Google Cloud Virtual Machine.
It shows virtuailization is disabled and even if I delete it, it doesn't work.. Any tips?
Hi
Can please help
I have digital ocean droplet and try a lot but I have error with vnc
 

localtradey

Newbie
Joined
Jul 6, 2021
Messages
1
Reaction score
0
A question on nested virtualization.
If a provider uses KVM as their virtualization software and you can choose e.g. Ubuntu or Windows, does that mean that nested virtualization is enabled?
i.e Windows has to live within the KVM environment.

This also means that Windows network latency will also be slower than the ubuntu(if you choose that OS).

Thanks.
 
Top