I have a server running ubuntu, with a domain bc.com's A record point to it.
I want to setup aa.bc.com, cc.bc.com to redirect to bc.com/b.jsp?id=aa/cc
What I should install to make that work?
Subdomains are done through DNS, however, the manipulation you are talking about will involve both DNS trickery and configuration of your web server. You will need to point subdomain.example.com to example.com as a CNAME record as a first step. Once that is complete, you will need to create rewrite rules using mod_rewrite (if you are using Apache) to forward the subdomain to the argument to the jsp file.
Create CNAME or A record:
Configure Apache 2(mod_rewrite):