Skip to content

Instantly share code, notes, and snippets.

@spences10
Last active August 20, 2022 19:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save spences10/5253968 to your computer and use it in GitHub Desktop.
Save spences10/5253968 to your computer and use it in GitHub Desktop.
Shell script to Install Java and IntelliJ for Ubuntu
#!/bin/sh
# Sources:
# http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
# http://askubuntu.com/questions/272314/setup-and-install-intellij-with-jdk
# https://gist.github.com/tahl/1658401
# guide on setting up IntelliJ from Tony Owen
# http://droidapp.co.uk/2012/12/29/switching-to-intellij-installation-and-setup/
# I have amended for my own purposes please refer to considerations in the Ask Ubuntu post
# add java repository
add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
java -version
# install that $hit
sudo update-java-alternatives -s java-7-oracle
sudo echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
sudo apt-get install oracle-java7-set-default
# install the android sdk
if [ ! -d "/usr/local/android-sdk" ]; then
for a in $( wget -qO- http://developer.android.com/sdk/index.html | egrep -o "http://dl.google.com[^\"']*linux.tgz" ); do
wget $a && tar --wildcards --no-anchored -xvzf android-sdk_*-linux.tgz; sudo -v; sudo mv android-sdk-linux /usr/local/android-sdk; sudo -v; sudo chmod 777 -R /usr/local/android-sdk; rm android-sdk_*-linux.tgz;
done
else
echo "Android SDK already installed to /usr/local/android-sdk. Skipping."
fi
cd /usr/local/android-sdk/tools
./android
# install adb & fastboot
sudo add-apt-repository ppa:phablet-team/tools
sudo apt-get update
sudo apt-get install phablet-tools android-tools-adb android-tools-fastboot
# install IntelliJ
cd /usr/local/
mkdir idea
cd /usr/local/idea
wget -O /tmp/intellij.tar.gz http://download.jetbrains.com/idea/ideaIC-12.0.4.tar.gz
tar xfz /tmp/intellij.tar.gz
cd idea-IC-123.169/bin
./idea.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment