Setting JAVA_HOME and ANT_HOME on Ubuntu / Linux Mint

This might be helpful for the newbies who are starting their career in software development with  Java lang. And of course its not like in old school when it comes to the industry, we use application build tools for proper deployment of enterprise applications. Such commonly used build tool is ‘ apache – ant ‘. Before starting any big work with java and ant, you have to define ‘Java home’ and ‘Ant home’ to make use of them. Follow the following steps by adding few lines to your ‘.bashrc’ file,

Step 01: Locating .bashrc file.
If your on ubuntu, bashrc can be found on home directory as ‘.bashrc’ . If its Linux Mint go to /etc and open ‘bash.bashrc’ as super user mode to edit via a teminal.

sodu gedit bash.bashrc

sodu gedit bash.bashrc

Step 02: Setting ANT_HOME
Include the following block of text at the bottom of your ‘bash.bashrc’ file (if ubuntu, then .bash).

ANT_HOME

ANT_HOME

I have stored my apache-ant folder in ‘/usr/local/’. Change the path according to your apache-ant folder location.

Step 03: Setting JAVA_HOME
Same as you did for ANT_HOME, include the following block of text at the bottom of bash.bashrc file. Include the correct path of java jvm.

JAVA_HOME

JAVA_HOME

You are good to go!

 BTW I’m listening to Pretty Girl (The Way)” by sugarcult. Its really cool :P

Setting up a LAMP Server

This post is to help the people who is willing to try out web technologies using LAMP. I think it will be more helpful to do a brief on ‘what is LAMP?’

LAMP represents the open source web platform. Its a portion of 4 resources
L – Linux (any distribution of gnu/linux).
A – Apache ( web server).
M – MySQL (relational database management system).
P – either Perl,Python or PHP (OO scripting language).
In this tutorial I’m using Linux Mint 7 Gloria, Apache2, MySQL and PHP5.

Step 01 → update your system’s package repository. So you can get the latest versions of available resources.

apt-get update

Step 02 → download and install Apache web server

apt-get install apache2

To check what the web server is running without any problems type ‘http://localhost‘ on your browser. If no problems, then it will give a test output as follows,

Step 03 → get PHP and its dependencies.

apt-get install php5 libapache2-mod-php5

after installing php you have to restart apache web server as follows,

/etc/init.d/apache2 restart

Step 04 → Now you need to make sure that PHP and Apache is working fine together. To do that use the following test php scrip and save it as phpinfo.php in server root(/var/www/).

phpinfo.php

phpinfo.php

Then call the script through the web browser. The URL should be like this, http://localhost/phpinfo.php . Then it should show all PHP configuration settings in a coloured table.

Step 05 →  get MySQL

apt-get install mysql-server

During the installation you will get a package configuration screen. Set root password for MySQl carefully. If you didn’t get that screen set password for MySQl manually,

mysql -u root
mysql> SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(‘user_pass_word’);

Step 06 → PhpMyAdmin installation

PhpMyAdmin is a web based free graphical database management and MySQL administration tool. This tool  makes all the MySQL database operations easy. Such as creating tables, creating databases inserting values, deleting values and lot more.

apt-get install phpmyadmin

during its installation it will ask what server to use. Apache or apache2 ? Select apache2 . Then it will prompt you to set a password for phpmyadmin. Done! To use Phpmyadmin type http://localhost/phpmyadmin on your browser.

PhpMyAdmin

PhpMyAdmin

Congrats! Your LAMP system is ready to do extraordinary things for you. :D

Note: all the command line actions above are held as ‘root’.

Compressing and Archiving

‘.tar’, ‘.gz’, ‘.tar.gz’, ‘.bz2′, ‘tar.bz2′, ‘.zip’. What are these strange extensions? Mostly you ll think these are all compressed files. But its better to understand exactly what these are. And why do we need them.

According to above extensions some are for compressed and some tells that they are archived.

Compressing

In linux/unix environment there are 2 main compression algorithms. They are ‘gzip’ and ‘bzip’. The difference of ‘bzip’ from ‘gzip’ is that ‘bzip’ is more capable of making smaller files than ‘gzip’. But ‘bzip’ consumes much more memory and takes time.

Howto bzip:

as usual open up your favorite terminal/konsole :D . Then follow the commands. I m having 4 files inside /home/dushi/test directory.

ls

ls

now im gona compress file1.txt using bzip2.

bzip2

bzip2

Thats all. Now ‘file1.txt’ is replaced by ‘file1.txt.bz2′ :D

Lets decompress that newly compressed file back to ‘file1.txt’.

bzip2 -d

bzip2 -d

it will decompress the ‘.bz2′ file into its originals.

Howto gzip:

gzip

gzip

same as above its really simple. I’m gona compress ‘file2.txt’ using ‘gzip’. it gives ‘file2.txt.gz’.

gzip -d

gzip -d

use -d to decompress.

Archiving

The ‘.tar’ format is the most common archive format in linux/unix environment. They are mostly called as tarballs. Archives are not compressed files. It combines one or more files into a single file. The idea is to achieve easier storage and transportation. Specially in web.

Howto archive:

lets go back into my /home/dushi/test/ directory again.

ls

ls

There are 4 files. Two compressed files and two normal text files. Lets archive them all into ‘MyArchive.tar’ .

tar -cf

tar -cf

from about cmd makes a tarball as ‘MyArchive.tar’ :D . To extract files from it ,

tar -xf

tar -xf

Thats all u should know :)   for more options refer,

$man tar

$man gzip

adios

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: