how do we specify base os version in ova live build - ovf

Everyone
I am learning how to live-build ova and want to know where do we specify base os version, like ubuntu 16.04. I tried grep build don't find version...
I have below code repo. Does anyone know some good tutorial for my case. Thanks.
If someone knows the answer for speciyfing os verion. That's event better.
xxx live-build-aaa % ls
auto config
xxx live-build-aaa % cd config
xxx config % ls
binary chroot functions includes.chroot package-lists
bootstrap common hooks oem-config-preinstalled source
xxx config % cd hooks
xxx hooks % ls
001-divert-sync.chroot_early 032-disk-image.binary 051-hwclock.chroot 999-extras.binary
010-write-etc-ec2-version.chroot 033-disk-image-uefi.binary 060-ipv6.chroot 999-undivert-sync.chroot
020-pkg-configure.chroot 040-qcow2-image.binary 061-open-iscsi.chroot ovf
025-create-groups.chroot 040-vmdk-image.binary 099-cleanup.chroot
030-root-tarball.binary 041-vmdk-ova-image.binary 099-oem-provision.chroot
031-root-xz.binary 042-vagrant.binary 999-cpc-fixes.chroot

Related

How to get commands working globally in linux CLI

I am trying to get minizinc working with my node.js app.
I followed the instructions at https://www.npmjs.com/package/minizinc but errors state that minizinc was not found.
I understood that the above install was just a wrapper for the actual program. I am on hosted on a FreeBSD server, which has advice for installing minizinc here https://freebsd.pkgs.org/12/freebsd-amd64/minizinc-2.5.5.txz.html and here https://docs.freebsd.org/en/books/handbook/ports/ but pkg install or pkg search wouldn't work with the error pkg: Impossible to open / pkg: Cannot parse configuration file!
My hosting service then prompted me this, which seemed to work get everything installed.
wget https://github.com/MiniZinc/libminizinc/archive/refs/tags/2.5.5.zip
unzip 2.5.5.zip
cd libminizinc-2.5.5/
mkdir build
cd build/
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
The issue now is minizinc is not recognized as a CLI command in any folder and is still not found when attempting to run it in node.
Wrote back to the hosting service and the guy replied with I propose to create a symbolic link (ln -s) of the binaries to the ~/bin/ directory which of course didn't anything to me and after typing in ls -s minizinc ~/bin/ I get this printed but it doesn't seem to have done anything.
4012 minizinc
/home/michael/bin/:
total 2
1 node 1 npm
Before I write back to him, the guy who I am paying for the service who barely seems bothered to talk someone who clearly doesn't know what they're doing through the situation, I thought I would ask here.
Thanks!

Install go (golang) on Raspbian

I checked diverse forums but I still did not make it working.
I like to install go (golang) on my Raspberry PI - Raspbian:
With
sudo apt-get install golang
I installed go and with
export GOPATH=$home/pi/gocode
i set the GOPATH so i tryed to install from a homepage a new program with (sudo go get -u github.com/....) but, I only get "cannot download, $GOPATH not set. For more details see: go help gopath".
I really get crazy for my studip simple mistake that i do not see.
I would be pleased if i get a very detailed "how to do" discription since I am new to Linux and Raspbian, so everything which is made for real dummys should be good enough for me.
Thank you for your help.
This are detailed instructions about how to install Go on Raspbian Stretch from the repositories.
As of today, 2018-01-30, this will install Go 1.7. The most actual version for manual installation from the downloads is Go 1.9.3.
I. Login to your user on the Raspberry Pi (I'm using the default user pi).
II. Install Go (golang)
pi#pi3-2:~ $ sudo apt update
pi#pi3-2:~ $ sudo apt install golang
III. Create a working directory for all your go projects in your $HOME directory. It's best to name it go, as this defaults to the GOPATH in future Go versions (starting with Go 1.8).
pi#pi3-2:~ $ mkdir go
IV. Append the $GOPATH environment variable and modified PATH settings to your .profile
pi#pi3-2:~ $ echo 'export GOPATH=$HOME/go' >> ~/.profile
pi#pi3-2:~ $ echo 'PATH="$HOME/go/bin:$PATH"' >> ~/.profile
V. Logout and Relog with the new settings then check your settings
pi#pi3-2:~ $ go env
GOARCH="arm"
GOBIN=""
GOEXE=""
GOHOSTARCH="arm"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/pi/go"
GORACE=""
GOROOT="/usr/lib/go-1.7"
GOTOOLDIR="/usr/lib/go-1.7/pkg/tool/linux_arm"
CC="gcc"
GOGCCFLAGS="-fPIC -marm -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build187598155=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
Especially make sure GOPATH points to your previously created Go working directory. Don't care about setting GOBIN as mentioned in some documentation. It's usually not necessary and Go will automatically use $GOPATH/bin/ for your Go installs.
However, you might also want to check the path settings (/home/pi/go/bin should be included) to make sure you can run the code you installed with go install.
pi#pi3-2:~ $ echo $PATH
/home/pi/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
VI. A few words about the Go working directory structure
Over time, the Go working directory will contain three sub-directories: bin, src and pkg. Except src they will be automatically created, when needed the first time. The structure for user pi will look like this:
/home
/pi
/go
/src
/pkg
/bin
bin will contain all Go executable's you have installed using go install command.
pkg will contain all compiled packages that can be imported into your projects.
src will contain all your source files, either your own or sources downloaded from external repositories.
For eksample the command go get github.com/petergloor/hello-go will automatically fetch and place the source files from the corresponding external Github repository into the local directory $HOME/go/src/github.com/petergloor/hello-go.
As it's rather common to fetch external repositories either for reference or contribution it becomes important to keep your directory structure always well organized and clean.
Apart from that you are free to organize your projects as long they are hierarchically structured below the $HOME/go/src/ directory and follow the rules mentioned in the documentation.
However, to clearly organize my projects I personally always place my projects into $HOME/go/src/github.com/my-github-account even if I don't have an external repository for it.
If you don't have a github account you can likewise use any other external repository account.
As I mentioned, even it's not needed at all I prefere to use my Github account to clearly identify my projects. And even it's not needed I will use the username pi to distinct the user from other project maintainers in the following example.
VII. So let's add a "hello world" project to test our installation.
a) First let's create the project folder and cd into its directory.
pi#pi3-2:~ $ mkdir -p $HOME/go/src/pi/helloworld
pi#pi3-2:~ $ cd $HOME/go/src/pi/helloworld
pi#pi3-2:~/go/src/pi/helloworld $
b) With an editor of your choice create a file main.go with the following content
// helloworld project main.go.
package main
import ("fmt")
// main is the entrypoint of the application.
func main() {
fmt.Println("Hello world! Greetings from Raspberry Pi")
}
Spacing doesn't matter at this point. Go provides a nice tool to do this for you.
c) Now try to run the program.
pi#pi3-2:~/go/src/pi/helloworld $ go run main.go
Hello world! Greetings from Raspberry Pi
pi#pi3-2:~/go/src/pi/helloworld $
In case you get an error, fix it! Carefully, check the spelling and cases (Go is case-sensitive).
d) Next lets format the code:
pi#pi3-2:~/go/src/pi/helloworld $ go fmt
Without a file name this will properly (re-)format all source files within this directory and below.
e) Next let's build helloworld as an executable procram, within this directory.
pi#pi3-2:~/go/src/pi/helloworld $ go build
pi#pi3-2:~/go/src/pi/helloworld $ ls
helloworld main.go
pi#pi3-2:~/go/src/pi/helloworld $
f) Now you can run it.
pi#pi3-2:~/go/src/pi/helloworld $ ./helloworld
Hello world! Greetings from Raspberry Pi
pi#pi3-2:~/go/src/pi/helloworld $
g) Finally let's install the program into the $HOME/go/bin/ directory.
pi#pi3-2:~/go/src/pi/helloworld $ go install
pi#pi3-2:~/go/src/pi/helloworld $ ls $HOME/go/bin
hello-go helloworld
pi#pi3-2:~/go/src/pi/helloworld $
h) If everything is done right it can be run by our pi user from anywhere by just entering the name of the command.
pi#pi3-2:~/go/src/pi/helloworld $ helloworld
Hello world! Greetings from Raspberry Pi
pi#pi3-2:~/go/src/pi/helloworld $ cd ~
pi#pi3-2:~ $ helloworld
Hello world! Greetings from Raspberry Pi
pi#pi3-2:~ $
Congratulations!
as of Nov 2019. (Please note if you need version 1.13+ please wget go1.13.3.linux-amd64.tar.gz manually)
OR sudo apt-get install golang-go - source
You just have to type following commands on your RPi
sudo apt-get update
sudo apt-get install golang --fix-missing
and when you type now go version following should be your output
pi#rpi1:~ $ go version
go version go1.11.6 linux/arm
Additionally, I also had the following installed before running everything
sudo apt-get install make gcc g++
How to install golang:
Download the latest tarball, go1.9.linux-armv6l.tar.gz, to a directory such as /home/pi/downloads.
Then use:
sudo tar -C /home/pi -xzf go1.9.linux-armv6l.tar.gz
to extract the go installation to the directory
/home/pi
creating /home/pi/go
to check use
go version
Which will give you the actual version of go.
It should be go1.9 linux/arm.
Please check with:
go env
or
go env GOPATH
the GOPATH direction
with
ls -a # (used in /home/pi/ )
give you a list of all files and also shows you ~/.profile
with
sudo nano ~/.profile
you can open that file an add the reccommended code for the go directory
export GOROOT=/home/pi/go
export GOPATH=/home/pi/go/bin
close with STRG + O and ENTER and STRG + X
check with
go env GOPATH
then use
source ~/.profile
then you can check again with
go env
Now go should be running on the latest version and should have the correct GOPATH directory
For me helpful was this link: https://tecadmin.net/install-go-on-debian/#
I really hope some others also give detailed descriptions of how to install a program in a brief and detailed way. Instead of 3 lines of single code.

OpenShift oc command line with Cygwin

I'm running Cygwin 64bit but can't seem to get OpenShift oc command line to work
I downloaded oc.tar.gz ( from here https://mirror.openshift.com/pub/openshift-v3/clients/3.6.173.0.5/linux/oc.tar.gz ), unzipped it and placed it in my path in /usr/bin
When I try to run: oc login I get the following.
-bash: /usr/bin/oc: cannot execute binary file: Exec format error
Do I need to somehow 'install' the executable ?
Any help would be much appreciated.
In addition to #Graham Dumpleton's answer:
open cygwin and check for directory /usr/local/bin
mkdir -p local/bin
$ cd /usr/local/bin
if it does not exists:
$ mkdir -p local/bin
finally extract the windows package:
$ cp /cygdrive/c/Users/me/Downloads/oc-3.5.5.31.24-windows.zip /usr/local/bin/
unzip oc-3.5.5.31.24-windows.zip
$ oc version
oc v3.5.5.31.24
kubernetes v1.5.2+43a9be4
features: Basic-Auth
Use the Windows binary from the following page:
https://github.com/openshift/origin/releases
From project homepage
https://www.cygwin.com/
Cygwin is not:
a way to run native Linux apps on Windows. You must rebuild your
application from source if you want it to run on Windows.
a way to magically make native Windows apps aware of UNIX®
functionality like signals, ptys, etc. Again, you need to build your
apps from source if you want to take advantage of Cygwin
functionality.

How to install InfluxDB in Windows

I am new to InfluxDB. I could not find any details about installing InfluxDB on Windows. Is there any way to install it on a Windows machine or do I need to use a Linux server for development purposes?
The current 0.9 branch of influxdb is pure go and can be compiled on Windows with the following commands:
cd %GOPATH%/src/github.com/influxdb
go get -u -f ./...
go build ./...
Of course you will need go (>1.4), git and hg.
If you do not want to compile your own version, you can also find here my own Windows x86 binaries for v0.9.0-rc11:
https://github.com/adriencarbonne/influxdb/releases/download/v0.9.0-rc11/influxdb_v0.9.0-rc11.zip
To run InfluxDB, type: influxd.exe.
Or even better, create the following config file, save it as influxdb.conf and run influxd --config influxdb.conf:
reporting-disabled = true
#[logging]
#level = "debug"
#file = "influxdb.log"
[admin]
enabled = true
port = 8083
[api]
port = 8086
[data]
dir = "data"
[broker]
dir = "broker"
I struggled quite a lot with this issue, so I'll post the full process step by step. This will hopefully help other people that lands on this post.
Table of contents:
Edit: WARNING, this doesn't work if Go and projects folder are installed to a custom path (not c:\go). In this case go get breaks with cryptic messages about unrecognized import paths (thanks to user626528 for the info)
PREVIOUS DOWNLOADS
COMPILATION
EXECUTION
1. PREVIOUS DOWNLOADS
Go for Windows (get the .msi):
https://golang.org/dl/
GIT for Windows:
http://git-scm.com/download/win
2. COMPILATION
cd to C:\Go
Create our $GOPATH in "C:\Go\projects" (anywhere but C:\Go\src, which is the $GOROOT).
> mkdir projects
Set to $GOPATH variable to this new directory:
> set GOPATH=C:\Go\projects
Pull the influxdb code from github into our $GOPATH:
> go get github.com/influxdata/influxdb
cd to C:\Go\projects\github.com\influxdata\influxdb
Pull the project dependencies:
> go get -u -f ./...
Finally, build the code:
> go build ./...
...this will create 3 executables under C:\Go\projects\bin:
influx.exe
influxd.exe
urlgen.exe
3. EXECUTION
To start the service:
influxd -config influxdb.conf
For that, you first need to create a influxdb.conf file with the following text:
reporting-disabled = true
#[logging]
#level = "debug"
#file = "influxdb.log"
#write-tracing = false
[admin]
enabled = true
port = 8083
[api]
port = 8086
[data]
dir = "data"
[broker]
dir = "broker"
Once the service is started, you can execute Chrome and go to http://localhost:8083, and start playing with InfluxDb.
Default values for username and password are:
username: root
password: root
Few updates to Xavier Peña solution to build latest influxdb. Notice the difference in github URL and the path.
C:\Go\projects>go get github.com/influxdata/influxdb
C:\Go\projects>go get github.com/sparrc/gdm
C:\Go\projects>cd C:\Go\projects\src\github.com\influxdata\influxdb
C:\Go\projects\src\github.com\influxdata\influxdb>go get -u -f ./...
C:\Go\projects\src\github.com\influxdata\influxdb>c:\Go\projects\bin\gdm.exe restore
C:\Go\projects\src\github.com\influxdata\influxdb>go build ./...
C:\Go\projects\src\github.com\influxdata\influxdb>go install ./...
C:\Go\projects\bin>influxd config > influxdb.generated.conf
C:\Go\projects\bin>influxd -config influxdb.generated.conf
Windows if officially supported. Go to https://portal.influxdata.com/downloads and download it from there.
The current 0.9 branch of influxdb is pure go and can be compiled on Windows. The main prerequisites are go 1.4, git (e.g. tortoisegit together with msysgit), hg (e.g. tortoisehg).
Using this setup I've successfully compiled and run influxdb on Win7 x64.
There wasn't an influxdb Windows version at Sep 30 '14, there were are only Linux and OSX versions.
Update: Current 0.9 version at present 04/09/2015 have a win version.
The "nightlies" build actually has windows executables now. The release version does not (there is an open issue for that).
Alternatively, downloading the released version and adding the .exe extension to the file names should work as well. You would have to generate the config file using the command:
influxd config >influxdb.conf
Update 2020 - InfluxDB is NOT recommended on windows
After going through countless of articles, it is generally NOT recommended to install InfluxDB directly on Windows. There are many issues. In terms of performance and stability. Official InfluxDB too does not support windows and has no plans for it in the future. This is further proven as the latest InfluxDB 2.0 does not include any windows binaries.
InfluxDB 2.0 does not include windows binaries
so?
Work Around? => DOCKERS for WINDOWS, Try it, it's easy and free
Dockers are free. If you intend to install docker on Windows Server, it's also free for Windows Server 2016 and above (Microsoft made a special deal with docker to provide them for free)
For those who are still in the VM world:
Dockers are NOT like Virtual Machines. It interacts directly with the host's file system via a windows service
Check the link below for a step by step guide:
https://www.open-plant.com/knowledge-base/how-to-install-influxdb-docker-for-windows-10/
We don't officially support Windows at this time. However, you should now be able to build from master. See this issue to track it closely and the comments at the bottom have a link to where you can get a compiled binary:
https://github.com/influxdata/influxdb/issues/5359
For create influxdb configuration file we can also use the below command
influxd config > influxdb.generated.conf
If you don't want to compile it yourself, the build is done by influxdata and can be found at URLs like : https://dl.influxdata.com/influxdb/releases/influxdb-1.0.0-beta2_windows_amd64.zip (just change the version number to have another (recent) version)
However, as mentionned by Paul Dix, Windows is not officially supported for the moment.
Go to influxdata.com click downloads
https://portal.influxdata.com/downloads/
Select version 1.7 because currently there are no binaries for 2.0.
Download Windows binary

Where can I find the Java SDK in Linux after installing it?

I installed JDK using apt-get install but I don't know where my jdk folder is. I need to set the path for that. Does any one have a clue on the location?
This depends a bit from your package system ... if the java command works, you can type readlink -f $(which java) to find the location of the java command. On the OpenSUSE system I'm on now it returns /usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre/bin/java (but this is not a system which uses apt-get).
On Ubuntu, it looks like it is in /usr/lib/jvm/java-6-openjdk/ for OpenJDK, and in some other subdirectory of /usr/lib/jvm/ for Suns JDK (and other implementations as well, I think).
Debian is the same.
For any given package you can determine what files it installs and where it installs them by querying dpkg. For example for the package 'openjdk-6-jdk': dpkg -L openjdk-6-jdk
update-java-alternatives -l
will tell you which java implementation is the default for your system and where in the filesystem it is installed. Check the manual for more options.
$ which java
should give you something like
/usr/bin/java
This question will get moved but you can do the following
which javac
or
cd /
find . -name 'javac'
Use find to located it. It should be under /usr somewhere:
find /usr -name java
When running the command, if there are too many "Permission denied" message obfuscating the actual found results then, simply redirect stderr to /dev/null
find /usr -name java 2> /dev/null
Another best way to find Java folder path is to use alternatives command in Fedora Linux (I know its for Ubuntu but I hit this post from google just by its headline). Just want to share incase people like me looking for answers for fedora flavour.
To display all information regarding java
alternatives --display java
Three Step Process:
First:
open Terminal->$ whereis java
it would give output like this:
java: /usr/bin/java /usr/share/java /usr/share/man/man1/java.1.gz
Second:
ls -l /usr/bin/java
It would give output like this:
lrwxrwxrwx 1 root root 22 Feb 9 10:59 /usr/bin/java -> /etc/alternatives/java
Third:
ls -l /etc/alternatives/java
output is the JDK path:
lrwxrwxrwx 1 root root 46 Feb 9 10:59 /etc/alternatives/java -> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
Simple, try it:
It's /usr/local/java/jdk[version]
This question still seems relevant, and the answer seems to be a moving target.
On my debian system (buster):
> update-java-alternatives -l
java-1.11.0-openjdk-amd64 1111 /usr/lib/jvm/java-1.11.0-openjdk-amd64
However, if you actually go look there, you'll see there are multiple directories and symbolic links placed there by the package system to simplify future maintenance.
The actual directory is java-11-openjdk-amd64, with another symlink of default-java. There is also an openjdk-11 directory, but it appears to only contain a source.zip file.
Given this, for Debian ONLY, I would guess the best value to use is /usr/lib/jvm/default-java, as this should always be valid, even if you decide to install a totally different version of java, or even switch vendors.
The normal reason to want to know the path is because some application wants it, and you probably don't want that app to break because you did an upgrade that changed version numbers.
the command: sudo update-alternatives --config java will find the complete path of all installed Java versions
On Linux Fedora30 several versions of the full java JDK are available, specifically package names:
java-1.8.0-openjdk-devel.x86_64
java-11-openjdk-devel.x86_64
Once installed, they are found in: /usr/lib/jvm
To select the location/directory of a full development JDK (which is different from the simpler runtime only JRE) look for entries:
ls -ld java*openjdk*
Here are two good choices, which are links to specific versions, where you will have to select the version:
/usr/lib/jvm/java-1.8.0-openjdk
/usr/lib/jvm/java-11-openjdk
on OpenSUSE 13.1/13.2 its: /usr/lib64/jvm/java-1.6.0-openjdk-(version-number)
version-number can be 1.7.x 1.8.x etc. check software manager witch version you have installed...
André
This is the best way which worked for me
Execute this Command:-
$(dirname $(readlink $(which javac)))/java_home
below command worked in my debain 10 box!
root#debian:/home/arun# readlink -f $(which java)
/usr/lib/jvm/java-11-openjdk-amd64/bin/java

Resources