First install some requirements. (This might be more than actually needed)
yum -y groupinstall "X Window System"
yum -y groupinstall "Virtualization Client"
yum -y groupinstall "Virtualization"
yum -y groupinstall "Virtualization Platform"
yum -y groupinstall "Virtualization Tools"
yum -y groupinstall "Desktop"
yum -y install xorg-x11-fonts-100dpi
yum -y install xorg-x11-fonts-75dpi
yum -y install xorg-x11-fonts-Type1 xorg-x11-font-utils
yum -y install man
yum -y install emacs
As stated in the question we already have an LVM volume group
[root@server ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg0 1 3 0 wz--n- 8.18t 97.90g
First we create and define a libvirt storage pool from that LVM volume group
[root@server ~]# cat /tmp/foobar
<pool type='logical'>
<name>pool0</name>
<target>
<path>/dev/vg0</path>
</target>
</pool>
[root@server ~]# virsh pool-define /tmp/foobar
Pool pool0 defined from /tmp/foobar
[root@server ~]# virsh pool-start pool0
Pool pool0 started
[root@server ~]# virsh pool-autostart pool0
Pool pool0 marked as autostarted
[root@server ~]# virsh pool-list
Name State Autostart
-----------------------------------------
pool0 active yes
Per default libvirt already has a virtual network configured. It is named default. In this example we will redefine that virtual network so that we can use it for PXE install.
[root@server ~]# virsh net-list
Name State Autostart
-----------------------------------------
default active yes
[root@server ~]# emacs /tmp/default.xml
[root@server ~]# cat /tmp/default.xml
<network>
<name>default</name>
<forward mode='nat'/>
<bridge name='virbr0' stp='on' delay='0' />
<ip address='10.0.0.1' netmask='255.255.0.0'>
<tftp root='/var/lib/dnsmasq/tftpboot' />
<dhcp>
<range start='10.0.0.2' end='10.0.255.255' />
<host mac='02:54:00:13:be:e4' name='virt1.example.com' ip='10.0.0.2' />
<host mac='02:52:2c:a3:11:42' name='virt2.example.com' ip='10.0.0.3' />
<bootp file='/pxelinux.0' />
</dhcp>
</ip>
</network>
The MAC addresses, 02:54:00:13:be:e4 and 02:52:2c:a3:11:42 seen above are just some random MAC addresses. (see the serverfault question: how to generate a random MAC address from the Linux command line)
[root@server ~]# virsh net-destroy default
Network default destroyed
[root@server ~]# virsh net-undefine default
Network default has been undefined
[root@server ~]# virsh net-define /tmp/default.xml
Network default defined from /tmp/default.xml
[root@server ~]# virsh net-start default
Network default started
[root@server ~]# virsh net-autostart default
Network default marked as autostarted
[root@server ~]# mkdir /var/lib/dnsmasq/tftpboot
[root@server ~]# ls -lZd /var/lib/dnsmasq/tftpboot
drwxr-xr-x. root root unconfined_u:object_r:dnsmasq_lease_t:s0 /var/lib/dnsmasq/tftpboot
[root@server ~]# yum install syslinux
[root@server ~]# rpm -ql syslinux | grep pxelinux.0
/usr/share/syslinux/gpxelinux.0
/usr/share/syslinux/pxelinux.0
[root@server ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/dnsmasq/tftpboot/
[root@server ~]# cd /var/lib/dnsmasq/tftpboot/
[root@server tftpboot]# wget -O centos-6-vmlinuz.x86_64 http://ftp.funet.fi/pub/Linux/mirrors/centos/6.0/os/x86_64/images/pxeboot/vmlinuz
[root@server tftpboot]# wget -O centos-6-initrd.img.x86_64 http://ftp.funet.fi/pub/Linux/mirrors/centos/6.0/os/x86_64/images/pxeboot/initrd.img
[root@server tftpboot]# mkdir /var/lib/dnsmasq/tftpboot/pxelinux.cfg
[root@server tftpboot]# cd /var/lib/dnsmasq/tftpboot/pxelinux.cfg
The MAC address 02:54:00:13:be:e4 used above needs the configuration filename 01-02-54-00-13-be-e4. In other words prepend 01-
and convert :
into -
.
[root@server pxelinux.cfg]# emacs 01-02-54-00-13-be-e4
[root@server pxelinux.cfg]# cat 01-02-54-00-13-be-e4
default local
prompt 1
timeout 50
label local
localboot 0
label install
kernel /centos-6-vmlinuz.x86_64
append initrd=/centos-6-initrd.img.x86_64 ks=http://www.example.com/kickstart-files/virt1.example.com.txt device=eth0 ramdisk_size=9216 lang= devfs=nomount
[root@server pxelinux.cfg]# cd
Here we assumed that the kickstart file for virt1.example.com can be downloaded from http://www.example.com/kickstart-files/virt1.example.com.txt
Now we run service libvirtd reload
. This seems to be required for the dnsmasq tftpserver to run properly.
[root@server ~]# service libvirtd reload
Reloading libvirtd configuration: [ OK ]
Now run virt-install to create the KVM guest virt1.example.com with 20 Gb disk space.
[root@server ~]# virt-install --debug --hvm --vnc --name virt1.example.com --os-type=linux --os-variant=rhel6 --pxe --network network=default,model=e1000,mac=02:54:00:13:be:e4 --disk pool=pool0,size=20 --ram 1024 --vcpus=1
Now the graphical program virt-viewer
will pop up an X-window. When you see "boot: " during the boot sequence, type install
.
A note about the virt-install command line options:
Using model=virtio
didn't work for me, but luckily model=e1000
worked just fine.
There are a whole lot of questions here that you have, and not much information provided for us to go on. But, here are some attempts:
The first thing I'd check is to see if your PATH is getting set at all when logging in. To check that, login to the terminal and type echo $PATH
. If the things you added are there, then great, on to the next problem. If they aren't there, then I'd verify you are actually running bash with echo $SHELL
. If you are, can you check if ANYTHING in ~/.bashrc or ~/.bash_profile is getting set? I'd find something innocuous and change it, then logout and back in to see if it took effect (or just add something like FOO="bar";export FOO
, then test it after login with echo $FOO
). If your .bashrc and .bash_profile aren't getting run, I'd check to see if .profile is getting run, and then also check if /etc/profile and /etc/rc/bash.bashrc are there and are calling the user's profiles correctly.
If you find that things are actually getting into .bash_profile, then I'd check to make sure your script and the directory it is placed in has the appropriate permissions, is executable, and that the directory is actually in your path (maybe something else is setting the path variable after you set it and overwriting your changes?).
If none of that works, then please post the following here and maybe we'll be able to see something more:
env
echo $SHELL
echo $PATH
cat ~/.bashrc
cat ~/.profile
cat ~/bash_profile
cat /etc/profile
cat /etc/bash.bashrc
Best Answer
The trick is telling Anaconda (the installer) that your are doing a serial port install. Add the keywords "serial console=ttyS0,57600" to your install line ("console" is for the kernel, and "serial" is picked up by Anaconda).