Wednesday, June 24, 2015

Desktop Market Share - 2015

I have just found out this interesting statistics about desktop computers. And it tells me some more interesting possibilities:

- Apple Operating System is by far better than Windows in everything, everybody know this. But according to these statistics, it is the 5th most popular OS. Well, it is not that easy to work a "hackintosh", and Apple OS is originally installed on Apple computers ONLY, wich are MUCH more expensive than PCs, like this old I5 of mine.

- Windows XP is still under that heavy use? SERIOUSLY? Unless you pay MS for it, you will not have the security updates that you really need. And most people will definitively not pay for this. But, they are still using XP for activities like ... their bank account. This is insane, almost a financial suicide. But, I think that the word "security" is still not clear enough to people in general. Until something bad really happens.


- Okay, Linux definitively is not ready for desktops, although I've been using it for almost 10 years, and I DO CONSIDER it as the most affordable and safe option. But anyway, Linux market share has overcame the old Apple OS versions. No, it is not superior to these recently old Apple OS versions (not yet, and it will take a long time to happen). Apple users update their OS more frequently than Linux and Windows users, and older versions become less used very quickly. That's why Linux has "beaten" them.

This universe of desktops, will always be so difficult to be understood...

The full statistic link can be read here.

Saturday, June 20, 2015

Installing Java 8 in Ubuntu

I have another post here about how to do this. But it is outdated, and I decided to rewrite it.

There are more simple ways to have Java installed on your Linux. But I do prefer do make it step by step, in the command line. Let's suppose that we are installing version 8.45 of Java
  1. Download Java 8 JDK from Oracle. Accept it's License Agreement, and select jdk-8u45-linux-x64.tar.gz to be downloaded, if your system is 64bits or jdk-8u45-linux-i586.tar.gz if it is 32 bits.
    If you are in doubt about your system, you may confirm with the following command:


    uname -m

    If the answer is x86_64, you have a 64 bits Ubuntu. If the answer is  i686, you have a 32 bits Ubuntu.
  2. Create a variable jv that will point to the installation directory of Java. By downloading the jdk-8u45-linux-x64.tar.gz, we will have /usr/lib/jdk1.8.0_45 as the installation directory.
    We need to create another variable ub, that will point to the the system binaries.
    We do that with the following command:

    jv="/usr/lib/jdk1.8.0_45"
    ub="/usr/bin"
    ATTENTION:
    Not only copy and paste above lines.
    Update Java version in variable jv.
     
  3. I usually do not use the previous versions, so I do remove them Since I always install them in /usr/lib, I will remove them with the following command:
    sudo rm -rfv /usr/lib/jdk* /usr/lib/jvm/jdk*
    

    It is important to repeat to the novice: The command above wil permanently delete the contents of
     /usr/lib/ e /usr/lib/jvm/ that start with jdk. Be sure you do not have in there any other files or directories that may be deleted.
    ATTENTION:
    In case you are not sure whether you may delete this files or not, just do not do it.
      
  4. Open the file you have downloaded from Oracle in /usr/lib/:

    sudo tar xf jdk-8u45-linux-x64.tar.gz -C /usr/lib/
  5. Update alternatives system with the binaries of this version of Java:

    sudo update-alternatives --install ${ub}/java java ${jv}/bin/java 1
    sudo update-alternatives --install ${ub}/jcontrol jcontrol ${jv}/bin/jcontrol 1
    sudo update-alternatives --install ${ub}/javac javac ${jv}/bin/javac 1
    sudo update-alternatives --install ${ub}/javaws javaws ${jv}/bin/javaws 1
    sudo update-alternatives --install ${ub}/keytool keytool ${jv}/jre/bin/keytool 1
    sudo update-alternatives --install ${ub}/pack200 pack200 ${jv}/jre/bin/pack200 1
    sudo update-alternatives --install ${ub}/rmid rmid ${jv}/jre/bin/rmid 1
    sudo update-alternatives --install ${ub}/rmiregistry rmiregistry ${jv}/jre/bin/rmiregistry 1
    sudo update-alternatives --install ${ub}/unpack200 unpack200 ${jv}/jre/bin/unpack200 1
    sudo update-alternatives --install ${ub}/servertool servertool ${jv}/jre/bin/servertool 1
    sudo update-alternatives --install ${ub}/tnameserv tnameserv ${jv}/jre/bin/tnameserv 1
    sudo update-alternatives --install ${ub}/jexec jexec ${jv}/jre/lib/jexec 1

    The following command only applies to 32 bits desktop systems:

    sudo update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so ${jv}/jre/lib/i386/libnpjp2.so 1

    The following command only applies to 64 bits desktop systems:

    sudo update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so ${jv}/jre/lib/amd64/libnpjp2.so 1
     
  6. In case of having more than one Java version installed, only one will be the default version. The following command will perform this action:

    for i in keytool jcontrol pack200 rmid rmiregistry unpack200 servertool tnameserv jexec java javac mozilla-javaplugin.so javaws; do sudo update-alternatives --config ${i}; echo; done

    The above instruction will list all available versions of each binary, if they exist. Choose those listed in step 2. If not, you will obviously have nothing to choose.
After that, we should test the installation to confirm that it is all ok:
java -version
javac -version
Now, we need to set the environment variables correctly. I adapted it from WikiHow. You must edit /etc/profile, adding the following lines by the end of it:
# Environment Java Variables defined IF Java is listed in "alternatives"
if [ -h /etc/alternatives/java ]; then
     a=$(/bin/ls -l /etc/alternatives/java | cut -d \> -f2|cut -d' ' -f2)
     export JAVA_HOME=${a%/bin/java}
     export PATH=${PATH}:${JAVA_HOME}/bin
fi
After editing /etc/profile, we need to close this user section and open it again. Finally, to check it use the following commands:
echo $JAVA_HOME
You will have /usr/lib/jdk1.8.0_45 as answer, according to the version you installed.
echo $PATH
Will give you the whole PATH, and by the end the Java directory. On mine the answer was /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jdk1.8.0_45/bin


Most of this article was written after studying Ubuntu Documentation and resolving some problems on Tomcat7 instalation at a Ubuntu Server.

If you liked it, please write a comment or click on "+1" button.

And, we are back ...

After a long time with no addings, I will restart this as my notebook. I hope it helps many with their Linux struggles.

Saturday, March 30, 2013

Ubuntu MD5SUM Hashes

Have you ever needed to check MD5SUM hashes of any downloaded file? Ubuntu ISOs can always be checked here:
https://help.ubuntu.com/community/UbuntuHashes
After downloading your ISO file, you should always check it's MD5 hash:

$ md5sum Documentos/ISOs/lubuntu-12.10-desktop-*
bddb521817360540c0e54616427c003e  lubuntu-12.10-desktop-amd64.iso
a7fed6c40b4969d4a3c9c0a9ee228cf2  lubuntu-12.10-desktop-i386.iso
You can read the lines above as follows:
1) MD5 hash for lubuntu-12.10-desktop-amd64.iso is bddb521817360540c0e54616427c003e
2) MD5 hash for lubuntu-12.10-desktop-i386.iso is a7fed6c40b4969d4a3c9c0a9ee228cf2

With both hashes, access the page mentioned above and search for the name of ISO file. If the hash from the page is EXACTLY the same you got, so the file is okay, and you can make the correct use of it.

Make me know if it was somehow useful for you!

Monday, March 4, 2013

Manual instalation of Oracle Java on Ubuntu

This is the English version of this article of mine.

I had some versions of Java JDK installed in my Ubuntu Server 10.04, and I needed to install a new version (7u15). Here how I did it, trying to go straight to the point. This works for every Ubuntu (Desktop or Server) up to 12.10 (Quantal Quetzal).

  1. This is my crowded JVM directory:

    $ ls -lh /usr/lib/jvm/

    total 12K
    lrwxrwxrwx 1 root root   21 2012-05-27 20:19 java -> /usr/lib/jvm/jdk1.7.0_15
    drwxr-xr-x 4 root root 4,0K 2012-07-16 21:19 java-1.5.0-gcj-4.4
    drwxr-xr-x 8 root root 4,0K 2012-07-26 11:17 java-7-oracle
    drwxr-xr-x 8  500  143 4,0K 2013-02-15 18:21 jdk1.7.0_15


     
  2. I do not want a messy system. So I wiped it all up.

    $ sudo rm /usr/lib/jvm/j*
     
  3. Download Java JDK from Oracle. Today, this is the correct link for it. Choose the .tar.gz version. I downloaded both architecture versions:
    1. jdk-7u15-linux-i586.tar.gz
    2. jdk-7u15-linux-x64.tar.gz
  4.  Unpack the tar file to the correct directory, which is /usr/lib/jvm/. If this does not exist, create it.

    $ sudo tar xf jdk-7u15-linux-x64.tar.gz -C /usr/lib/jvm/
     
  5. Make each binary of ths new version of Java visible to Alternatives system:

    $ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_15/bin/java" 1

    $ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_15/bin/javac" 1

    $ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_15/bin/javaws" 1

    This is for 32bits systems:
    $ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/
    jdk1.7.0_15/jre/lib/i386/libnpjp2.so" 1

    This is for 64bits systems:

    $ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/
    jdk1.7.0_15/jre/lib/amd64/libnpjp2.so" 1
  6. Choose each one of the binaries correctly:

     $ sudo update-alternatives --config java
     $ sudo update-alternatives --config javac
     $ sudo update-alternatives --config mozilla-javaplugin.so
     $ sudo update-alternatives --config javaws

This last step will list the versions available, if any. Choose the one from /usr/lib/jvm/jdk1.7.0_15, for this example.


After that, you just need to test the version. Do this for each one of the binaries:
$ java -version  
$ javac -version
This article was built upon Ubuntu Documentation.