Difference between pages "Compiling Xen" and "Linux basics"

From Wikislax
(Difference between pages)
Jump to: navigation, search
(A few quirks)
 
(Useful linux commands)
 
Line 1: Line 1:
{{RightTOC}}
+
== Using VI ==
  
== What is Xen ? ==
+
'''vi''' (pronounced vee-eye) is the Unix standard text editor so affords editing the configuration files by hand. If you don’t know it yet, it can be a bit surprising. Actually, '''vi''' was created at a time when the keyboards did not have any arrow or insert keys. So there are two modes: the «open» mode and the «insert» mode.
  
[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.
+
The open mode affords moving the cursor. '''j''', '''k''', '''l''', '''m''' move the cursor by one character. '''ctrl-f''' moves one page forward and '''ctrl-b''' moves one page backwards. '''w''' moves one word forward and '''b''' moves one word backwards. It is also possible to use the arrow keys.
  
== A few quirks ==
+
'''i''' goes into insert mode before the cursor, '''a''' goes into insert mode after the cursor, and '''A''' goes into insert mode at the end of the line. '''o''' adds a line after the current line, and '''O''' adds a live before the current line. '''R''' goes into rewrite mode.
  
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. No such issue compiling xen-4.18.4 on slackware 15.0.
+
'''esc''' affords getting out of the insert mode.
  
# removepkg /var/log/packages/dev86-0.16.21-x86_64-1.txz
+
'''c$''' affords replacing the end of the line and '''d$''' affords deleting the end of the line. '''cw''' affords replacing one word and '''dw''' affords deleting one word. '''dd''' affords deleting the current line.
# 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. Slackware 15.0 includes grub-2.06 which is no problem.
+
''':q''' affords quitting without saving. If the file has been modified, quitting must be forced by typing ''':q!'''. ''':x''' affords saving and quitting. If the file does not have the write rigths, saving must be forced by typing ''':x!'''. ''':w''' affords writing the text in a new file. If the new file already exists, writing must be forced by typing ''':w!'''.
  
== Hardware requirements ==
+
''':num''' affords moving to the line number num. ''':$''' affords moving to the end of the file.
 +
''':num1copynum2''' affords copying the line number num1 after the line number num2. ''':num1mnum2''' affords moving the line number num1 after the line number num2.
  
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.
+
For detailed information, check the [http://vimdoc.sourceforge.net/htmldoc/help.html VIM Documentation]. To enter special characters check the page on [http://vimdoc.sourceforge.net/htmldoc/digraph.html digraphs]. To get rid of the message "skipping N old session files", delete files elvis*.ses in /var/tmp.
  
== Documentation difficulties ==
+
== Using SSH ==
  
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)].
+
SSH is a suite of tools affording connecting remotely over encrypted communications. On the client side, '''ssh''' offers a command line terminal, '''scp''' affords copying a file, and '''sftp''' behaves like ftp. The server side consists of sshd, sftp-server, and ssh-agent. ssh-add, ssh-keysign, ssh-keyscan, and ssh-keygen afford key management. The SSH present on Slackware and the BSDs is [https://www.openssh.com/ OpenSSH], developped by members of the [https://www.openbsd.org/ OpenBSD] project.
  
== Software constraints ==
+
'''ssh''' obviously requires your password every time it is executed. This can be avoided by creating on the client a pair of rsa keys and copying the public key to the server. Not specifying a passphrase is not very secure but will afford avoiding having to enter it every time :
  
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.
+
# '''ssh-keygen -t rsa'''
 +
Generating public/private rsa key pair.
 +
Enter file in which to save the key (/root/.ssh/id_rsa): '''<cr>'''
 +
Enter passphrase (empty for no passphrase): '''<cr>'''
 +
Enter same passphrase again: '''cr>'''
 +
Your identification has been saved in /root/.ssh/id_rsa.
 +
Your public key has been saved in /root/.ssh/id_rsa.pub.
 +
The key fingerprint is:
 +
SHA256:ATSDdER5/l8OJvr+jpINIReJtd81zntVbTjuJW5aobE root@client
 +
The key's randomart image is:
 +
+---[RSA 2048]----+
 +
|  ..=O+..      |
 +
|    ..o++.    ..|
 +
|      oo.    = +|
 +
|      . +o . = +.|
 +
|      oSo. o * o|
 +
|        . o o*.=.|
 +
|        = +E+* .|
 +
|        + ...+.. |
 +
|        ++o+    |
 +
+----[SHA256]-----+
 +
# '''scp root@client:.ssh/id_rsa.pub root@server:.ssh/id_rsa.pub'''
 +
password: '''secret<cr>'''
 +
id_rsa.pub                                          100% 394      1.8MB/s  00:00
 +
# '''ssh server'''
 +
password: '''secret<cr>'''
 +
# '''cd .ssh'''
 +
# '''cat >> authorized_keys < id_rsa.pub'''
 +
# '''chmod 600 authorized_keys'''
 +
# '''rm id_rsa.pub'''
  
== Installing acpica ==
+
== Useful linux commands ==
  
Xen requires acpica. [https://www.acpica.org/downloads Download] then install as below :
+
{| {{thead}}
 +
|-
 +
! {{chead}} width="220" | Command
 +
! {{chead}} | Effect
 +
|-
 +
|<tt>'''cd'''</tt>||change directory.
 +
|-
 +
|<tt>'''chmod -R ppp ddd'''</tt>||recursively change permissions on file or directory.
 +
|-
 +
|<tt>'''chown -R uuu:ggg ddd'''</tt>||recursively change user:group ownership on file or directory.
 +
|-
 +
|<tt>'''chgrp -R ggg ddd'''</tt>||recursively change group ownership on file or directory.
 +
|-
 +
|<tt>'''command xxx <nowiki>|</nowiki> grep yyy'''</tt>||search for string yyy in output of command xxx.
 +
|-
 +
|<tt>'''ethtool -s eth0 wol g'''</tt>||puts interface eth0 in wake-on-lan status.
 +
|-
 +
|<tt>'''find xxx -name yyy -print'''</tt>||find file yyy in in subdirectories of xxx.
 +
|-
 +
|<tt>'''ifconfig -a'''</tt>||kill print the network interfaces configuration.
 +
|-
 +
|<tt>'''iptables -L'''</tt>||print the firewall rules.
 +
|-
 +
|<tt>'''killall xxx'''</tt>||kill program named xxx.
 +
|-
 +
|<tt>'''ldconfig'''</tt>||reload libraries taking into account new libraries just built.
 +
|-
 +
|<tt>'''ln -s existing new'''</tt>||create a symbolic link new to an existing directory or file.
 +
|-
 +
|<tt>'''ls -al'''</tt>||list the working directory, including files beginning with a dot.
 +
|-
 +
|<tt>'''man xxx'''</tt>||display the xxx command manual page.
 +
|-
 +
|<tt>'''more xxx'''</tt>||display file xxx with the possibility of moving up and down. '''less''' and '''most''' are similar commands.
 +
|-
 +
|<tt>'''mount -t ttt /dev/xxx /mnt/ddd'''</tt>||mount device xxx as type ttt under directory ddd.
 +
|-
 +
|<tt>'''(u)mount /mnt/ddd'''</tt>||(u)mount device ddd as specified in /etc/fstab.
 +
|-
 +
|<tt>'''nmap <i>host</i>'''</tt>||check filtering status of ports on <i>host</i>. '''-sU''' for UDP.
 +
|-
 +
|<tt>'''ntpdate -bv 0.fr.pool.ntp.org|| force ntp synchronization.
 +
|-
 +
|<tt>'''ps -ef'''</tt>||list the running processes.
 +
|-
 +
|<tt>'''pwd'''</tt>||print working directory.
 +
|-
 +
|<tt>'''rm -r'''</tt>||remove file or directory recursively.
 +
|-
 +
|<tt>'''route'''</tt>||display the network routing table.
 +
|-
 +
|<tt>'''screen <i>-S<name></i>'''</tt>||screen offers a frame to run a shell, detach from it (<ctrl>-a d) and later reattach to it.
 +
|-
 +
|<tt>'''ssh <i>host</i>'''</tt>||connect remotely to site <i>host</i>.
 +
|-
 +
|<tt>'''su -l uuuu'''</tt>||execute shell as another user. if -l is used an environment similar to what the other user would have had with a direct login is provided.
 +
|-
 +
|<tt>'''telinit n'''</tt>||go to the runlevel n (1=single-user, 3=multi-user, 4=graphical, 6=reboot).
 +
|-
 +
|<tt>'''umask'''</tt>||edit /etc/profile to change the default umask value of 022 and '''set it to 027''' (files not readable by other users), a good setting except when installing as root server software to be ran as a standard user account (permission issues).
 +
|-
 +
|<tt>'''vi'''</tt>||run the vi text editor. To get rid of the message "skipping N old session files", delete files elvis*.ses in /var/tmp.
 +
|}
  
# tar -C /usr/local -xvf acpica-unix-yyyymmdd.tar.gz
+
<br clear=all>
# cd /usr/local
 
# chown -R root:root acpica-unix-yyyymmdd
 
# cd acpica-unix-yyyymmdd
 
# make
 
# make install
 
  
== Installing yajl ==
+
{{pFoot|[[Maintaining Slackware]]|[[Main Page]]|[[Configuration files]]}}
 
 
Xen 4.19.1 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-17b1790.tar.gz
 
# cd /usr/local
 
# chown -R root:root lloyd-yajl-17b1790
 
# cd lloyd-yajl-17b1790
 
# ./configure
 
# make
 
# make install
 
# cd ../lib
 
# mv libyajl* ../lib64
 
# ldconfig
 
 
 
== 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 ==
 
 
 
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 :
 
 
 
# tar -C /usr/src -xvf linux-4.4.88.tar.bz2
 
# cd /usr/local
 
# rm linux
 
# ln -s linux-4.4.88 linux
 
# cd linux
 
# make menuconfig
 
# make
 
# make modules_install
 
# cp arch/x86_64/boot/bzImage /boot/vmlinuz-4.4.88-dom0
 
# cp System.map /boot/System.map-4.4.88-dom0
 
# cp .config /boot/config-4.4.88-dom0
 
 
 
We're now all set up, Xen is ready to be booted by grub2 !
 
 
 
<br/>
 
 
 
{{ pFoot |[[Compiling from Source]]|[[Main Page]]|[[Using Grub2]]}}
 

Revision as of 23:54, 25 March 2025

Using VI

vi (pronounced vee-eye) is the Unix standard text editor so affords editing the configuration files by hand. If you don’t know it yet, it can be a bit surprising. Actually, vi was created at a time when the keyboards did not have any arrow or insert keys. So there are two modes: the «open» mode and the «insert» mode.

The open mode affords moving the cursor. j, k, l, m move the cursor by one character. ctrl-f moves one page forward and ctrl-b moves one page backwards. w moves one word forward and b moves one word backwards. It is also possible to use the arrow keys.

i goes into insert mode before the cursor, a goes into insert mode after the cursor, and A goes into insert mode at the end of the line. o adds a line after the current line, and O adds a live before the current line. R goes into rewrite mode.

esc affords getting out of the insert mode.

c$ affords replacing the end of the line and d$ affords deleting the end of the line. cw affords replacing one word and dw affords deleting one word. dd affords deleting the current line.

:q affords quitting without saving. If the file has been modified, quitting must be forced by typing :q!. :x affords saving and quitting. If the file does not have the write rigths, saving must be forced by typing :x!. :w affords writing the text in a new file. If the new file already exists, writing must be forced by typing :w!.

:num affords moving to the line number num. :$ affords moving to the end of the file. :num1copynum2 affords copying the line number num1 after the line number num2. :num1mnum2 affords moving the line number num1 after the line number num2.

For detailed information, check the VIM Documentation. To enter special characters check the page on digraphs. To get rid of the message "skipping N old session files", delete files elvis*.ses in /var/tmp.

Using SSH

SSH is a suite of tools affording connecting remotely over encrypted communications. On the client side, ssh offers a command line terminal, scp affords copying a file, and sftp behaves like ftp. The server side consists of sshd, sftp-server, and ssh-agent. ssh-add, ssh-keysign, ssh-keyscan, and ssh-keygen afford key management. The SSH present on Slackware and the BSDs is OpenSSH, developped by members of the OpenBSD project.

ssh obviously requires your password every time it is executed. This can be avoided by creating on the client a pair of rsa keys and copying the public key to the server. Not specifying a passphrase is not very secure but will afford avoiding having to enter it every time :

# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): <cr>
Enter passphrase (empty for no passphrase): <cr>
Enter same passphrase again: cr>
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:ATSDdER5/l8OJvr+jpINIReJtd81zntVbTjuJW5aobE root@client
The key's randomart image is:
+---[RSA 2048]----+
|   ..=O+..       |
|    ..o++.     ..|
|       oo.    = +|
|      . +o . = +.|
|       oSo. o * o|
|        . o o*.=.|
|         = +E+* .|
|        + ...+.. |
|         ++o+    |
+----[SHA256]-----+
# scp root@client:.ssh/id_rsa.pub root@server:.ssh/id_rsa.pub
password: secret<cr>
id_rsa.pub                                          100% 394      1.8MB/s   00:00
# ssh server
password: secret<cr>
# cd .ssh
# cat >> authorized_keys < id_rsa.pub
# chmod 600 authorized_keys
# rm id_rsa.pub

Useful linux commands

Command Effect
cd change directory.
chmod -R ppp ddd recursively change permissions on file or directory.
chown -R uuu:ggg ddd recursively change user:group ownership on file or directory.
chgrp -R ggg ddd recursively change group ownership on file or directory.
command xxx | grep yyy search for string yyy in output of command xxx.
ethtool -s eth0 wol g puts interface eth0 in wake-on-lan status.
find xxx -name yyy -print find file yyy in in subdirectories of xxx.
ifconfig -a kill print the network interfaces configuration.
iptables -L print the firewall rules.
killall xxx kill program named xxx.
ldconfig reload libraries taking into account new libraries just built.
ln -s existing new create a symbolic link new to an existing directory or file.
ls -al list the working directory, including files beginning with a dot.
man xxx display the xxx command manual page.
more xxx display file xxx with the possibility of moving up and down. less and most are similar commands.
mount -t ttt /dev/xxx /mnt/ddd mount device xxx as type ttt under directory ddd.
(u)mount /mnt/ddd (u)mount device ddd as specified in /etc/fstab.
nmap host check filtering status of ports on host. -sU for UDP.
ntpdate -bv 0.fr.pool.ntp.org force ntp synchronization.
<tt>ps -ef list the running processes.
pwd print working directory.
rm -r remove file or directory recursively.
route display the network routing table.
screen -S<name> screen offers a frame to run a shell, detach from it (<ctrl>-a d) and later reattach to it.
ssh host connect remotely to site host.
su -l uuuu execute shell as another user. if -l is used an environment similar to what the other user would have had with a direct login is provided.
telinit n go to the runlevel n (1=single-user, 3=multi-user, 4=graphical, 6=reboot).
umask edit /etc/profile to change the default umask value of 022 and set it to 027 (files not readable by other users), a good setting except when installing as root server software to be ran as a standard user account (permission issues).
vi run the vi text editor. To get rid of the message "skipping N old session files", delete files elvis*.ses in /var/tmp.


Maintaining Slackware Main Page Configuration files