Editing
Linux-vserver administrators gide
(section)
From Linix VServer
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== D. Virtual hosts == '''1. Installation''' The script newvserver is used to create a new vserver. Some distribution specific packages include customized version of this tool (we know the debian package of vserver does include a customised version). Run newvserver -h or newvserver --help to get the help. '''2. Configuration''' '''2.1. Configuration file''' Each virtual server has one configuration file controlling its behavior. The configuration is located in /etc/vservers and has the name of the vserver followed by the extension .conf. This is a pseudo shell script where variable are setup using shell assignment (VAR=value). The script is simply sourced by the vserver(8) utility. Here are the various variables you can set: You don't have to set all of these options (only hostname, domain and IP-number are required) <ul> <li>S_CONTEXT= Sets the vserver's security context number. If not specified, a free context is allocated dynamically. You usually only need to use fixed context numbers if you are using context quotas/disk limits, but as it doesn't hurt, it's recommended.</li></ul> <ul> <li>IPROOT= Select the IP address to be assigned to this virtual server. Entering or starting the vserver will enable this IP as an interface alias if it does not already exist as an interface on the host server, and stopping the vserver will disable the alias. Up to 16 IP numbers may be assigned. Separate each IP address with a space.</li></ul> The syntax is: [device[.vlan]:]IP[/netmask] The netmask may be specified in quad notation (255.255.255.0) or by telling the number of bits assigned to the network part (A class C network is a /24 network with 24 bits assigned to identify the network and 8 (32-24) bits assigned to identify the host. If the device is omitted, the IPROOTDEV devices is used. If the netmask is omitted, the device netmask is used. Examples: IPROOT="1.2.3.4" IPROOT="1.2.3.4 2.3.4.5" IPROOT="eth0:1.2.3.4 eth1:2.3.4.5" IPROOT="eth0:10.1.2.3/255.255.255.0 eth0:10.1.3.12/255.255.255.128" (see http://vserver.13thfloor.at/Stuff/VServer-IP-Setup-0.1.txt for details, e.g. how to not create an alias at all) <ul> <li>IPROOTMASK="" Netmask for the IPROOT. If not specified, the netmask is calculated from IPROOTDEV.</li> <li>IPROOTBCAST="" Broadcast address for the IPROOT. If not specified, the broadcast is calculated from IPROOTDEV.</li></ul> <ul> <li>IPROOTDEV= Select which network interface the IP alias will be created on (when not overridden in IPROOT). IPROOTDEV="eth0"</li></ul> <ul> <li>S_HOSTNAME= Set the hostname (FQDN) of the vserver. If empty, the hostname of the host server is used.</li></ul> <ul> <li>S_DOMAINNAME="" Set the NIS domain for the vserver. If empty, the domain of the host server is used. Set to "none" to have no NIS domain set.</li></ul> <ul> <li>S_NICE="" Set the priority level (nice) of all processes in the vserver (from -20 [highest] to 19 [lowest]). Even root will not be able to raise it. See nice(1).</li></ul> <ul> <li>S_FLAGS= Sets various flags for the vserver's security context. Separate each flag with a space. 1) lock: Prevent the vserver from setting new context 2) sched: Merge scheduler priority of all processes in the vserver so that it acts like a single one 3) nproc: Limit the number of processes in the vserver according to ulimit (instead of a per-user limit, it becomes a per-vserver limit) 4) private: No other process can join this security context, even root Example: S_FLAGS="lock nproc"</li></ul> <ul> <li>ULIMIT You can set various ulimit flags and they will be inherited by the vserver. Enter the command line arguments you would give to the ulimit command. Example: 1) ULIMIT="-HS -u 200" Combined with the nproc S_FLAGS, this example would limit the vserver to a maximum of 200 processes ULIMIT=""</li></ul> <ul> <li>S_CAPS Allows you to set the vserver root user's capabilities. By default, vservers run with a limited set so that root can run in a vserver without worrying about him taking over the machine. Where necessary you may give a little extra capabilities. Separate each capability with spaces. Example: S_CAPS="CAP_NET_RAW" # allows raw sockets. Let the vserver send raw packet over the network (Enable ping and traceroute for one) S_CAPS="CAP_SYS_RESOURCE" # This allows a application inside a vserver to enlarge its ulimit values. You needs this to run bind9. S_CAPS="CAP_SYS_ADMIN" # Let the vserver do many things, including mounting devices and network shares. S_CAPS=""</li></ul> <ul> <li>ONBOOT If yes, this vserver will be started at boot time. Set to no if you do not want it to start automatically. ONBOOT="yes"</li></ul> <ul> <li>PRIORITY This control the start and stop order of the virtual servers (by the vservers service). A lower value means the vserver is started earlier. This is useful when some virtual server depend on other to run. For example you may have a virtual server providing LDAP services to the other. Failing to start this one first creates numerous problems.</li></ul> '''2.2. Startup scripts''' To run a command on the host server at startop or shutdown of a vserver, you can put a script in /etc/vservers/. You have to give it the same name as your vserver and .sh as extention. (call it vserver1.sh for you server1) example: This script lets you map a directory on a other disk in you vserver (you can use it to share a directory between virtual servers. (you have to put a #!/bin/sh on the first line of the script) case $1 in pre-start) mount --bind /home2/home /vservers/server1/home ;; post-start) ;; pre-stop) ;; post-stop) umount /vservers/server1/home ;; esac <span id="e.-administation-of-linux-vserver"></span>
Summary:
Please note that all contributions to Linix VServer may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Linix VServer:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Page
Discussion
Read
Edit
History
Page actions
Page
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
About
Overview
Paper
News
Developers
Donations
Search
Getting Started
Downloads
FAQs
Documentation
Support
Participate
How to participate
Report a Bug
Communicate
Teams/Projects
Hall of Fame
Resources
Archives
Recent Wiki Changes
Pastebin
Related Projects
VServer Hosting
Happy VServer Users
Tools
What links here
Related changes
Special pages
Page information