Skip to content

Instantly share code, notes, and snippets.

@rafi
Last active December 21, 2015 01:09
Show Gist options
  • Select an option

  • Save rafi/6225495 to your computer and use it in GitHub Desktop.

Select an option

Save rafi/6225495 to your computer and use it in GitHub Desktop.
Don't use it. Use Arch linux. ## Provisioning a new Ubuntu-based workstation, installs: - Git (latest, with repository `git-core/ppa`) - Java 6 (latest, with repository `webupd8team/java`) - f.lux (latest, with repository `kilian/f.lux`) - Google Chrome (latest) - PhpStorm (latest) - Sublime Text 2 (latest) - Virtualbox (latest) - CopyQ 1.9.1 - …
#!/bin/bash
# Check if we are root
if [ $UID -ne 0 ]; then
echo "Please run this as root!"
exit 255
fi
# Check if we are on Ubuntu
set distro=$(lsb_release -is)
if [ "$distro" != "Ubuntu" ] && [ "$distro" != "elementary OS" ]; then
echo "This script is only intended to run on Ubuntu and ElementaryOS"
exit 100
fi
# Get codename
codename=$(lsb_release -cs)
if [ "$codename" == "luna" ] && [ "$distro" == "elementary OS" ]; then
codename="precise"
fi
# -----------------------------------------------------------------------
# | Setup |
# -----------------------------------------------------------------------
setup() {
# Add new repositories
add-apt-repository -y ppa:git-core/ppa # git
add-apt-repository -y ppa:webupd8team/java # java
add-apt-repository -y ppa:kilian/f.lux # f.lux
# Hipchat repo
echo "deb http://downloads.hipchat.com/linux/apt stable main" > /etc/apt/sources.list.d/atlassian-hipchat.list
wget -O - https://www.hipchat.com/keys/hipchat-linux.key | apt-key add -
# Upgrade system
apt-get update
apt-get upgrade
}
# -----------------------------------------------------------------------
# | Install |
# -----------------------------------------------------------------------
install () {
# Libraries and utilities
apt-get install -y hipchat oracle-java6-installer synaptic synapse ttf-mscorefonts-installer gimp vlc pinta libreoffice-writer libreoffice-calc terminator xclip gpick fluxgui meld vim git gitk git-gui gitg
# Install Chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dpkg -i ./google-chrome*.deb
# Install Web stack
apt-get install -y mysql-server mysql-client apache2 php5 libapache2-mod-php5 php5-mysql php5-curl php5-gd php-pear php5-imagick php5-mcrypt php5-memcache php5-sqlite php5-tidy php5-xmlrpc php5-xsl phpmyadmin
a2enmod rewrite
usermod -a -G www-data $username
mkdir ~/www
chown -R $username:www-data ~/www
chmod -R 775 ~/www/
service apache2 restart
# Install PhpStorm
wget "`wget --quiet -O - www.jetbrains.com/phpstorm/download/download_thanks.jsp?os=linux | grep -ohm 1 "http://download.jetbrains.com/webide/PhpStorm-.*\.tar\.gz"`"
mkdir /opt/jetbrains
tar xzf PhpStorm-*.tar.gz -C /opt/jetbrains
# Install Sublime Text 2
wget "`wget --quiet -O - www.sublimetext.com/2 | grep -ohm 1 "http://.*Sublime.Text.*64.*\.tar\.bz2"`"
tar xjf Sublime*Text*.tar.bz2 -C /opt
# Install Virtualbox
apt-get install libqt4-opengl
wget "`wget --quiet -O - www.virtualbox.org/wiki/Linux_Downloads | grep -ohm 1 "http://download.virtualbox.org/virtualbox/[\.0-9]*/virtualbox-[\._0-9]*-[0-9]*~Ubuntu~quantal_amd64\.deb"`"
dpkg -i ./virtualbox-*_amd64.deb
# Install copyq
apt-get install libqtwebkit4
wget https://launchpad.net/~samrog131/+archive/ppa/+files/copyq_1.9.1~$codename~ppa1_amd64.deb
dpkg -i copyq_1.9.1~$codename~ppa1_amd64.deb
# Install VStudio
wget -O vstudio_x64.deb `wget --quiet -O - http://www.valentina-db.com/en/applications-download/valentina-studio | tr '\n' ' ' | grep -Pohm 1 "Valentina Studio, 64 bit for Linux, DEB.*?<a href=['"'"'"][^"'"'"']*['"'"'"]" | sed -e 's/.*<a href=["'"'"']//' -e 's/["'"'"']$//' | sed -e 's/\&amp\;/\&/g'`
dpkg -i vstudio_x64.deb
# Install utils
apt-get install ant aria2 dconf-tools feh espeak fonts-liberation gcc ghex gcolor2 gparted htop ranger multitail sqlite3 xchat
# Install KeePassX 2.0 alpha4
mkdir /home/$username/src
apt-get install -y build-essential qt4-qmake cmake libgcrypt-dev libxtst-dev libqt4-dev
wget --no-check-certificate http://www.keepassx.org/dev/attachments/download/36/keepassx-2.0-alpha4.tar.gz
tar xzf keepassx-2.0-alpha4.tar.gz -C /home/$username/src
mkdir /home/$username/src/keepassx-2.0-alpha4/build
cd /home/$username/src/keepassx-2.0-alpha4/build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local
make
make install
cp /usr/share/app-install/desktop/keepassx:keepassx.desktop /usr/share/applications/keepassx.desktop
apt-get remove --purge qt4-qmake libdrm-dev libdrm-nouveau2 libgl1-mesa-dev libglu1-mesa-dev libkms1 libqt4-designer libqt4-help libqt4-opengl-dev libqt4-qt3support libqt4-scripttools libqt4-svg libqt4-test libqtwebkit-dev mesa-common-dev qt4-linguist-tools cmake libgcrypt-dev libxtst-dev libqt4-dev
cd -
# PhantomJS
wget "`wget --quiet -O - http://phantomjs.org/download.html | tr '\n' ' ' | grep -ohm 1 "https://phantomjs.googlecode.com/files/phantomjs-[0-9]*.[0-9]*.[0-9]*-linux-x86_64.tar.bz2"`"
tar xjf phantomjs-*-linux-x86_64.tar.bz2 -C /tmp
mv /tmp/phantomjs-*-linux-x86_64/bin/phantomjs /usr/local/bin/
rm -rf /tmp/phantomjs-*-linux-x86_64
# Install Aqua DataStudio
# missing
# Clean up
sudo apt-get autoremove -y
}
# -----------------------------------------------------------------------
# | Main |
# -----------------------------------------------------------------------
main () {
read -p "Type the username for this computer: " username
if [ "$username" == "" ] ;then
echo "Please enter a valid user name"
exit 1
fi
echo "Welcome ${username} !"
echo "Setting up repositories..."
setup
echo "Installing software..."
install
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment