Virtualization? VFS? I don't even know what to ask...
I feel like such a newb I don't even know how to ask this question intelligently.
Basically what I want is a way to do `apt-get install blah blah blah`, and install all sorts of programs, but only do so for one "profile" or "user" or whatever. Right now, in ubuntu, if I install a program or library, I do it across the system.
Is there any way to sort of "sandbox" a file system? Is that a virtual file system, like a virtual machine?
Am I looking for Xen? I've tried VirtualBox, but I don't think that's what I want, because it's slow. I'm not trying to run different OS's.
Is there any way of having a linux file system where some files "exist" if you are one user, but don't if you're another user?
Thanks in advance! :)
There are ways to accomplish what you're trying to do without involving virtualization.
Rather than trying to make things not exist, you can use the native *nix permissions to provision your system so that only users belonging to certain groups can actually browse, write, or execute the programs you've installed in a certain directory.
Let's say you want to install Program X. Here's a high-level overview of how you could manage those permissions.
1) Create userid xuser and group xgroup. Make xgroup the default group for xuser.
2) Install the product as xuser.
3) Add any specific users you want to access the product to group xgroup.
4) Use the chmod command to set permissions for owner/group/public as desired. For example, if you want group members to be able to run it and non-group members to be completely unable to see it, the permissions would be 750.
SL00b, thanks for the reply. I can understand doing what you suggest for one or two programs here or there, but I want to isolate entire ecosystems of large programs and libraries.
Essentially I want `apt-get install _` to only apply to the current user. When I switch users, I want to start with a clean slate, no programs or libraries available to me that other users have installed.
Maybe it would help if you explained what you're trying to accomplish, rather than starting from how. I'm thinking of a few other simple ways to do something like what you're trying to accomplish, but I don't know which ones to recommend because I can't understand why you'd want to do something like this in the first place.
Well for instance, I might want to have an older version of some program available, with older libraries. I would log in to "oldprogramfoo" and be able to just use it straight away. I would log back into my main account and use the latest version.
Or, say I'm experimenting with the differences between sun's java and openjdk. I don't want both installed on my system at the same time. I want to log in to "openjdk user" and "sun jdk user" or whatever.
Or, say I'm doing some development that gets me stuck in dependency hell. I want to "reverse time" to before I installed a bunch of crap. I would much rather just be able to delete a user and all that user's meddling than have to manually try and revert all the changes I've made.
I just want to be able to "start from scratch" or "start from a clean OS" as often and as quickly as possible. Right now that means keeping a clean VirtualBox install always handy. But it's so slow, and the host OS is the same as the guest OS. I feel that's just silly. I don't think I should have to do what I'm doing. There MUST be a better way. I'm just not sure what it is :(
Thank you for your help though! I can see you know what you're doing. :)
Well, the angle I'm coming from with isn't so much "log in as the right user" as it is "mount the right filesystem/s."
Virtualization CAN come into the picture here, like this:
1) Set up your virtual machine (VM) environment (don't ask me which one, because I deal with commercial stuff, and commercial = expensive... I think Xen will do what you want, though).
2) Create a virtual disk, attach it to your first virtual server instance, and do a fresh Linux installation.
3) Get everything up and running the way you want it for all of your environments... hardware, networking, user ids, etc.
4) Shut it down and copy it. This becomes your "gold copy." Now you never have to start all over again.
5) Attach your new virtual disk to the virtual server instance, and boot up.
6) Install whatever products you want specific to that copy of the OS.
7) Shutdown, detach storage, copy the gold copy, attach storage, boot, install products, rinse, repeat.
This gives you multiple server images that can be created/discarded/used/switched out at will. All of this assumes you're going to keep your Linux images fairly compact and/or you've got plenty of disk to spare. If you start running into storage issues, one thing you could look at is whether you've got some data files you want to have available across multiple images. Your home directory might be the first thing you want to do this with, but there could be more if you're playing around with databases, etc. You could create a disk for those, and mount it in the mount table for all those images that need it. Thus, you might have Disk0 that contains the system filesystems (root, opt, var, etc, etc.) and Disk1 that contains /home... Disk0 gets swapped out when you want to run another image, but Disk1 gets left alone.
It's possible to do this without a VM layer, but it gets to be a much bigger pain in the ass, so the more often you're going to want to swap out system images, the more you're going to want to virtualize. Another benefit to virtualization is that you can run multiple server instances at once, though this assumes you've got enough hardware to power it all.
To do it without a VM, look at doing the same sort of concept in a multi-boot configuration.
Thanks for the help, SL00b :) I looked at Xen, but my cpu doesn't seem to be compatible. I also looked at KVM, but it seems it's mainly for non-graphical servers. The whole virtual machine route is really what I'm trying to move away from (I've been doing VirtualBox), but if it's the only way to go, I guess I have no choice.
Thanks again for the help!
Well, as I said, you can always go multi-boot as another option.
|All times are GMT -5. The time now is 01:35 AM.|