1. This website uses cookies to improve service and provide a tailored user experience. By using this site, you agree to this use. See our Cookie Policy.
    Dismiss Notice
  2. The hosting section is sponsored by Hostwinds visit the BHW Partnership program for your exclusive BHW member hosting benefit today.
    MUST be signed into your BHW account.
    Dismiss Notice

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

Discussion in 'Web Hosting' started by sohom, Feb 23, 2019.

  1. sohom

    sohom Senior Member

    Joined:
    May 26, 2013
    Messages:
    1,155
    Likes Received:
    450
    Occupation:
    Coder | Programmer
    Location:
    Automation
    Home Page:
    https://github.com/mediabots/Linux-to-Windows-with-QEMU/issues/1

    upload_2019-4-7_11-13-36.png

    issue resolved & closed


    Thanks for confirming via PM
     
  2. Windmm

    Windmm Elite Member

    Joined:
    Jun 10, 2013
    Messages:
    3,048
    Likes Received:
    1,299
    Such a valuable share! Thanks a lot bud!
     
    • Thanks Thanks x 1
  3. sohom

    sohom Senior Member

    Joined:
    May 26, 2013
    Messages:
    1,155
    Likes Received:
    450
    Occupation:
    Coder | Programmer
    Location:
    Automation
    Home Page:
    **UPDATE**

    In the script, VNC default port changed to 9 from 0, because for some servers, 0 port reserved for other purposes.

    So now if you use this script, you could access your server via VNC viewer with the following format:
    Server_IP:9

    Regards
     
  4. kneehawk

    kneehawk Newbie

    Joined:
    May 21, 2012
    Messages:
    12
    Likes Received:
    2
    hmmmm getting "The device is not writable: Permission denied" after running the script with root access
    any idea what I'm doing wrong?
     
  5. sohom

    sohom Senior Member

    Joined:
    May 26, 2013
    Messages:
    1,155
    Likes Received:
    450
    Occupation:
    Coder | Programmer
    Location:
    Automation
    Home Page:
    Hello
    That kind of error could only be due to your system configuration. Its not an issue of the script.

    Had you tried it with user name 'root'?
    or
    an user with root access?


    better try with root user itself. (if it does't, post a screenshot,so we can help)

    btw,which hosting provider are you using for your VPS or Dedibox?

    Regards
     
  6. kneehawk

    kneehawk Newbie

    Joined:
    May 21, 2012
    Messages:
    12
    Likes Received:
    2
    Thanks for your help
    I sorta figured it out

    The issue was with Ubuntu 18
    It works with Ubuntu 16 but now the problem is that there's only one drive on VPS, and it's boot drive.
    It has enough spae but I can't partition it since it's the boot drive.

    I need to run Ubuntu live, but I'm not sure how I would do that on a vps

    It's for Serverpoint (I need a cheap Ashburn vps, and they seemed to offer the best price)
     
  7. sohom

    sohom Senior Member

    Joined:
    May 26, 2013
    Messages:
    1,155
    Likes Received:
    450
    Occupation:
    Coder | Programmer
    Location:
    Automation
    Home Page:
    Ok
    Though I have recently tested my script on Ubuntu 18.04, and it was working fine.
    Anyway, I am happy to heard that you were able to use the script

    You can change the Windows Disk size by editing the .sh script

    At first delete old Windows Instance by running below commands:
    Code:
    umount -l /mnt /media/script
    rm -rf /mediabots /floppy /virtio /media/* /tmp/*
    rm -f /sw.iso /disk.img
    
    Next, open script file on vim editor (search on Youtube about "how to use vim on linux")

    then change the content of line No. 88
    from this
    Code:
    newDisk=$(expr $freeDisk \* 90 / 100 / 1024)
    to this
    Code:
    newDisk=25600
    So next time when you will run the script, it will create 25GB Disk pace for Windows OS

    Regards
     
    Last edited: May 8, 2019
  8. kneehawk

    kneehawk Newbie

    Joined:
    May 21, 2012
    Messages:
    12
    Likes Received:
    2
    so I edited your script (as instructed above), uploaded to a github, generated a new link, and started from step 1 on a fresh server but I'm still only seeing a drive with 128 MB and a second drive with 160 GB (System)

    is there something I'm doing wrong?
     
  9. gluglu

    gluglu Registered Member

    Joined:
    May 29, 2018
    Messages:
    50
    Likes Received:
    8
    thanks thats really helpful
     
    • Thanks Thanks x 1
  10. ari991

    ari991 Registered Member

    Joined:
    Nov 3, 2018
    Messages:
    77
    Likes Received:
    11
    WOW , nice share buddy
     
    • Thanks Thanks x 1
  11. sohom

    sohom Senior Member

    Joined:
    May 26, 2013
    Messages:
    1,155
    Likes Received:
    450
    Occupation:
    Coder | Programmer
    Location:
    Automation
    Home Page:
    Check your PM please
     
  12. vincent47

    vincent47 Junior Member

    Joined:
    Jul 31, 2011
    Messages:
    105
    Likes Received:
    14
    Location:
    https://www.collectionsofvincent47.download
    Home Page:
    this is what i need, since i know a 1$ per month linux vps
     
    • Thanks Thanks x 1
  13. boykuncute

    boykuncute Newbie

    Joined:
    Mar 10, 2014
    Messages:
    3
    Likes Received:
    0
    Can we install windows 2008R2?
     
  14. sohom

    sohom Senior Member

    Joined:
    May 26, 2013
    Messages:
    1,155
    Likes Received:
    450
    Occupation:
    Coder | Programmer
    Location:
    Automation
    Home Page:
    of course

    If you want to use your own Windows ISO copy,
    then upload it to your extra server after that you would have a DIRECT_URL and then just before running the last command(that is /media/script/mediabots_Linux-to-Windows.sh) edit the script (.sh) file using vim command

    Now replace http://51.15.226.83/WS2012R2.ISO of LINE NO. 35 & 39 with your DIRECT_ISO_URL

    Also you can go to here : https://www.microsoft.com/en-in/evalcenter/evaluate-windows-server and download any official version of 180 days free Windows server copy

    NOTE - If you don't know how to use vim , then youtube is your friend https://www.youtube.com/results?search_query=vim

    Regards
     
    • Thanks Thanks x 1
  15. boykuncute

    boykuncute Newbie

    Joined:
    Mar 10, 2014
    Messages:
    3
    Likes Received:
    0
    My servers are often disconnected and must be restarted on the management page to be accessed again. I use the scaleway server that is the reason why
     
  16. sohom

    sohom Senior Member

    Joined:
    May 26, 2013
    Messages:
    1,155
    Likes Received:
    450
    Occupation:
    Coder | Programmer
    Location:
    Automation
    Home Page:
    Yesterday I tested a VPS from scaleway com, for me it was working fine, even I tested with my this script
    I tried below plan:
    DEV1-M | 3 vCPUs 4 GB 40 GB | NVMe 200 Mbits/s €7.99/mo or €0.016/hr

    but ya, I agree, sometime their VPS behaves strange. May be due to peak hours or problem related to a particular IP.
    And I also commit, they are increasing their price rate! Few months ago they were the cheapest VPS provider in terms of SSD disk space, but not now :|
     
  17. boykuncute

    boykuncute Newbie

    Joined:
    Mar 10, 2014
    Messages:
    3
    Likes Received:
    0
    I think because the script makes vps lose my connection when I run 20 vps, there are 10 vps that are constantly disconnected and have to be restarted on the management page.
     
  18. mr.vmehta

    mr.vmehta Junior Member

    Joined:
    May 26, 2019
    Messages:
    189
    Likes Received:
    157
    Gender:
    Female
    Very helpful! Thanx, Trying to find such solution.
     
    • Thanks Thanks x 1
  19. Keats4

    Keats4 Jr. VIP Jr. VIP

    Joined:
    Apr 20, 2012
    Messages:
    107
    Likes Received:
    27
    Super interesting. Thanks!
     
    • Thanks Thanks x 1
  20. sohom

    sohom Senior Member

    Joined:
    May 26, 2013
    Messages:
    1,155
    Likes Received:
    450
    Occupation:
    Coder | Programmer
    Location:
    Automation
    Home Page:
    Normally, if a VPS get disconnected on RDP or Putty, one can just reconnect it.
    But in your case you said, you have to restart whole VPS(through web management page) to get connected again,in that case your VPS is not responding, its not same as disconnected.

    No way, script has job to install Windows Server OS on top of Linux OS.
    Once Windows sever get installed and you successfully connected to your Windows RDP via IP: PORT(through VNC,etc) for 1st time, script job is done :)
    After that KVM(QEMU) took control over Virtualization.
    Now if your VPS not connecting/responding, its problem of you VPS or ISP, they might have a limit.
    I am using Scaleway since long time, encountered such issues only 3 or 4 times out of 100 times, though I never ran 20 instances at a time!

    You should create a Support Ticket on Scaleway.com about your VPS problem.

    Another thing, I am not sure whether you are using this option or not,but I suggest not to use "delete existing Linux OS" option of the Script

    Regards
     
    Last edited: Jun 4, 2019