Java installation error in Ubuntu 18.4 LTS - java

I have to run Django CRM in my local machine. I followed all commands and tried to install every dependency.
I got stuck in the following command.
sudo apt-get install oracle-java8-installer -y java -version
I got the following error when I tried above command.
E: Command line option 'e' [from -version] is not understood in combination with the other options.
The link of Github CRM Django CRM
Documentation
Please someone help me.

Looking to Django-CRM documentation, seems like the command to install java (required by elasticsearch dependency) it's not the correct one for ubuntu 18.04
To install it you need to run:
apt-get install openjdk-8-jre-headless
Then you can follow the instructions as in the documentation
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch > key.elastic
apt-key add key.elastic
echo "deb https://packages.elastic.co/elasticsearch/2.x/debian stable main" | tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
apt-get update && apt-get install elasticsearch -y
Also, remember to add sudo on the commands if you are not running the commands as root

Related

Integrating postgres to django

im trying to install psycopg2 to use postgres on my django app. Seems like the first step is to run the
sudo apt install python3-dev libpq-dev
, but when i do it hits me with this funky error -
Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-15.jdk/Contents/Home/bin/apt" (-1)
I'm confused as to why its showing me a java error when i'm installing python-dev. Any help would be greatly appreciated!
Install pip by typing:
python3 -m pip install --user --upgrade pip
It is often a good idea to use virtual environments when doing projects, otherwise packages are installed system wide.
Type in the following to start a virtual environment in your project directory:
python3 -m pip install --user virtualenv
python3 -m venv .
Afterwards, this command should install psycopg2
pip install psycopg2-binary==2.8.4

Unable to run Java on Dockerfile since yesterday

I have a set up of Protractor, for which I need java in my Dockerfile to run the selenium-server.jar file.
Here is my Dockerfile
FROM node:latest
ENV CHROME_VERSION "google-chrome-stable"
RUN sed -i -- 's&deb http://deb.debian.org/debian jessie-updates main&#deb http://deb.debian.org/debian jessie-updates main&g' /etc/apt/sources.list \
&& apt-get -o Acquire::Check-Valid-Until=false update && apt-get -o Acquire::Check-Valid-Until=false install wget -y
ENV CHROME_VERSION "google-chrome-stable"
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list \
&& apt-get -o Acquire::Check-Valid-Until=false update && apt-get -qqy --allow-unauthenticated install ${CHROME_VERSION:-google-chrome-stable}
# Add the dependencies to get the xenial apt sources
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
RUN echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
RUN apt-get -y update
# Add these silent accept - since oracle installer asks for permission to install java-version-8
RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 seen true" | debconf-set-selections
# Install java-8
RUN apt install -y oracle-java8-installer && apt install oracle-java8-set-default
This set up was working fine until yesterday but since then I've been getting this error
download failed
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
oracle-java8-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)
The command '/bin/sh -c apt install -y oracle-java8-installer && apt install oracle-java8-set-default' returned a non-zero code: 100
Now before marking this question as a duplicate , please see that I have gone through a lot of similar SO posts and applied all the changes mentioned but the error still persists or I get a new error, which circles back to this unable to download error.
I have tried the solutions mentioned in this, this, this and this, this, this, this but haven't been able to solve it.
The complete log file is here. If required, I can post the error that I got when trying to apply the solutions mentioned.
Looking for any pointers to solve this issue.
Do you really need to have oracle jdk? In the pass, I used the content of Dockerfile from openjdk to build an image from node and having java installed: https://github.com/docker-library/openjdk/blob/master/8/jdk/Dockerfile
Nevertheless, in your case, I would build a centralized selenium server or use a directConnect in CI pipeline.
Docker will remember the result of running each command unless you explicitly tell it not to (docker build --no-cache). In particular, it will skip over running the apt-get update step if it thinks it’s already done this.
Meanwhile, the Debian and Ubuntu repositories update frequently, and when they update, they remove old versions of packages. This means that if you’re using yesterday’s version of the package cache, you’ll get “download failed” errors like you see until you re-run apt-get update.
In a Docker context, the correct answer to this is to always run apt-get update and apt-get install in the same RUN step. You might change the end of your Dockerfile to look like
RUN apt-get update -y \
&& apt install oracle-java8-installer oracle-java8-set-default
Once you’ve gotten past the initial development stage it’s probably good practice to just have a single apt install command in your Dockerfile that does one pass at installing all of the runtime dependencies you need.

docker - installing java 8 with curl

To insall java 8 on docker container, I used this command in dockerfile
RUN curl -LO 'http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.rpm'
-H 'Cookie: oraclelicense=accept-securebackup-cookie' RUN rpm -i jdk-8u111-linux-x64.rpm RUN rm jdk-8u111-linux-x64.rpm
It worked for awhile, but now this link is not no longer available. Is there replaceable url for this? or easy way to insall java 8 on docker?
It's up to your using OS, so I'd like you to show your OS. For example, Ubuntu users prepares their ppa repository for Oracle Java.
RUN add-apt-repository ppa:webupd8team/java
RUN apt-get update
RUN apt-get install oracle-java8-installer
It seems that Oracle has changed the authorization for downloading, the actual link that the browser uses is http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm?AuthParam=1496223138_c808095f7637d83147c37d69d3a87e7a, but this cannot be used with curl.
I have no solution for the problem with downloading from Oracle, but I use the official OpenJDK image as base and have found no problems with that.
If openjdk is OK for you, you can use
RUN apt-get install -y openjdk-8-jdk
openjdk, in contrast to oracle, does not require user's confirmation.
If you only need java runtime, consider openjdk-8-jre.
Adaption of my Dockerfile from https://hub.docker.com/r/sftech/java
FROM ubuntu
ENV JAVA_VERSION=8
RUN echo oracle-java${JAVA_VERSION}-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
RUN apt-get update \
&& apt-get install -y software-properties-common \
&& apt-add-repository ppa:webupd8team/java \
&& apt-get update \
&& apt-get install -y oracle-java${JAVA_VERSION}-installer \
&& update-java-alternatives -s java-${JAVA_VERSION}-oracle \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
Why would you install java in an image / container, when you can get a java:8 image from the Docker store for free. The license requirements are exactly the same as the java / jdk download install from the oracle.com website.

How to set java-7-oracle as default java version?

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
I tried to install oracle-java7 on my Linux Mint with the codes above. After executing those codes, I tried to check if its working by typing "java -version" but suddenly an error occured.
bash: /usr/bin/java: cannot execute binary file: Exec format error
You can install a package to set (and keep) oracle-java7 as the default; or you can manually set the java alternative with update-java-alternatives. Something like,
Option 1. sudo apt-get install oracle-java7-set-default
Option 2. sudo update-java-alternatives -s java-7-oracle

How to install Maven 3 on Ubuntu 18.04/17.04/16.10/16.04 LTS/15.10/15.04/14.10/14.04 LTS/13.10/13.04 by using apt-get? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Try:
sudo apt-get install maven
If it works for you ignore the rest of this post.
Intro
I started setting up my Ubuntu 12.10 on April 2013 and the normal sudo apt-get install maven was not working for maven 3 back then.
The manual installation in this post is useful if you like to dig in deeper to your ubuntu kernel in regards with apt-get and where it finds the list of applications that are available for installation on Ubuntu
. It can also be potentially useful for more recent releases of Ubuntu like Ubuntu 15.04, etc. if you face the same problem as I did back then with Ubuntu 12.10.
Automatic Installation via apt-get:
Checkout the manual installation if your current ubuntu can not install maven via common 'apt-get install maven'.
sudo apt-get update
sudo apt-get install maven
Make sure to remove maven 2 if your ubuntu is not fresh or if you were using maven 2 before:
sudo apt-get remove maven2
Manual Installation via apt-get by adding maven 3 repository (Ubuntu 14.04 check out update 1):
This can be useful if your ubuntu apt-get repositories list is not up to date.
Maven 3 was required to set up the system and as it turns out most of the documents out there are referring to how to install Maven to Ubuntu version 12.04 or before. Best document I found was:
killertilapia's blog
The whole process I came up with is as follows:
sudo -H gedit /etc/apt/sources.list
Add the following line the sources.list file:
deb http://ppa.launchpad.net/natecarlson/maven3/ubuntu precise main
deb-src http://ppa.launchpad.net/natecarlson/maven3/ubuntu precise main
sudo apt-get update && sudo apt-get install maven3
sudo ln -s /usr/share/maven3/bin/mvn /usr/bin/mvn
Caution 1: command "sudo apt-add-repository ppa:natecarlson/maven3" did not work on my Ubuntu and had to run sudo apt-add-repository -rm ppa:natecarlson/maven3 to get my apt-get to work again.
Caution 2: thanks to David, you need to remove your existing symbolic link to previous versions of maven before running step 4.
OS X Installation
I decided to add OS X installation in case you use multiple environments for your dev: See the source stackoverflow thread for more details.
Install Homebrew that is the equavalent of apt-get, then install Maven using:
brew install maven
Update 1: Installation for Ubunutu 14.04
Haven't tried this myself but I am confident this should work without security warnings:
sudo apt-get purge maven maven2 maven3
sudo apt-add-repository ppa:andrei-pozolotin/maven3
sudo apt-get update
sudo apt-get install maven3
Note: source here, many thanks and +1s to #rendybjunior, #Dominic_Bartl, and #FunThomas424242
Here's an easier way:
sudo apt-get install maven
More details are here.
It's best to use miske's answer.
Properly installing natecarlson's repository
If you really want to use natecarlson's repository, the instructions just below can do any of the following:
set it up from scratch
repair it if apt-get update gives a 404 error after add-apt-repository
repair it if apt-get update gives a NO_PUBKEY error after manually adding it to /etc/apt/sources.list
Open a terminal and run the following:
sudo -i
Enter your password if necessary, then paste the following into the terminal:
export GOOD_RELEASE='precise'
export BAD_RELEASE="`lsb_release -cs`"
cd /etc/apt
sed -i '/natecarlson\/maven3/d' sources.list
cd sources.list.d
rm -f natecarlson-maven3-*.list*
apt-add-repository -y ppa:natecarlson/maven3
mv natecarlson-maven3-${BAD_RELEASE}.list natecarlson-maven3-${GOOD_RELEASE}.list
sed -i "s/${BAD_RELEASE}/${GOOD_RELEASE}/" natecarlson-maven3-${GOOD_RELEASE}.list
apt-get update
exit
echo Done!
Removing natecarlson's repository
If you installed natecarlson's repository (either using add-apt-repository or manually added to /etc/apt/sources.list) and you don't want it anymore, open a terminal and run the following:
sudo -i
Enter your password if necessary, then paste the following into the terminal:
cd /etc/apt
sed -i '/natecarlson\/maven3/d' sources.list
cd sources.list.d
rm -f natecarlson-maven3-*.list*
apt-get update
exit
echo Done!

Categories

Resources