Created
October 27, 2013 20:43
-
-
Save wyanez/7187664 to your computer and use it in GitHub Desktop.
Script de Instalación de Paquetes para Ubuntu 13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Scripts de Instalacion de Paquetes para Ubuntu 13.04 | |
# William Yanez - | |
# | |
# Creado 26/06/11 | |
# Actualizado al 31/01/2012 (Ubuntu 11.10) | |
# Actualizado al 12/02/2013 (Ubuntu 12.04) | |
# Actualizado al 03/06/2013 (Ubuntu 13.04) | |
####################### FUNCIONES DE INSTALACION ############################### | |
#USUARIO GENERAL | |
function user_common(){ | |
apt-get install -y aptitude | |
#Soporte de idiomas espanol | |
apt-get install -y wspanish poppler-data myspell-es openoffice.org-hyphenation libreoffice-l10n-es libreoffice-help-es thunderbird-locale-es thunderbird-locale-es-ar thunderbird-locale-es-es | |
apt-get install -y manpages-es manpages-es-extra | |
dpkg-reconfigure locales | |
apt-get install -y ubuntu-restricted-extras | |
# Utilidades: Unity Tweak Toll Compresores: unrar,p7zip Visor de CHM: xcm y Antivirus ClamAV | |
aptitude install -y unrar p7zip xchm clamav clamtk | |
aptitude install -y unity-tweak-tool | |
# Fuentes ttf | |
aptitude install -y ttf-sil-gentium ttf-sil-gentium-basic | |
#Navegador Chromium | |
aptitude install -y chromium-browser chromium-browser-l10n | |
#Reproductor VLC | |
aptitude install -y vlc | |
#Wine - Emulador de Windows | |
aptitude install -y wine | |
#Extensiones para nautilus | |
aptitude install -y nautilus-image-converter nautilus-image-manipulator | |
aptitude install -y nautilus-open-terminal nautilus-pastebin | |
aptitude install -y youtube-dl | |
# Skype | |
wget -c http://www.skype.com/go/getskype-linux-ubuntu-32/skype-ubuntu-precise_4.1.0.20-1_i386.deb -O skype32.deb | |
dpkg -i skype32.deb | |
apt-get -f install # dependencia libqt4-webkit | |
} | |
function dev_config_nano(){ | |
OF=$HOME/.nanorc | |
echo "Configurando Nano Editor...$OF" | |
echo "set tabsize 4" > $OF | |
echo "set tabstospaces">> $OF | |
echo "set autoindent">> $OF | |
echo "set const">> $OF | |
echo "set cut">> $OF | |
echo "set mouse">> $OF | |
echo "Listo...$OF" | |
chown $SUDO_USER: $OF | |
} | |
function git_config_init(){ | |
if [ $# -eq 2 ]; then | |
USUARIO=$1 | |
EMAIL=$2 | |
else | |
echo "ATENCION: No se configurara Git" | |
return | |
fi | |
if [ -f $HOME/.gitconfig ]; then | |
echo "Atención: Ya Git se encuentra configurado..." | |
else | |
echo "Configurando Git..." | |
git config --global user.name "$USUARIO" | |
git config --global user.email "$EMAIL" | |
git config --global color.status auto | |
git config --global color.branch auto | |
git config --global color.diff auto | |
echo "Listo!" | |
chown $SUDO_USER: $HOME/.gitconfig | |
fi | |
git config --list | |
} | |
function hg_config_init(){ | |
if [ $# -eq 2 ]; then | |
USUARIO=$1 | |
EMAIL=$2 | |
else | |
echo "ATENCION: No se configurara Mercurial" | |
return | |
fi | |
OF=$HOME/.hgrc | |
if [ -f $OF ]; then | |
echo "Atención: Ya Mercurial se encuentra configurado..." | |
else | |
echo "Configurando Mercurial ... $OF" | |
echo "[ui]">$OF | |
echo "username = $USUARIO <$EMAIL>">>$OF | |
echo "Listo!" | |
chown $SUDO_USER: $OF | |
fi | |
cat $OF | |
} | |
function crear_sshkey(){ | |
echo ">>> Creando llaves SHH..." | |
if [[ -f $HOME/.ssh/id_rsa.pub ]] | |
then | |
echo "Atención: Llave Publica SSH Existe!" | |
else | |
ssh-keygen -t rsa -f $HOME/.ssh/id_rsa | |
fi | |
ssh-keygen -l -f $HOME/.ssh/id_rsa.pub | |
apt-get install xclip | |
#Copia el contenido de la llave publica al portapapeles | |
xclip -sel clip < $HOME/.ssh/id_rsa.pub | |
echo ">>> SSH Key Copiada al portapapeles!" | |
} | |
#DESARROLLO - Base | |
function dev_base(){ | |
if [ $# -eq 2 ]; then | |
USUARIO=$1 | |
EMAIL=$2 | |
echo "Instalando Dev-Base... Usuario: $USUARIO Email: $EMAIL Home: $HOME" | |
else | |
return | |
fi | |
aptitude install -y build-essential | |
#Perl / Python doc #TODO: DBI | |
aptitude install -y perl-doc python-doc | |
# aptitude install -y dia2code | |
aptitude install -y subversion | |
aptitude install -y git-core git-gui gitk git-flow | |
aptitude install -y mercurial | |
#Configuramos Git y Mercurial | |
git_config_init "$USUARIO" "$EMAIL" | |
hg_config_init "$USUARIO" "$EMAIL" | |
#Extensión para nautilus y mercurial | |
aptitude install -y tortoisehg-nautilus | |
aptitude install -y geany | |
aptitude install -y terminator | |
#Editor Sublime Text2 | |
COUNT=$(dpkg -l | grep sublime-text | wc -l) | |
if [ $COUNT eq 0 ]; then | |
add-apt-repository -y ppa:webupd8team/sublime-text-2 | |
apt-get update | |
apt-get install -y sublime-text | |
else | |
echo "Editor SublimeText2 ya instalado..." | |
fi | |
#SQLite3 | |
aptitude install -y sqlite3 sqlite3-doc | |
#Creamos el archivo de configuracion de Nano (.nanorc) | |
dev_config_nano | |
#Creamos la llave SSH | |
crear_sshkey | |
} | |
#DESARROLLO - Ruby | |
function dev_ruby_rvm(){ | |
aptitude install -y curl git-core subversion | |
su $SUDO_USER -c $HOME/scripts/ubuntu_rvm.sh | |
} | |
#DESARROLLO Python | |
function dev_python(){ | |
echo "Instalando Librerias de Desarrollo Python..." | |
aptitude install -y build-essential python-all-dev | |
aptitude install -y python-pip | |
echo "Actualizando pip: " | |
pip --version | |
pip install pip --upgrade | |
pip --version | |
pip install virtualenv | |
pip install fabric | |
} | |
function dev_node(){ | |
echo "Instalando NodeJS..." | |
apt-get install -y python-software-properties | |
add-apt-repository -y ppa:chris-lea/node.js | |
apt-get update | |
apt-get install -y nodejs | |
} | |
#DESARROLLO - Bd | |
function dev_bd(){ | |
#MySQL | |
aptitude install -y mysql-server mysql-workbench | |
#MDBTools: manipulan BD Access y permiten convertirlas | |
#aptitude install -y mdbtools mdbtools-dev mdbtools-gmdb | |
#Postgres 9.1 y pgAdmin | |
#aptitude install -y postgresql-9.1 postgresql-contrib-9.1 postgresql-doc-9.1 postgresql-server-dev-9.1 | |
#aptitude install -y pgadmin3 | |
#Postgres 9.2 | |
REPO_APT_PG="deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | |
aptitude install -y libpq-dev | |
echo $REPO_APT_PG>/etc/apt/sources.list.d/pgdg.list | |
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add - | |
aptitude update | |
aptitude install -y postgresql-common -t raring | |
aptitude install -y postgresql-9.2 | |
aptitude install -y postgresql-contrib-9.2 postgresql-doc-9.2 postgresql-server-dev-9.2 | |
aptitude install -y pgadmin3 | |
} | |
function dev_bd_nosql(){ | |
#MongoDB | |
echo "Instalando MongoDB..." | |
REPO="deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" | |
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 | |
echo "$REPO" | tee -a /etc/apt/sources.list.d/10gen.list | |
apt-get -y update | |
apt-get -y install mongodb-10gen | |
} | |
#Apache2 y php5 | |
function dev_php5(){ | |
#Apache2 | |
aptitude install -y apache2 apache2-doc | |
#Php5 | |
aptitude install -y php5 php5-cli php5-common php5-dev php5-gd | |
aptitude install -y php5-mysql php5-pgsql php5-sqlite | |
#Composer para php5 | |
echo "Instalando Composer..." | |
aptitude install -y curl | |
curl -sS https://getcomposer.org/installer | php | |
mv composer.phar /usr/local/bin/composer | |
composer --version | |
#zftool | |
echo "Instalando ZF2 Tool (zftool.phar)" | |
wget http://packages.zendframework.com/zftool.phar | |
mv zftool.phar /usr/local/bin/zftool.phar | |
chmod a+x /usr/local/bin/zftool.phar | |
zftool.phar --version | |
} | |
#Java7 OpenJDK | |
function dev_java_open(){ | |
aptitude install -y openjdk-7-jdk openjdk-7-doc openjdk-7-jre openjdk-7-demo openjdk-7-source | |
} | |
#Java 7 de Oracle | |
function dev_java_sun(){ | |
sudo add-apt-repository -y ppa:webupd8team/java | |
sudo apt-get update | |
sudo apt-get install -y oracle-java7-installer | |
} | |
function dev_all(){ | |
dev_base | |
dev_python | |
dev_ruby_rvm | |
dev_node | |
dev_bd | |
dev_bd_nosql | |
dev_php5 | |
dev_java_sun | |
} | |
function virtualbox(){ | |
echo "Comenzando Instalación de Virtual Box 4.2 para Ubuntu" | |
COUNT_VB=$(grep -c virtualbox /etc/apt/sources.list) | |
if [ "$COUNT_VB" -gt 0 ]; then | |
echo "Ya existe en /etc/apt/sources.list el repositorio de virtualbox" | |
else | |
echo "deb http://download.virtualbox.org/virtualbox/debian raring contrib">>/etc/apt/sources.list | |
fi; | |
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add - | |
apt-get update | |
apt-get install -y virtualbox-4.2 | |
apt-get install -y dkms | |
} | |
function chess(){ #Ajedrez | |
aptitude install -y crafty crafty-books-medtosmall scid | |
} | |
########################### AYUDA ############################################## | |
function show_help(){ | |
cat<<TextoAyuda | |
Las opciones disponibles para el script de instalación de Ubuntu son: | |
--help : muestra esta ayuda. | |
--gui : Activa la interfaz grafica de instalacion | |
--common : Paquetes Comunes de Usuario (Chromium,ClamAV,VLC,plugins,etc...) | |
--vbox : Instala Virtual Box 4.2 | |
--dev-base: instala los paquetes basicos de desarrollo. | |
--dev-ruby: instala los paquetes de desarrollo para Ruby y Rails | |
--dev-python: instala los paquetes de desarrollo para Python | |
--dev-node: Instala NodeJS | |
--dev-java-open: instala los paquetes de desarrollo para Java(OpenJdk7) | |
--dev-java-sun: instala los paquetes de desarrollo para Java(Sun Jdk7) | |
--dev-php5: instala los paquetes de desarrollo para PHP5. | |
--dev-bd : instala las bases de datos MySQL5, PostgreSQL. | |
--dev-bd-nosql : instala la BD NoSQL MongoDB | |
--dev : instala TODOS los siguientes paquetes de desarrollo y Bases de Datos: | |
* Ruby, PHP5, Apache2, Java(SunJdk7) | |
* MySQL5, PostgreSQL 9.1, SQLite3 | |
TextoAyuda | |
} | |
####################### GUI ####################################### | |
function gui_install(){ | |
programas=$(zenity --list --checklist --height=350 --width=600 \ | |
--title="Ubuntu Install" \ | |
--text="Seleccione los paquetes a instalar" \ | |
--column="" --column=Paquetes TRUE "Comunes (plugin audio y video,unrar,clamav,vlc,chromium,etc...)" \ | |
TRUE "Desarrollo - Base (Git,Mercurial,Svn,SublimeText2,SQLite,etc...)" FALSE "Ruby (RVM,Ruby 1.9 y Rails 3) " FALSE "Python (Librerias Dev, Pip, VirtualEnv y Fabric)" FALSE "NodeJS" FALSE "PHP5 y Apache2" FALSE "Java (Oracle 7/OpenJdk 7)" FALSE "Bases de Datos (PostgreSQL 9 y MySQL) " FALSE "Bases de Datos NoSQL (MongoDB)" FALSE "VirtualBox 4.2" FALSE "Ajedrez (scid,crafty)") | |
if [ "$programas" = "" ]; then exit 0; fi | |
if (echo "$programas" | grep -i "Comunes" > /dev/null); then inst_common=on; else inst_common=off; fi | |
if (echo "$programas" | grep -i "Desarrollo">/dev/null); then | |
INFO=$(zenity --forms --title="Datos del Usuario de Ubuntu" \ | |
--text="Información del Usuario" \ | |
--separator=";" \ | |
--add-entry="Nombre Completo" \ | |
--add-entry="Email") | |
if [ $? -eq 0 ]; then | |
USUARIO=$(echo $INFO | cut -d";" -f1) | |
EMAIL=$(echo $INFO | cut -d";" -f2) | |
inst_devbase=on; | |
else | |
echo "ATENCION: No Indico la Informacion del Usuario. No se instalara Dev-Base" | |
inst_devbase=off; | |
fi | |
else | |
inst_devbase=off; | |
fi | |
if (echo "$programas" | grep -i "PostgreSQL" > /dev/null); then inst_bd=on; else inst_bd=off; fi | |
if (echo "$programas" | grep -i "Mongo" > /dev/null); then inst_bd_no=on; else inst_bd_no=off; fi | |
if (echo "$programas" | grep -i "Ruby" > /dev/null); then inst_ruby=on; else inst_ruby=off; fi | |
if (echo "$programas" | grep -i "Python" > /dev/null); then inst_py=on; else inst_py=off; fi | |
if (echo "$programas" | grep -i "Node" > /dev/null); then inst_node=on; else inst_node=off; fi | |
if (echo "$programas" | grep -i "PHP5" > /dev/null); then inst_php=on; else inst_php=off; fi | |
if (echo "$programas" | grep -i "Java" > /dev/null); then | |
java=`zenity --list --checklist --height=250 --width=300 --title="Ubuntu Install - Java" --text="Seleccione la Version de Java a instalar" --column="" --column=Paquetes FALSE "Java - OpenJdk" FALSE "Java - Sun"` | |
if (echo "$java" | grep -i "Open" >/dev/null); then java_open=on; else java_open=off; fi | |
if (echo "$java" | grep -i "Sun" >/dev/null); then java_sun=on; else java_sun=off; fi | |
else | |
java_sun=off; | |
java_open=off; | |
fi | |
if (echo "$programas" | grep -i "VirtualBox" > /dev/null); then inst_vbox=on; else inst_vbox=off; fi | |
if (echo "$programas" | grep -i "Ajedrez" > /dev/null); then inst_chess=on; else inst_chess=off; fi | |
if [ $inst_common = "on" ]; then | |
echo ">>> Instalando Paquetes Comunes:"; | |
user_common; | |
fi | |
if [ $inst_devbase = "on" ]; then | |
echo ">>> Instalando Desarrollo Base:"; | |
dev_base "$USUARIO" "$EMAIL" | |
fi | |
if [ $inst_bd = "on" ]; then | |
echo ">>> Instalando BD SQL:"; | |
dev_bd; | |
fi | |
if [ $inst_py = "on" ]; then | |
echo ">>> Instalando Python:"; | |
dev_python; | |
fi | |
if [ $inst_ruby = "on" ]; then | |
echo ">>> Instalando Ruby:"; | |
dev_ruby_rvm; | |
fi | |
if [ $inst_node = "on" ]; then | |
echo ">>> Instalando NodeJS:"; | |
dev_node; | |
fi | |
if [ $inst_php = "on" ]; then | |
echo ">>> Instalando PHP5"; | |
dev_php5; | |
fi | |
if [ $java_sun = "on" ]; then | |
echo ">>> Instalando Java Sun JDK:"; | |
dev_java_sun; | |
else | |
if [ $java_open = "on" ]; then | |
echo ">>> Instalando Java Open JDK:"; | |
dev_java_open; | |
fi | |
fi | |
if [ $inst_bd_no = "on" ]; then | |
echo ">>> Instalando BD NoSQL:"; | |
dev_bd_nosql; | |
fi | |
if [ $inst_vbox = "on" ]; then | |
echo ">>> Instalando VirtualBox:"; | |
virtualbox; | |
fi | |
if [ $inst_chess = "on" ]; then | |
echo ">>> Instalando Ajedrez"; | |
chess; | |
fi | |
zenity --info --title="Ubuntu Install" --text="Instalacion Finalizada Ok" | |
} | |
####################### CUERPO PRINCIPAL ####################################### | |
if [[ -z "$1" || -z $# ]]; then | |
show_help | |
exit | |
fi | |
if [ $USER != root ]; then | |
echo "ERROR: Debe ejecutarse como usuario root (sudo $0)" | |
exit | |
fi | |
echo "Ejecutando script de instalacion de paquetes... Usuario: $SUDO_USER" | |
for parametro in $@ | |
do | |
case $parametro in | |
--help | -h ) show_help;; | |
--gui) gui_install;; | |
--common ) user_common;; | |
--dev ) dev_all;; | |
--dev-base ) dev_base;; | |
--dev-ruby ) dev_ruby_rvm;; | |
--dev-python ) dev_python;; | |
--dev-node ) dev_node;; | |
--dev-php5 ) dev_php5;; | |
--dev-bd ) dev_bd;; | |
--dev-bd-nosql ) dev_bd_nosql;; | |
--dev-java-open ) dev_java_open;; | |
--dev-java-sun ) dev_java_sun;; | |
--vbox ) virtualbox;; | |
--chess) chess;; | |
*) #opcion por defecto | |
echo "Parametro $parametro desconocido";; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment