what is the difference between java-1.7.0-openjdk-i386 and java-7-openjdk-i386 - jvm

when i install netbeans it gives me the option to select the java environment, i have 3 options, the oracle java and these two (java-1.7.0-openjdk-i386 and java-7-openjdk-i386). what is the difference between these two?The os if ubuntu.

The two OpenJDK are same. However OpenJDK is slightly different from Oracle JDK. Read this post for more clarification.
The reason why you are getting two options for OpenJDK is PROBABLY that you have two copies of OpenJDK installed (or two different references to the same directory on your system.)
For further investigation, try to ls -lh /usr/lib/jvm. The /usr/lib/jvm is usually the directory where Java gets installed. Check if one of them is a symbolic link. Also, check in netbeans the location of the two JDK and see if in fact you have two versions or references of Java on the system.
For example, here is the output of ls -lh on my system:
ls -lh
total 24K
lrwxrwxrwx 1 root root 26 Sep 10 13:41 default-java -> /usr/lib/jvm/java-7-oracle
lrwxrwxrwx 1 root root 18 Mar 13 2012 java-1.5.0-gcj -> java-1.5.0-gcj-4.6
drwxr-xr-x 7 root root 4.0K Aug 22 2012 java-1.5.0-gcj-4.6
lrwxrwxrwx 1 root root 19 Jun 26 2012 java-1.6.0-openjdk-i386 -> java-6-openjdk-i386
drwxr-xr-x 3 root root 4.0K Feb 15 10:52 java-6-openjdk-common
drwxr-xr-x 7 root root 4.0K Feb 15 10:52 java-6-openjdk-i386
drwxr-xr-x 8 ankit ankit 4.0K Jun 6 2012 java-6-sun
drwxr-xr-x 5 root root 4.0K Aug 22 2012 java-7-openjdk-i386
drwxr-xr-x 8 root root 4.0K Feb 20 10:40 java-7-oracle
lrwxrwxrwx 1 root root 12 Mar 13 2012 java-gcj -> java-gcj-4.6
lrwxrwxrwx 1 root root 18 Apr 16 2012 java-gcj-4.6 -> java-1.5.0-gcj-4.6
As you can see java-1.6.0-openjdk-i386 is just a symbolic link/reference to another directory named java-6-openjdk-i386

You installed it twice
From openjdk, following instructions from here
sudo apt-get install openjdk-7-jdk
From Stackoverflow, following instructions from here
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
Would recommend the second one and remvong the first one by typing
sudo apt-get remove openjdk-7-jdk.

Related

No module named numpy in Flask

I need to use Numpy on EC2 instance that runs Flask with WSGI-py3, which can be accessed over HTTP.
After setting up everything needed, I can see the page in the browser. However, later I am installing Numpy using pip3 and now the service breaks with the following error in /var/log/apache2/error.log ModuleNotFoundError: No module named 'numpy', however I can import numpy in python3 without any problems
What could be done to be able to import numpy in Flask application?
EDIT:
It is confusing.. If I list all Python versions installed, I get:
0 lrwxrwxrwx 1 root root 9 Oct 25 2018 /usr/bin/python3 -> python3.6
0 lrwxrwxrwx 1 root root 16 Oct 25 2018 /usr/bin/python3-config -> python3.6-config
4 -rwxr-xr-x 1 root root 1018 Oct 28 2017 /usr/bin/python3-jsondiff
4 -rwxr-xr-x 1 root root 3661 Oct 28 2017 /usr/bin/python3-jsonpatch
4 -rwxr-xr-x 1 root root 1342 May 1 2016 /usr/bin/python3-jsonpointer
4 -rwxr-xr-x 1 root root 398 Nov 15 2017 /usr/bin/python3-jsonschema
4424 -rwxr-xr-x 2 root root 4526456 Apr 18 01:56 /usr/bin/python3.6
0 lrwxrwxrwx 1 root root 33 Apr 18 01:56 /usr/bin/python3.6-config -> x86_64-linux-gnu-python3.6-config
4424 -rwxr-xr-x 2 root root 4526456 Apr 18 01:56 /usr/bin/python3.6m
0 lrwxrwxrwx 1 root root 34 Apr 18 01:56 /usr/bin/python3.6m-config -> x86_64-linux-gnu-python3.6m-config
0 lrwxrwxrwx 1 root root 10 Oct 25 2018 /usr/bin/python3m -> python3.6m
0 lrwxrwxrwx 1 root root 17 Oct 25 2018 /usr/bin/python3m-config -> python3.6m-config
pip3 seems to be connected to python3.6
/usr/local/bin/flask uses #!/usr/bin/python3
If I install numpy using /usr/bin/python3 -m pip install numpy I still have the same problem
This probably means, the Python interpreter which runs Flask is a different than the Python interpreter which you have installed numpy into.
Unfortunately, I have no experience with AWS.
Basically, you have to figure out how to find the Python interpreter you installed Flask with.
Using virtual environment in EC2 has helped:
sudo apt-get update
sudo apt-get install apache2
sudo apt-get install libapache2-mod-wsgi-py3
sudo apt-get install python3.6
sudo ln -sT /usr/bin/python3 /usr/bin/python
sudo apt-get install python3-pip
sudo ln -sT /usr/bin/pip3 /usr/bin/pip
sudo pip install flask
sudo apt-get install virtualenv
mkdir ~/flaskapp
sudo ln -sT ~/flaskapp /var/www/html/flaskapp
cd ~/flaskapp
virtualenv flask --python=python3
sudo vim /etc/apache2/sites-enabled/000-default.conf:
.....
sudo pip3 install numpy
...

Proper permissions for website directories and to enable rsync deployment

I'm setting up a new website on a new Ubuntu droplet at Digital Ocean. I set this up previously on a different droplet and rsynced the website contents to it. I followed directions I found on the web, but didn't keep detailed-enough notes. I'm just trying to replicate this on the new Droplet. But I've messed up somehow. My knowledge of permissions, etc. is rudimentary :-(
My server has: /var/www/html
This is what I did:
• sudo usermod -a -G www-data [myusername]
• sudo chown -R www-data:www-data /var/www
• sudo chmod -R g+rw /var/www
• sudo chmod -R g+rws /var/www
I then created “/var/www/howardmann.us/public_html” for my website.
(I didn't put the public_html directory in var/www/html. I didn't on my other Droplet. Perhaps I should.)
sudo ls -la /var/www
total 16
drwxrwsr-x 4 www-data www-data 4096 Feb 25 15:43 .
drwxr-xr-x 14 root root 4096 Feb 24 14:27 ..
drwxr-sr-x 3 root www-data 4096 Feb 25 15:43 howardmann.us
drwxrwsr-x 2 www-data www-data 4096 Feb 25 15:42 html
sudo ls -la /var/www/howardmann.us/public_html
total 8
drwxr-sr-x 2 root www-data 4096 Feb 25 15:43 .
drwxr-sr-x 3 root www-data 4096 Feb 25 15:43 ..
Now, excerpts of rsync script (successful to my other Droplet) result from my laptop now:
1.
howardm$ ./deploy.sh
sending incremental file list
rsync: failed to set times on "/var/www/howardmann.us/public_html/.": Operation not permitted (1)
rsync: recv_generator: mkdir "/var/www/howardmann.us/public_html/css" failed: Permission denied (13)
* Skipping any contents from this failed directory *
3.
rsync: mkstemp "/var/www/howardmann.us/public_html/.DS_Store.8zaaQg" failed: Permission denied (13)
Question: How do I fix ownership and permissions on the server directories for 1) proper permissions for a website and 2) permit a rsync deploy?
For comparison, here is the status of my current working web site on the other Droplet:
howardm#howardmann:~$ ls -la /var/www/
total 20
drwxrwxr-x 5 howardm www-data 4096 Mar 5 2016 .
drwxr-xr-x 13 root root 4096 Mar 28 2015 ..
drwxrwxr-x 4 howardm www-data 4096 Jun 8 2016 howardmann.us
drwxrwxr-x 2 howardm www-data 4096 Mar 29 2015 html
Thanks!
Howard
Well, I fixed this after reading some more about permissions for a website.
My website folder is titled howardmann.us, which contains a public_html folder with the website contents.
So: /var/www/howardmann.us/public_html. (/var/www also contains a html directory)
I achieved the relevant ownership/permissions with:
sudo chown -R howardm:www-data /var/www/
I'm the owner, and www-data the group.
sudo usermod -a -G www-data [myusersername]
I'm a member of the www-data group
sudo chmod -R 2775 /var/www/
This yields the proper permissions, I believe for a web site.
I made sure the same owner:group applied to all these directories:
ls -l /var/www
total 8
drwxr-sr-x 3 howardm www-data 4096 Feb 26 19:23 howardmann.us
drwxrwsr-x 2 howardm www-data 4096 Feb 25 15:42 html
ls -l /var/www/howardmann.us
total 4
drwxr-xr-x 11 howardm www-data 4096 Feb 5 2017 public_html
Now rsync works without errors.
If anyone believes these ownership/permissions for a website are (substantially) improper, please comment.
Howard

Can Graphite (whisper) metrics be aliased?

There is a function named alias, that I tried as given below
http://myhost:80/render?target=alias(my.src.metrics.endTime,"my.target.metrics.success_endTime")
But I want to create my.target.metrics.success_endTime persistent in the graphite for my.src.metrics.endTime. so that new values under the my.src... are also available via my.target....
However, you can't configure persistent aliases in graphite's UI (webapp), you may create symbolic link on the filesystem, that will behave like an alias
./graphite/whisper/my$ ll
drwxr-xr-x 6 graphite graphite 4096 Dec 28 2016 src/
./graphite/whisper/my$ ln -s src target
./graphite/whisper/my$ ll
drwxr-xr-x 6 graphite graphite 4096 Dec 28 2016 src/
lrwxrwxrwx 1 root root 4 Dec 28 2016 target -> src/
Path my.target.* will be findable.
Other soltuion is to use different front/dashboard UI like Grafana and make use of variables - http://docs.grafana.org/reference/templating/

maxminddb module for apache 2.4 on ubuntu error: The MaxMind DB file contains invalid metadata

here is my system information:
$ apachectl -v
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2016-07-14T12:32:26
$ cat /etc/*release* | grep -i dist
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS"
$ uname -r
4.4.0-57-generic
i wish to install mod_maxminddb. i installed geoipupdate as a prerequisites and configured it to include not only geolite database, but either commercial one (using this)
$ ls -l /etc/GeoIP.conf
-rw-r--r-- 1 root root 818 Dec 24 18:29 /etc/GeoIP.conf
$ ls -l /usr/share/GeoIP/
total 0
$ geoipupdate
$ ls -l /usr/share/GeoIP/
total 187444
-rw-r--r-- 1 root root 112192399 Dec 24 18:46 GeoIP2-City.mmdb
-rw-r--r-- 1 root root 3012279 Dec 24 18:46 GeoIP2-Country.mmdb
-rw-r--r-- 1 root root 47721533 Dec 24 18:46 GeoIPCity.dat
-rw-r--r-- 1 root root 1699494 Dec 24 18:45 GeoIP.dat
-rw-r--r-- 1 root root 4189407 Dec 24 18:45 GeoIPISP.dat
-rw-r--r-- 1 root root 4299547 Dec 24 18:45 GeoLiteASNum.dat
-rw-r--r-- 1 root root 17760694 Dec 24 18:45 GeoLiteCity.dat
-rw-r--r-- 1 root root 1054583 Dec 24 18:45 GeoLiteCountry.dat
then complied and installed the mod_maxminddb, and when apache is configured to use the commercial databases, the following error is thrown
$ apachectl -M
AH00526: Syntax error on line 12 of /etc/apache2/mods-enabled/maxminddb.conf:
MaxMindDBFile: Failed to open /usr/share/GeoIP/GeoIPCity.dat: The MaxMind DB file contains invalid metadata
but that is not the case when apache is configured to use the geolite databases.
any ideas?
You didn't include your Apache config, but you appear to be trying to use mod_maxminddb with GeoIPCity.dat (GeoIP Legacy). It only works with GeoIP2. Adjust line 12 of maxminddb.conf to use GeoIP2-City.mmdb instead.

Debian - Install cmake from pre-compiled binaries

I'm running Debian 8.5 (jessie), but I need cmake 3.5.2 and with apt-get it installed 3.0.2.
So, I downloaded from cmake.org site: wget https://cmake.org/files/v3.6/cmake-3.6.0-rc2-Linux-x86_64.sh
When unpacked I got the files
$ ls -la
total 24
drwxr-xr-x 6 ricardo ricardo 4096 Jun 13 20:22 .
drwxr-xr-x 6 ricardo ricardo 4096 Jun 13 20:22 ..
drwxr-xr-x 2 ricardo ricardo 4096 Apr 15 10:00 bin
drwxr-xr-x 3 ricardo ricardo 4096 Apr 15 10:00 doc
drwxr-xr-x 4 ricardo ricardo 4096 Apr 15 10:00 man
drwxr-xr-x 7 ricardo ricardo 4096 Apr 15 10:00 share
I didn't find any script, make file, or something like that. So, I copied manually bin to /usr/bin,
/man/man1/* to /usr/share/man/man1,
/man/man7/* to /usr/share/man/man7, and
/share/cmake-3.5 to /usr/share/cmake-3.5
But there is not a script to do this automatically?
On the site https://cmake.org/install/, they talk about a ./bootstrap script, but it didn't come on the package.
There are several possible approaches for building CMake from a source tree: If there is no existing CMake installation, a bootstrap script is provided:
Meaning if you got the source tarball, do this. Since you got the binaries you don't need this.
It is however considered bad practice to just copy over installs like this to your /usr tree. For one this will interact with updates to the cmake package from debian. Have you tried installing the cmake packages from sid?