Sunday, March 31, 2013

Ubuntu Virtual Machine Installation and Customization

In this post I detail the steps to create a customized minimal Ubuntu 12.04 LTS server virtual machine (VM) in Virtual Box. Please feel free to ignore any step you do not need. (Please read the disclaimer before you do anything).

Before you start installing and customizing the Virtual Machine in Virtual Box, please make sure you have,
  1. Installed Virtual Box in your Operating System (see here for details)
  2. Download the Ubuntu 12.04 LTS server edition (see here to download ubuntu-12.04.2-server-amd64.iso)
Please follow the steps given here to mount the ISO file and start the installation process.

Part 1: Non-GUI Installations

Step 1: Install VM only version

Once the ISO is loaded press F4 and choose VM only version for installation.
Try the following command to see the installation details,
cat /etc/lsb-release

After installation, and restart, please execute the following commands,
sudo apt-get update
sudo apt-get upgrade

Step 2: Install nano, gedit, and byobu

sudo apt-get install nano
sudo apt-get install gedit
sudo apt-get install byobu

Step 3: Install add-apt-repository

sudo apt-get install python-software-properties

Step 4: Install Oracle Java (ref)

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo apt-get install oracle-java7-set-default

Open file /etc/bash.bashrc and add the following line there to the end,
export JAVA_HOME="/usr/lib/jvm/java-7-oracle"

Then execute the following command to make sure that the JAVA_HOME is set,
source /etc/profile

Step 4a: Install Maven

sudo apt-get install maven

Step 4b: Install Tomcat

sudo apt-get install tomcat7

Open file /etc/bash.bashrc and add the following line there to the end,
export CATALINA_HOME="/etc/tomcat7"

Then execute the following command to make sure that the CATALINA_HOME is set,
source /etc/profile

Step 5a: Install MySQL Server

sudo apt-get install mysql-server

Provide the root password for the server when prompted. MySQL server will automatically start after installation. To make sure that MySQL server is running please use the following command,

sudo netstat -tap | grep mysql

You can manage the MySQL server using the following command,
/etc/init.d/mysqld start
/etc/init.d/mysqld stop
/etc/init.d/mysql restart

To install MySQL workbench please execute the following commands (ref),
sudo add-apt-repository ppa:olivier-berten/misc
sudo apt-get update
sudo apt-get install mysql-workbench


Optional: You can download the MySQL Workbench from here,
https://dev.mysql.com/downloads/tools/workbench/

Step 5b: Install PostGres Server (ref)

sudo apt-get install postgresql

Change the password for the default 'postgres' user:
sudo -u postgres psql postgres

Then at the prompt enter:
\password postgres

When prompted enter the password and confirm by entering the password again.

The server package comes with a client to connect to a server. If you just want the client do:
sudo apt-get install postgresql-client 

To install the pgAdmin III software do:
sudo apt-get install pgadmin3  

Step 6: Install Apache/PHP (ref)

sudo add-apt-repository ppa:ondrej/php5
sudo apt-get update
sudo apt-get install php5 libapache2-mod-php5 mysql-server mysql-client apache2
sudo service apache2 start

Step 7: Install Python (ref)

sudo apt-get install python3

Step 8: Install Git

sudo apt-get install git

git config --global user.name "John Doe"
git config --global user.email johndoe@example.com


You can configure an individual repo to use a specific user / email address (ref).

git config user.name "Your Name Here"
git config user.email your@email.com
where as the default user / email is configured in your ~/.gitconfig

To show the current git branch, please follow the following steps (ref),
sudo apt-get install bash-completion
sudo nano ~/.bashrc

Add the following lines,

# Bash completion
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi

export GIT_PS1_SHOWDIRTYSTATE=1
export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w\[\033[01;33m\]$(__git_ps1)\[\033[01;34m\] \$\[\033[00m\] '

Perform,
source ~/.bashrc

Step 9: Install Groovy (ref)

sudo apt-add-repository ppa:groovy-dev/groovy
sudo apt-get update
sudo apt-get install groovy

Step 10: Install Grails (ref or ref)

Download, Unzip, set PATH variables in /etc/bash.bashrc

Step 11: Install NodeJS and npm (ref and update node ref)

sudo apt-get install nodejs
sudo apt-get install npm
Some software (like grunt) will need node as the command. You have to fix it.

Step 12: Install Ansible (ref)

sudo apt-get install software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible 

Part 2: GUI Installations

Step 1: Install XFCE & XFCE Terminal

sudo apt-get install xfce4
sudo apt-get install xfce4-terminal

After installing XFCE please have a look at recommended apps for XFCE.

Step 2: Install Eclipse

sudo apt-get install eclipse-platform
Or
sudo apt-get install eclipse-platform=3.5.2-6ubuntu1.1


then execute the following,
sudo apt-get install eclipse-jdt
sudo apt-get install libswt-gtk-3-jni libswt-gtk-3-java
sudo cp /usr/lib/jni/libswt-*3740.so ~/.swt/lib/linux/x86_64/

Step 3: Install Firefox

sudo apt-get install firefox

Step 4: Install Screen Resolution (ref)

sudo apt-get install virtualbox-ose-guest-utils virtualbox-ose-guest-x11 virtualbox-ose-guest-dkms

xrandr
cvt 1920 1080 60
xrandr --newmode "1920x1080_60.00" 38.25 800 832 912 1024 600 603 607 624 -hsync +vsync
xrandr --addmode VBOX0 1920x1080_60.00
xrandr --output VBOX0 --mode 1920x1080_60.00

Step 5: Install Remote Desktop

sudo apt-get install xrdp

Step 6: Install Brackets IDE

sudo add-apt-repository ppa:webupd8team/brackets
sudo apt-get update
sudo apt-get install brackets

Further Reading

  1. Ubuntu Linux Commands
  2. Securing Ubuntu Installation and Essential security on Linux Servers
  3. Linux directory structure 



No comments:


(c) Jyotirmaya Nanda 2012