Using container for Linux applications? - linux

I am experimenting with multiple versions of QEMU.
This involves downloading different versions and variants of source code, and running the usual: configure, make and make install.
The problem is I can't install multiple versions simultaneously because they use the same install script. I need to uninstall (make uninstall) before I install another one. This only works if I have kept the makefile of the installed binaries.
I think what I would like to do is something similar to Python's virtualenv. A standalone Linux user(?) environment for each application that I can easily remove.
Is there such a thing? Or is my approach completely flawed?

I think the best approach for such cases is docker container. Docker is a container-based virtualization technology, In which you can build your customized Linux-based environment and host your application inside it. thereafter, that means, you have containerized your application and its ready to be distributed and run easily.

Related

nvm with WSL for projects stored in Windows

I'm struggling to understand how exactly WSL works.
The training that I'm doing requires nvm so I can manage my node versions in my project, located in my hard drive that is running with Windows.
So, in order to use nvm I need WSL, but I cannot comprehend where it is located. As far as I understood (and I'm pretty sure that I'm wrong) the WSL that I installed is like a Linux VM, completely independent from my Windows, and I operate it through the Ubuntu Terminal that came with WSL. If that's the case, how can nvm in WSL be useful if my project is in my Windows directory and the WSL controls node versions from my Linux VM?
How do I make nvm useful for my project running from my C:\ drive and how does WSL work with nvm in my Windows?
Thank you!
A few options, but each has advantages and disadvantages:
If your Node/JavaScript files are on your Windows C:\ drive, then you do have the ability to access that from WSL. Windows paths are automatically mounted and accessible in WSL via /mnt/c, /mnt/d, etc.
So if you have your JS source in, for example:
C:\Users\<myusername>\Documents\Projects\JS_class\project1\
Then that would be accessible under Ubuntu in WSL via:
/mnt/Users/<myusername>/Documents/Projects/JS_class/project1/
The disadvantage here is performance, as mentioned in this question.
Alternatively, you can store your project files inside WSL. You can access the WSL path from Windows by using \\wsl$\Ubuntu\home\<yourusername>\ (or similar). You can use this to copy from your existing Windows drive to your WSL distribution.
Advantage: Faster. Disadvantage: Unknown -- You seem to want the files to be in Windows, but I'm not sure why.
Or you can use WSL1 for most Node/JS tasks. See the previously mentioned answer for details on how to convert.
Advantage: Speed
Disadvantage: WSL1 hasn't been updated in a while, and is started to run into some compatibility issues. It's still popular enough and stable enough at the moment for me to continue to recommend it, though.
There's also a Windows version of nvm as well as a replacement project that the repo there mentions. I cannot personally speak for the quality of it, but it does have 23k stars on Github. Note that it is not affiliated with the original (Linux-based) nvm project.

How can I know which Debian libraries Electron needs to run?

What I'm doing
I'm building an Electron-based kiosk app using Balena to run on a Raspberry Pi 4. Balena requires a Dockerfile to build the container that will run my app. In that Dockerfile, I must make sure I install all the libraries needed by Electron. The image I'm using is based on Debian Buster (the default image Balena uses).
What I know
I've found two working examples in GitHub similar to what I'm trying to do where I can see which libraries are installed:
https://github.com/Ciantic/balena-electron-example (list of installed libraries)
https://github.com/balena-io/balena-electronjs (list of installed libraries)
And also two files inside the Electron repo that mention required libraries:
https://github.com/electron/electron/blob/77049545050673949b2844f17b3731196947956a/build/install-build-deps.sh#L189-L231
https://github.com/electron/electron/blob/d5ab63b1ead93dcb4e3099fccd4670fe9258ca9c/docs/development/build-instructions-linux.md
What's confusing me
Each list of libraries in the above files is different from the others. I don't know which one I should follow. Also, the build instructions for Linux don't have any list specific for Debian.
My question
How can I know for sure exactly which libraries I need to install in my Debian-based container so that Electron can run?
In the example, it should show a Dockerfile that you can use to get the required libraries.

Linux standalone 'installation' of Postgresql

For easy deployment, I'd like to ship an installation of Postgres as part of the application. Is it possible to include an already compiled and runnable version of Postgres that can be launched as process? I was able to do such thing with a Windows and MacOS version, but haven't found anything about Linux on that matter yet. Perhaps someone has tried this before and can share some insights...
You haven't stated what linux OS you're using.
Assuming it's a Redhat variant why not package your application as an RPM package? You could then declare a dependency on the standard Postgres package which would be automatically installed yum. Same principle applies if you're using Debian based systems, just a different packaging format.
From the user's perspective the OS's native packaging format is always the easiest way to install your application. Just requires effort to package it properly.
You can find cross-platform binaries from these pages on PostgreSQL official website:
For easy GUI .run installers, use links provided at http://www.enterprisedb.com/products-services-training/pgdownload.
If your target machine has no X installed on it, or you want to automate installation process with shell scripts, then you can download RPM or Deb packages from http://community.openscg.com/se/postgresql/packages.jsp
I found these links on http://www.postgresql.org/download/linux/ubuntu/, under "Cross distribution packages" and "Graphical installer".
I quote from those pages:
Note: The cross distribution packages do not fully integrate with the platform-specific packaging systems.
You must have root priviliges to install these packages, however, none of your systems library files will be altered. The supporting libraries that these binaries require are included locally as part of the install. This is the "special sauce" that allows identical binaries to run on different linux distro's.

What is the best approach to distribute a project in both windows and linux?

So there is this particular jython project that needs a couple of dependencies, such as Jenkins, some kind of subversion, and this needs to be done on windows.
Would it be sane of me to consider using pip to help install all of these items, or should I look elsewhere, such as NSIS?
Update:
I really should've rephrase this - my fault for asking the question late at night.
There's an automated testing project that has the following dependencies:
Java JDK
Jython
Ant
Robot Framework
subversion
Jenkins
I personally prefer to run on Linux, but people that need to use this are typically Windows users. I'm confident enough to write a script to install all of this on Linux, but what I want is to have a script / installer that would install the relevent tools.
I would prefer to have a single script to do all of this - it's easy on Ubuntu with apt-get; but on windows, this quickly becomes non-trivial.
What is the best way to try and do this? Should I create separate installers for separate OS
pip is the acronym for pip install packages, python packages, and it only install Python packages.
Since Jenkins and Subversion are not Python packages, as far as I know, you can't install them, and it is not "sane".
Unfortunately there is no single established tool to install everything in every platform.
Use pip to install all your python packages, and prefer to use virtualenv to create isolated Python environments to manage your projects.
Since pip only installs python packages and Jenkins isn't a python package (it's written in Java), you cannot use it to install those packages.
You should totally take a look to virtualenv, but if you need to do a "double click" installer for your project in Windows i think that NSIS is the way to go.
I am successfully using install4j to create an executable installer for Windows, Linux and OSX. The application is Java and it bundles JRE. Install4j creates installer for each specified platform using respective JRE. So far it worked great on Windows and it somewhat works on Linux and OSX (e.g. in new version of install4j, JRE for Java 1.8 is not bundled properly for linu, so the JRE is preinstalled, but it could be automated). It also allows you to run non-interactive installer.

Centralized Installer

I am looking for an installer for my product. My requirement is that from one Node (Physical Machine) I should be able to install the software on multiple machines (Node). My product is a HA platform that needs to be installed on multiple Linux machines to form a cluster. Is there any installers that can do this free or paid. Currently we are developing on Linux, going forward we may need to support other Unix type OS.
Thanking you in advance
Package your product appropriately for the distribution (e.g. deb package) and use the standard management tools for the platform. Many simplicity-oriented people use
for node in $nodes; do ssh $node sudo apt-get install $package; done
and there is a host of cluster management software out there, one of which you are probably using.
I don't know if there is an "installer" the way you use in Windows machines. However you can create packages depending on your system. For Debian like systems you can create .deb packages, and for Red Hat style you can create .rpm packages.
The way the packages are created is to specify a correct installation path for files and pre-install & post-install scripts to execute when you install the files. Also you can set dependencies on your package, so that if you require some important library, the deb/rpm installer won't install your package until the required library is installed.
Hope that makes sense with my broken English:)

Resources