LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Multiple Instances of Apache/Tomcat/MySQL (https://www.linuxquestions.org/questions/linux-software-2/multiple-instances-of-apache-tomcat-mysql-896341/)

erat123 08-09-2011 07:11 AM

Multiple Instances of Apache/Tomcat/MySQL
 
Greetings!

I'd like to create multiple instances of apache, tomcat and mysql on a Linux server. I'm really not sure if it's possible to do so, but here's my use case before I got further:

I teach a programming course and I'm configuring a server that jails each student. I would really like it if each student could administer his own copy of apache, tomcat and mysql without conflicting with other students.

To make things more difficult, I only have a single IP address and I can't open additional ports.

Let's say I have a student named Tom Smith. I would like Tom to be able to access his apache files at mydomain.com/tsmith

Like I said, not sure if this is even possible to do, but any help would be appreciated!

acid_kewpie 08-09-2011 07:39 AM

It's all possible in a certain way. What sorts of separations do you actually *NEED*? Why do you need separate database servers for a programming course? why not just different database instances on a single system? Why separate apaches? Why not just different virtualhosts on the same machine? Indeed, your example doesn't even seem to suggest that, just bog standard userdirs - http://httpd.apache.org/docs/2.0/mod/mod_userdir.html

sundialsvcs 08-09-2011 05:09 PM

Theoretically, each one of these programs can be run at an "ordinary user" level, e.g. in a chroot jail (so you don't have to monkey around with non-standard configuration file setups). The only thing that the processes cannot do in that case is to open TCP/IP port-numbers less than 1024. (But they don't have to use TCP/IP for communication.)

This is, I think, a very good exercise, because it really does match what developers routinely want to do when they are setting up individual development environments.

One thing you might want to do, though, is to build some scripts that basically "spoon feed" most of the right answers, setting up the environments for the students "somewhat automagically." Then, lead them through an understanding of what has been done and lead them through some very specific changes. My thought here is, "if they've never yet been there, then they haven't a cucking floo ;) why they can't manage to get there, and the frustration level is intense. (Heck, we've all felt that way, eh?!) "Here it is. The engine's running. Tah, daah... Now, let's turn the engine off and take the thing apart and see what makes it tick ..."

Felipe 08-11-2011 04:52 AM

For me, two possibilities:
A)
A possible way could be to create virtual machines with VirtulBox, VmWare,... with each installation: Tomcat, Apache, MySql.
For each user, a Virtual Machine.

The virtual machine can be run on user computer or in server computer.
If virtual machine is run in server, each Virtual machine can run in a different IP (create your own net): Ej: 192.168.1.101, 192.168.1.102, ....

Using Apache on main server, you can redirect each http request to each virtual server (http://server.domain/server1 --> 192.168.1.101).
Also, you can access each machine console with vnc: http://server.domain/vnc1--> 192.168.1.101.

B)
Create installations for each user in the sever: Then you create first installation (ej: for user1) an copy it to user2, user3, ... reconfiguring ports:

Ej:
/opt/user1/
apache/... Port: 1080
tomcat/... Port: 1081
mysql/... Port: 1082

/opt/user2/
apache/... Port: 2080
tomcat/... Port: 2081
mysql/... Port: 2082
...

Also, you can use a main apache,
ex: /opt/apache
which rewrites url to each apache user:
Ex: http://server.domain/user1 --> send request to Apache or tomcat of user1.

Not sure if that can help you.

Regards


All times are GMT -5. The time now is 08:51 AM.