Skip to main content

7 posts tagged with "Ubuntu"

Hola tag description

View All Tags

Install Gradle on Ubuntu

· One min read
Sandeep Bhardwaj
  1. Download the latest Gradle version from Gradle Download page.

  2. Extract the binaries to the desired location.

  3. Set the GRADLE_HOME environment variable.

Setting the environment variable in Ubuntu in really easy, just need to edit the /etc/profile. Just add your gradle installation directory as below.

Open the /etc/profile file in your favorite editor.

sudo gedit /etc/profile

Add below lines in end.

GRADLE_HOME=/data/dev/tools/gradle-2.10
PATH=$PATH:$GRADLE_HOME/bin
export GRADLE_HOME
export PATH
Verify the GRADLE_HOME
echo $GRADLE_HOME
Verify the Gradle version
gradle -v
Output
------------------------------------------------------------
Gradle 2.10
------------------------------------------------------------

Build time: 2015-12-21 21:15:04 UTC
Build number: none
Revision: 276bdcded730f53aa8c11b479986aafa58e124a6

Groovy: 2.4.4
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.8.0_60 (Oracle Corporation 25.60-b23)
OS: Linux 3.19.0-47-generic amd64

Set GRADLE_USER_HOME on Ubuntu

Next if you wants to override the default location of gradle local repository.

Again edit the /etc/profile like we did it above and add below line in the end.

export GRADLE_USER_HOME=/data/dev/repository/gradle

Set Maven Home on Ubuntu

· One min read

Setting the environment variable in Ubuntu in really easy, just need to edit the /etc/profile. Just add your maven installation directory as below.

Open the /etc/profile file in your favorite editor.

sudo gedit /etc/profile

Add following lines in end

M2_HOME=/data/dev/tools/apache-maven-3.3.9
PATH=$PATH:$M2_HOME/bin
export M2_HOME
export PATH

Verify the M2_HOME

echo $M2_HOME

Check the maven version

mvn -v

Output

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T22:11:47+05:30)
Maven home: /data/dev/tools/apache-maven-3.3.9
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: /usr/local/java/jdk1.8.0_60/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.19.0-47-generic", arch: "amd64", family: "unix"

Enable minimize button in Google chrome on Elementary OS

· One min read
Sandeep Bhardwaj

By default Google chrome do not have minimize button on Elementary OS and we can't enable it by using Elementary tweak tool. But we can make it enable by modifying the gConfigurations. Just type the below line in terminal and its done.

gconftool-2 --set /apps/metacity/general/button_layout --type string ":minimize:maximize:close"

Renaming files using terminal on ubuntu

· One min read
Sandeep Bhardwaj

Suppose we have lots of lots file in a directory and we need to rename of modify the extension of all the file, then renaming one by one is pain and not a good idea as well.

If we want to rename all the files in directory in one shot then we can use below command.

Example:- Renaming all file with extension html to md.

find -L . -type f -name "*.html" -print0 | while IFS= read -r -d '' File_Name; do
mv -- "$File_Name" "${File_Name%.html}.md"
done

Starting and Stopping the MySQL Server

· One min read

By Default MySQL server is started automatically after installation. Wd can check/verify the status of the MySQL server with the following command:

sudo service mysql status

Stop the MySQL server with the following command:

sudo service mysql stop

To restart the MySQL server, use the following command:

sudo service mysql start

Set Java Home on Ubuntu

· One min read

Setting the environment variable in Ubuntu in really easy, just need to edit the /etc/profile. Just add your java installation directory as below.

Open the /etc/profile file in your favorite editor.

sudo gedit /etc/profile

Add following lines in end

JAVA_HOME=/usr/local/java/jdk1.8.0_60
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH

Note: For Installing Java on Ubuntu follow the

Install Oracle JDK on Ubuntu

· 2 min read
  1. Download the jdk-8u60-linux-x64.tar.gz from the Oracle site (Download 64bit or 32bit based on your linux environment).

  2. If you have root access then install java system-wide inside /usr/local directory.

First create a directory named java inside /usr/local

sandeep@vivan:~$ sudo mkdir /usr/local/java/

after that change directory

sandeep@vivan:~$ cd /usr/local/java/

Note: If you do not have access to root then install java inside your home directory.

  1. Unpack the tarball and install Java
sandeep@vivan:/usr/local/java$ sudo tar zxvf ~download/jdk-8u60-linux-x64.tar.gz

The Java files are installed in a directory /usr/local/java/jdk1.8.0_60/

  1. Install the new Java source in system:
sudo update-alternatives --install /usr/bin/javac javac /usr/local/java/jdk1.8.0_60/bin/javac 1
sudo update-alternatives --install /usr/bin/java java /usr/local/java/jdk1.8.0_60/bin/java 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/local/java/jdk1.8.0_60/bin/javaws 1
  1. Choose default Java:
sudo update-alternatives --config javac
sudo update-alternatives --config java
sudo update-alternatives --config javaws
  1. Check the Java version:
java -version
Output
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
  1. Verify the symlinks all point to the new Java location:
ls -la /etc/alternatives/java*
Output
lrwxrwxrwx 1 root root 36 Sep 24 19:27 /etc/alternatives/java -> /usr/local/java/jdk1.8.0_60/bin/java
lrwxrwxrwx 1 root root 37 Sep 24 15:00 /etc/alternatives/javac -> /usr/local/java/jdk1.8.0_60/bin/javac
lrwxrwxrwx 1 root root 38 Sep 24 15:06 /etc/alternatives/javaws -> /usr/local/java/jdk1.8.0_60/bin/javaws

Note: For Setting Java HOME on Ubuntu follow the