Difference between pages "Compiling Xen" and "Configuration files"

From Wikislax
(Difference between pages)
Jump to: navigation, search
(Compiling a dom0 Kernel)
 
(Network configuration)
 
Line 1: Line 1:
{{RightTOC}}
+
The location of the configuration files depend on the specific distribution, but is usually subdirectories of, or files in <tt>'''/etc'''</tt>, <tt>'''/usr/etc'''</tt>, <tt>'''/usr/local/etc'''</tt>. The files are set up by installation but can be updated later. Applying the configuration change will then be a matter of restarting the corresponding daemon. The main Slackware configuration files are :
 +
<br/>
  
== What is Xen ? ==
+
== Init configuration ==
  
[http://wiki.xen.org/wiki/Xen_Overview Xen] is an hypervisor, a thin software layer executing multiple virtual machines, each running its own operating system. Xen is normally used as a server virtualization platform, running on headless servers without graphical console and controlled through the network. However it is also possible to run Xen on graphical desktops, and with proper hardware virtualization, to dedicate the primary graphics card (and keyboard / mouse) to a virtual machine, making it possible to have high performance full 3D and video acceleration in a virtual machine (see [http://wiki.xen.org/wiki/Xen_VGA_Passthrough Xen VGA Passthru]). Xen is otherwise free and open source.
+
{| {{thead}}
 +
|-
 +
! {{chead}} width="200" | File
 +
! {{chead}} | Content
 +
|-
 +
| <tt>'''/etc/inittab'''</tt>||contains the default runlevel (3=multi-user, 4=graphical). On a live system, <tt>'''telinit n'''</tt> affords changing the level interactively.
 +
|-
 +
| <tt>'''/etc/fstab'''</tt>||contains descriptions on the filesystems used on this computer, including the device, the mount point, the filesystem type and the opening options. Use <tt>'''man fstab'''</tt>, copy, and try !
 +
|-
 +
| <tt>'''/etc/http'''</tt>||Directory containing the Apache configuration files such as httpd.conf.
 +
|-
 +
| <tt>'''/etc/lilo.conf'''</tt>||used by lilo to generate a boot sector on the device or on the MBR (master boot record). If on the device and using the Windows bootloader, don't forget to copy the boot sector on a disquette so as to be able to use it from Windows.
 +
|-
 +
| <tt>'''/etc/mail'''</tt>||Directory containing the Sendmail configuration files such as sendmail.mc and sendmail.cf. Spamassassin configuration also goes here as a subdirectory.
 +
|-
 +
| <tt>'''/etc/mail/aliases'''</tt>||File containing a list of users that do not exist on the server and whose mail is redirected to existing users. After modifying this file the command <tt>'''newaliases'''</tt> must be ran.
 +
# redirect news
 +
usenet:        news
 +
|-
 +
| <tt>'''/etc/ntpd.conf'''</tt>||Configuration for the network time protocol. Add ntp servers for your region as below. After an update, restart using <tt>'''/etc/rc.d/rc.ntpd restart'''</tt>.
 +
# NTP server (list one or more) to synchronize with:
 +
server 0.fr.pool.ntp.org
 +
server 1.fr.pool.ntp.org
 +
server 2.fr.pool.ntp.org
 +
server 3.fr.pool.ntp.org
 +
|-
 +
| <tt>'''/etc/profile'''</tt>||don't forget to update the paths:
 +
MANPATH=/usr/local/share/man:/usr/local/man:/usr/man
 +
|-
 +
| <tt>'''/etc/profile.d'''</tt>||the files contained in this directory are executed at login when executable. To remove the "Game of fortune" ran on user login :
 +
chmod a-x /etc/profile.d/bsd-games-login-fortune.*
 +
|-
 +
| <tt>'''/etc/ld.so.conf'''</tt>||list of additional libraries. Needs <tt>'''/sbin/ldconfig'''</tt> after adding new libraries. Add <tt>'''/usr/local/lib64'''</tt> here.
 +
|-
 +
| <tt>'''.bashrc'''</tt>||Specify <tt>'''. /etc/profile'''</tt> on a line of itself to use in <tt>'''konsole'''</tt> the same environment as in the command line. This will afford <tt>'''colorls'''</tt> to work in new <tt>'''konsole'''</tt> tabs.
 +
|}
 +
<br clear=all>
  
== A few quirks ==
+
== The /etc/rc.d directory ==
  
The '''dev86-0.16.21-x86_64-1.txz''' package included with Slackware 14.2 does not afford compiling '''xen-4.9.0''' properly, and must be replaced by '''[{{SERVER}}/wikislax/download/dev86-0.16.17-x86_64-2.txz dev86-0.16.17-x86_64-2.txz]''', that can be found on the Slackware 13.37, 14.0, or 14.1 distribution disks, in directory '''slackware64/d'''. Trying to compile dev86 [http://v3.sk/~lkundrak/dev86/ from source] is not an alternative : dev86 source versions 0.16.18 to 0.16.21 have the same issue compiling xen-4.9.0, and older 0.16.17 does not compile on Slackware 14.2.
+
The <tt>'''/etc/rc.d'''</tt> directory contains the scripts used to initialize the system services at the end of the boot. To use a specific script at startup, make it user-executable. To stop using it, remove the execution rights. Depending on the situation, scripts are called with the <tt>'''start'''</tt>, <tt>'''stop'''</tt>, or <tt>'''restart'''</tt> parameter.
 
+
<br/>
# removepkg /var/log/packages/dev86-0.16.21-x86_64-1.txz
 
# installpkg dev86-0.16.17-x86_64-2.txz
 
 
 
Also, the '''grub-2.00''' included with Slackware 14.2 does not afford booting xen. However, getting the latest version '''grub-2.02''' from source does work.
 
 
 
== Hardware requirements ==
 
 
 
Xen runs on Intel X86 hardware and requires a processor and motherboard supporting VT-x and optionally VT-d for hardware virtualization. See this [http://www.intel.com/support/motherboards/desktop/sb/cs-030922.htm page] for a list of Intel compatible motherboards and chipsets and this [http://ark.intel.com/ page] for a list of compatible processors. Our system running Xen successfully at the time of this writing (and since June 2012) is based on a DZ77GA70K Intel motherboard, an Intel® Core™ i7-3770 Processor (the overclockable i7-3770 "K" model does not afford virtualization), 32 Gb of PC12800 memory and an MSI GeForce G210 graphics board.
 
 
 
== Documentation difficulties ==
 
 
 
Although the software itself works well and is pretty straighforward, good quality Internet information is missing. The volume of information on the Xen wiki is plethoric, but mostly irrelevant as pertaining to old versions of everything. Building the big picture requires interpretation of tiny bits in forum messages, a pretty painful process, although I have to recognize that it worked for me in the end. An alternative is to use one of these old-style information repositories named "books". Yes it is pretty old-fashionned ;) but actually there are good ones on the topic. Here is [http://www.amazon.co.uk/The-Book-Xen-Practical-Administrator/dp/1593271867/ref=sr_1_1?s=books&ie=UTF8&qid=1341037874&sr=1-1 the most recent I found], it is a good value but of course you can find more on [http://www.amazon.co.uk/s/ref=nb_sb_noss_2?url=search-alias%3Dstripbooks&field-keywords=xen&x=0&y=0 amazon(.co.uk)].
 
 
 
== Software constraints ==
 
 
 
To make a long story short, at the time of this writing (and since June 2012) working with nVidia graphic boards on Xen and X11 requires the "nouveau" driver. Other drivers like nv or the nVidia proprietary driver do not support Xen and switch off the screen when launched or do not display properly. "Nouveau" requires a fairly recent version of X11. Slackware 13.37 or newer is required. "Nouveau" is available in kernel 3.4.2 upstream and was previously included as a staging driver. Xen dom0 support was included in kernel 3.0. To benefit from both Xen and "Nouveau", the best is to use kernel 3.4.2 upstream.
 
 
 
== Compiling acpica ==
 
 
 
Xen requires acpica. [https://www.acpica.org/downloads Download] then install as below :
 
 
 
# tar -C /usr/local -xvf acpica-unix-yyyymmdd.tar.gz
 
# cd /usr/local
 
# chown -R root:root acpica-unix-yyyymmdd
 
# cd acpica-unix-yyyymmdd
 
# make
 
# make install
 
# cd ..
 
# rm -r acpica-unix-yyyymmdd
 
 
 
== Compiling yajl ==
 
 
 
Xen requires yajl. [http://lloyd.github.io/yajl/ Download] then install as below. <u>Note</u> : there is no option to specify the target library directory so the files need to be moved manually.
 
 
 
# tar -C /usr/local -xvf lloyd-yajl-x.y.z.66cb08c.tar.gz
 
# cd /usr/local
 
# chown -R root:root lloyd-yajl-66cb08c
 
# cd lloyd-yajl-66cb08c
 
# ./configure
 
# make
 
# make install
 
# cd ../lib
 
# mv libyajl* ../lib64
 
# ldconfig
 
# cd ..
 
# rm -r lloyd-yajl-66cb08c
 
 
 
== Compiling Xen ==
 
 
 
[http://xen.org/products/xen_source.html Download Xen] from the official [http://www.xen.org xen.org] site. <u>Note</u> : File stubs-32.h is missing in the compiler includes so we add a link to the existing stubs-64.h. Also, some Xen Python scripts are installed in /usr/local/lib64/python-2.7/site-packages which python cannot find so we add links from the standard library as well.
 
 
 
# cd /usr/include/gnu
 
# ln -s stubs-64.h stubs-32.h
 
# cd
 
# tar -C /usr/local -xvf xen-x.y.z.tar.gz
 
# cd /usr/local
 
# chown -R root:root xen-x.y.z
 
# cd xen-x.y.z
 
# ./configure --libdir=/usr/local/lib64 --with-initddir=/etc/rc.d
 
# make world
 
# make install
 
# make clean
 
# cd ../lib64/python2.7/site-packages
 
# ln -s xen /usr/lib64/python2.7/site-packages
 
# ln -s xen-3.0-py2.7.egg-info /usr/lib64/python2.7/site-packages
 
 
 
== Adjusting rc.local* ==
 
 
 
Xen needs a couple of daemons to run to ensure VM management. Add these lines to rc.local and rc.local_shutdown :
 
 
 
PATH=/usr/local/sbin:/usr/local/bin:$PATH
 
export PATH
 
 
# start xencommons
 
if [ -x /etc/rc.d/xencommons ]; then
 
    /etc/rc.d/xencommons start
 
fi
 
 
# stop xencommons
 
if [ -x /etc/rc.d/xencommons ]; then
 
    /etc/rc.d/xencommons stop
 
fi
 
  
== Compiling a dom0 Kernel ==
+
== Network configuration ==
  
Domain-0 (dom0 for short) is a special guest (virtual machine) that the Xen hypervisor always loads on host startup. Dom0 is used to control and manage the Xen hypervisor, and provides virtual disks and networks for other unprivileged guests (=domUs). Dom0 support was introduced in Linux kernel 3.0. The kernel generated must include the .config file domU and [http://wiki.xen.org/wiki/Mainline_Linux_Kernel_Configs#Configuring_the_kernel dom0 options]. Here is a minimal example of such a [{{SERVER}}/wikislax/download/config-dom0 .config dom0] file. Feel free to use it as a base, replacing device drivers as required. The rest of the kernel compilation is nominal :
+
The network configuration is done during system installation but it is possible to change it later by editing the files and restarting the right daemon:
  
# tar -C /usr/src -xvf linux-4.4.88.tar.bz2
+
{| {{thead}}
  # cd /usr/local
+
|-
  # rm linux
+
! {{chead}} width="200" | File
  # ln -s linux-4.4.88 linux
+
! {{chead}} | Content
  # cd linux
+
|-
  # make menuconfig
+
| <tt>'''/etc/rc.d/rc.inet1.conf'''</tt>||configuration of the network. For Xen the standard configuration uses a bridge. A bridge gathers several physical network interfaces. The bridge is configured with an IP address while the physical network interfaces are left unconfigured. After an update, restart using <tt>'''/etc/rc.d/rc.inet1 restart'''</tt>.
  # make
+
  # Config information for eth0:
# make modules_install
+
IPADDR[0]=""
# cp arch/x86_64/boot/bzImage /boot/vmlinuz-4.4.88-dom0
+
NETMASK[0]=""
# cp System.map /boot/System.map-4.4.88-dom0
+
USE_DHCP[0]=""
# cp .config /boot/config-4.4.88-dom0
+
DHCP_HOSTNAME[0]=""
 +
. . .
 +
  # Example of how to configure a bridge:
 +
  # Note the added "BRNICS" variable which contains a space-separated list
 +
# of the physical network interfaces you want to add to the bridge.
 +
IFNAME[0]="br0"
 +
BRNICS[0]="eth0"
 +
IPADDR[0]="192.168.0.1"
 +
  NETMASK[0]="255.255.255.0"
 +
  USE_DHCP[0]=""
 +
  DHCP_HOSTNAME[0]=""
 +
|-
 +
| <tt>'''/etc/rc.d/rc.networkmanager'''</tt>||is a script to allow network automatic configuration. If you manually set '''rc.inet1.conf''', make sure this scrit does not have execution rights.
 +
|-
 +
| <tt>'''/etc/rc.d/rc.ipforward'''</tt>||is a script to allow forwarding of packets between the interfaces. This is useful for a computer with several interfaces, for instance a firewall. To allow forwarding, just make the script executable.
 +
|-
 +
| <tt>'''/etc/ssh/sshd_config'''</tt>||ssh server configuration. '''PermitRootLogin yes''' affords login as root. To authorize X11Forwarding use '''ForwardX11 yes'''. After an update, restart using '''/etc/rc.d/rc.sshd restart'''.
 +
|-
 +
| <tt>'''/etc/ssh/ssh_config'''</tt>||ssh client configuration. To authorize X11Forwarding use '''ForwardX11 yes''' and '''ForwardX11Trusted yes''' to avoid a warning using '''ssh''' and get better security.
 +
|-
 +
| <tt>'''/etc/hosts'''</tt>||contains the addresses of the local hosts that bind cannot resolve, as they are in a private addressing plan. It is also possible to specify here addresses that will be chosen in lieu of their official address.
 +
|-
 +
| <tt>'''/etc/rc.d/rc.bind'''</tt>||setting this script as user-executable will afford running the local computer to be its own DNS.
 +
|-
 +
| <tt>'''/etc/named.conf'''</tt>||uncomment the query-source directive to suppress the port-unreachable packets on '''lo'''.
 +
|-
 +
| <tt>'''/etc/resolv.conf'''</tt>||if using local bind, append a line with <tt>'''nameserver 127.0.0.1'''</tt>.
 +
|-
 +
| <tt>'''/etc/udev/rules.d/70-persistent-net.rules'''</tt>||affords changing which interface is eth0.
 +
|}
 +
<br clear=all>
  
We're now all set up, Xen is ready to be booted by grub2 !
+
<u>Note</u> : In case of network issue, it can be a good idea to check the configuration using <tt>'''ifconfig -a'''</tt>, <tt>'''netstat -f inet -rn'''</tt>, and <tt>'''route'''</tt>. The routes are kept from one boot to the other and it may become necessary to delete the existing routes using <tt>'''route flush'''</tt>, then reboot.
  
 
<br/>
 
<br/>
  
{{ pFoot |[[Compiling from Source]]|[[Main Page]]|[[Using Grub2]]}}
+
{{pFoot|[[Linux basics]]|[[Main Page]]|[[IPTables]]}}

Revision as of 16:33, 15 December 2022

The location of the configuration files depend on the specific distribution, but is usually subdirectories of, or files in /etc, /usr/etc, /usr/local/etc. The files are set up by installation but can be updated later. Applying the configuration change will then be a matter of restarting the corresponding daemon. The main Slackware configuration files are :

Init configuration

File Content
/etc/inittab contains the default runlevel (3=multi-user, 4=graphical). On a live system, telinit n affords changing the level interactively.
/etc/fstab contains descriptions on the filesystems used on this computer, including the device, the mount point, the filesystem type and the opening options. Use man fstab, copy, and try !
/etc/http Directory containing the Apache configuration files such as httpd.conf.
/etc/lilo.conf used by lilo to generate a boot sector on the device or on the MBR (master boot record). If on the device and using the Windows bootloader, don't forget to copy the boot sector on a disquette so as to be able to use it from Windows.
/etc/mail Directory containing the Sendmail configuration files such as sendmail.mc and sendmail.cf. Spamassassin configuration also goes here as a subdirectory.
/etc/mail/aliases File containing a list of users that do not exist on the server and whose mail is redirected to existing users. After modifying this file the command newaliases must be ran.
# redirect news
usenet:         news
/etc/ntpd.conf Configuration for the network time protocol. Add ntp servers for your region as below. After an update, restart using /etc/rc.d/rc.ntpd restart.
# NTP server (list one or more) to synchronize with:
server 0.fr.pool.ntp.org
server 1.fr.pool.ntp.org
server 2.fr.pool.ntp.org
server 3.fr.pool.ntp.org
/etc/profile don't forget to update the paths:
MANPATH=/usr/local/share/man:/usr/local/man:/usr/man
/etc/profile.d the files contained in this directory are executed at login when executable. To remove the "Game of fortune" ran on user login :
chmod a-x /etc/profile.d/bsd-games-login-fortune.*
/etc/ld.so.conf list of additional libraries. Needs /sbin/ldconfig after adding new libraries. Add /usr/local/lib64 here.
.bashrc Specify . /etc/profile on a line of itself to use in konsole the same environment as in the command line. This will afford colorls to work in new konsole tabs.


The /etc/rc.d directory

The /etc/rc.d directory contains the scripts used to initialize the system services at the end of the boot. To use a specific script at startup, make it user-executable. To stop using it, remove the execution rights. Depending on the situation, scripts are called with the start, stop, or restart parameter.

Network configuration

The network configuration is done during system installation but it is possible to change it later by editing the files and restarting the right daemon:

File Content
/etc/rc.d/rc.inet1.conf configuration of the network. For Xen the standard configuration uses a bridge. A bridge gathers several physical network interfaces. The bridge is configured with an IP address while the physical network interfaces are left unconfigured. After an update, restart using /etc/rc.d/rc.inet1 restart.
# Config information for eth0:
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""
. . .
# Example of how to configure a bridge:
# Note the added "BRNICS" variable which contains a space-separated list
# of the physical network interfaces you want to add to the bridge.
IFNAME[0]="br0"
BRNICS[0]="eth0"
IPADDR[0]="192.168.0.1"
NETMASK[0]="255.255.255.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""
/etc/rc.d/rc.networkmanager is a script to allow network automatic configuration. If you manually set rc.inet1.conf, make sure this scrit does not have execution rights.
/etc/rc.d/rc.ipforward is a script to allow forwarding of packets between the interfaces. This is useful for a computer with several interfaces, for instance a firewall. To allow forwarding, just make the script executable.
/etc/ssh/sshd_config ssh server configuration. PermitRootLogin yes affords login as root. To authorize X11Forwarding use ForwardX11 yes. After an update, restart using /etc/rc.d/rc.sshd restart.
/etc/ssh/ssh_config ssh client configuration. To authorize X11Forwarding use ForwardX11 yes and ForwardX11Trusted yes to avoid a warning using ssh and get better security.
/etc/hosts contains the addresses of the local hosts that bind cannot resolve, as they are in a private addressing plan. It is also possible to specify here addresses that will be chosen in lieu of their official address.
/etc/rc.d/rc.bind setting this script as user-executable will afford running the local computer to be its own DNS.
/etc/named.conf uncomment the query-source directive to suppress the port-unreachable packets on lo.
/etc/resolv.conf if using local bind, append a line with nameserver 127.0.0.1.
/etc/udev/rules.d/70-persistent-net.rules affords changing which interface is eth0.


Note : In case of network issue, it can be a good idea to check the configuration using ifconfig -a, netstat -f inet -rn, and route. The routes are kept from one boot to the other and it may become necessary to delete the existing routes using route flush, then reboot.


Linux basics Main Page IPTables