CentOS에서 gradle 설치하는 방법을 알아본다 ^^

참고 : https://gist.github.com/parzonka/9371885


우선 자바가 필요함

setup-java-centos.sh

#!/bin/bash

# version 8

jdk_ver="8u25-b17"


echo "Java Version = ${jdk_ver:0:1}($jdk_ver)"


yum -y update

yum -y install wget


# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/$jdk_ver/jdk-${jdk_ver%-*}-linux-x64.rpm"

curl -L -o jdk-${jdk_ver%-*}-linux-x64.rpm -H 'Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com; oraclelicense=accept-securebackup-cookie' http://download.oracle.com/otn-pub/java/jdk/$jdk_ver/jdk-${jdk_ver%-*}-linux-x64.rpm

rpm -Uvh jdk-${jdk_ver%-*}-linux-x64.rpm


java -version


Gradle 설치

setup-gradle-centos.sh

#!/bin/bash

gradle_version=2.2.1


yum -y install unzip


# installs to /opt/gradle

# existing versions are not overwritten/deleted

# seamless upgrades/downgrades

# $GRADLE_HOME points to latest *installed* (not released)

mkdir /opt/gradle

wget -N http://services.gradle.org/distributions/gradle-${gradle_version}-all.zip

unzip -oq ./gradle-${gradle_version}-all.zip -d /opt/gradle

ln -sfnv gradle-${gradle_version} /opt/gradle/latest

printf "export GRADLE_HOME=/opt/gradle/latest\nexport PATH=\$PATH:\$GRADLE_HOME/bin" > /etc/profile.d/gradle.sh

. /etc/profile.d/gradle.sh


# check installation

gradle -v


해당 gradle 설치 스크립트는 1.11, 1.12에서도 동작한다.