• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

how do i do a build in linux when i am using a Windows laptop ?

 
Ranch Hand
Posts: 1048
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I am in serious trouble now cos I was required to deploy the rest client in java to a build env which needs to be in linux but I am using a Windows laptop.

How can I go about doing it ?

Furthermore, I got to do a CI-CD with proper action and scripts to compile, containerise and send to a container repo and run in cloud.  Is GitHub Action considered cloud ?

Can the above be accomplished in 3 days ?

Hope someone can advise me.  

Tks.
 
Greenhorn
Posts: 27
1
IBM DB2 Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For a Linux environment I use Oracle VirtualBox, https://www.virtualbox.org/, download an ISO of Ubuntu and create a virtual machine.
For the cloud part you should be able to use any of the big 3 for free (Azure, AWS, Google Cloud). I used Google Cloud for my project.
Docker is easy to use for containerization.
I used Jenkins for CI-CD.

Hope this helps.
 
tangara goh
Ranch Hand
Posts: 1048
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there other ways cos my laptop is left with very little memory, even I have already uninstalled Ubuntu and VirtualBox already.
 
Michael Billiot
Greenhorn
Posts: 27
1
IBM DB2 Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could spin up Linux VM in your cloud environment and use those. I used Google Compute Engine API, seemed to work ok. Think I have 3 or so VM's running at the time.
 
tangara goh
Ranch Hand
Posts: 1048
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Michael Billiot wrote:You could spin up Linux VM in your cloud environment and use those. I used Google Compute Engine API, seemed to work ok. Think I have 3 or so VM's running at the time.



ok. But, I am totally new to what you have suggested and I can only afford free things now as in using the cloud.

Do you have a beginner tutorial for the task I have mentioned ?

Tks alot for your help.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're time-constrained, using VirtualBox is probably quicker to do (especially as you know it already) than would be learning a cloud environment.

But build tools like Maven or Gradle are cross-platform, so you might/should be able to use the same build setup on both Windows and Linux. Does the build contain anything you suspect might not work out of the box on Linux?
 
tangara goh
Ranch Hand
Posts: 1048
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:If you're time-constrained, using VirtualBox is probably quicker to do (especially as you know it already) than would be learning a cloud environment.

But build tools like Maven or Gradle are cross-platform, so you might/should be able to use the same build setup on both Windows and Linux. Does the build contain anything you suspect might not work out of the box on Linux?



Actually i forgot everything, including even how to write a Linux script Docker image for deployment

I only remember i have to read in the directory that i put my java code but i am not sure even if i should exclude the .class file just when we push it to github ? And then the libraries but then it will contain in Maven already which is part of the java app ?

Totally lost. Advice needed. Tks.

I am thinking of using Docker and then upload to GitHub Action but i do not know about the missing link which is from GitHub action to cloud.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see. I was just commenting on the basic build, which should work on Linux as it does elsewhere. Maybe someone else can help with the Docker stuff.
 
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here are the ways to run Linux on a Windows box:

1. Run it in a VM. VirtualBox is good and you can even use Vagrant to create and destroy VMs for a completely clean build each time. However, Microsoft also has its own VM subsystem, even though I haven't used it in so long I forget its name.

2. Set up a Dual Boot system. In such a case, when you boot your laptop, you get a boot menu where you pick which OS you want to run. The OS you select then boots up and completely owns the machine until shutdown, so as long as you have the disk space (about 15BG currently) and don't need both OS's at the same time, that's a popular option.

3. Set up a "Live Boot" system. Many distros allow you to create a USB thumb and/or DVD OS image. Plug it in, make sure your BIOS can boot from it, and go. As with Dual Boot, the Live Boot system owns the machine, and it will typically run slower since external peripherals generally aren't as fast as internal ones, but it's convenient. The Live Boot is also intended for people who want to preview an OS distro and optionally install it to their hard drive.

Having said that, there's very little need to run Linux just to develop Java applications (including webapps) on a Windows machine. For several years, in fact, I ran Windows XP on my desktop for production systems running Linux and Solaris and so did the rest of my department. It's true — when you code properly, Java is, in fact "Write Once/Run Anywhere". The popular IDEs and build tools all are available under both platforms, and a WAR built under Windows can be directly shipped to a Tomcat server running on Linux or even MacOS. Or debuggerd/tested on a Tomcat running under Windows. Just as an example.
 
tangara goh
Ranch Hand
Posts: 1048
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just found that I may not need all these setup. Correct me if I am wrong.  I can actually use a Docker with Linux scripting and then test if it run (so this is the part that I am not sure if it will run in Windows since it is in Linux scripting ) then i do the next step which is to upload to a cloud.
 
Tim Holloway
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please don't quote everything I said.  Quotes are for when you need to mention a specific section of something. If we want to read the whole thing we can simply  look up to the original.

Docker is not a VM and if you're not already familiar with Linux, then the extra complexity involved in containerizing probably won't be worth the trouble of learning Docker and how to Dockerize your project. Especially if your cloud isn't going to be running the apps in containers.

As I said, most Java stuff doesn't care much about what OS you are running on, and it's possible that you don't need any sort of viirtualizing or containerizing to do your work. If there are non-Java elements required such as shell scripts, then a VM is probably your best choice, although you might be able to use Cygwin, which is a way of emulating Linux under Windows. Cygwin isn't quite the same thing as true virtualization, but it has served me in the past.
 
Sheriff
Posts: 22815
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm surprised nobody mentioned WSL yet. It can be installed on Windows Pro and up if I remember correctly. But I do agree with Tim - building just Java code shouldn't require a Linux machine. I've built applications on Windows before and deployed them on Linux.
 
Tim Holloway
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn't mention WSL because it's after my time and I'm not sure what its exact capabilities are. CygWin, after all was sort of the original "WSL" and there are distinct snippets of Cygwin-specific code in the Tomcat scripts. Same reason I didn't specifically mention Azure. Not sure what's locally standard, what's freely installable, what's not free and what simply lives in the cloud or elsewhere.

I am happy, however that NFS is now natively available in Windows 10 and up. I was having a regular nightmare getting Samba past the container/selinux/file access rights/mirror server/maze of recent Windows and Linux distros. Windows NFS has its limits, and apparently one has to kick the Windows box to get the shares to fully come online after power-up, but overall it has made life a lot easier.
 
Rob Spoor
Sheriff
Posts: 22815
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as I can tell, WSL basically *is* Linux but with a custom kernel or something similar that integrates with Windows itself. Unlike Cygwin or MSYS (which is used by Git Bash), it has a proper Linux file system with user rights and all. You get automatic mounts of your Windows drives inside WSL, and you can access the WSL disk from Windows through network share \\wsl$.

I've been using Docker Desktop for a while, and it works great, except when it comes to permissions on mounted volumes. Assigned permissions don't stick. That's easy, until I have to run the same Docker command on a Linux machine and it starts failing.
I needed to run Jenkins on Docker recently, and on Windows it was so slow I installed Docker inside WSL on the same machine. Speed is a lot better, and I'm working with actual permissions. Before I could just mount a volume and be done with it. Now I actually need to think about permissions (which I think is actually a good thing).

Note: this applies to WSL 2. WSL 1 was a lot different, probably more like Cygwin / MSYS, or otherwise a sort of VM inside Hyper-V. I'm not sure how it worked before.
 
Don't count your weasels before they've popped. And now for a mulberry bush related tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic