Install Virt-top

Install Virt-top and enable to watch the status of Virtual machines on the console.
[1] Install Virt-top  
[root@dlp ~]# 

yum -y install virt-top
[2] Operations
# watch the status with the following command ( push “q” key to quit )

[root@dlp ~]# 

virt-top
# show CPU status to push “1” key

# show network status to push “2” key

# others

[root@dlp ~]# 

virt-top –help 

virt-top: unknown option `–help]’.
virt-top : a ‘top’-like utility for virtualization

SUMMARY
    virt-top [-options]

OPTIONS
  -1

Start by displaying pCPUs (default: tasks)

  -2

Start by displaying network interfaces

  -3

Start by displaying block devices

  -b

Batch mode

  -c uri

Connect to URI (default: Xen)

  –connect uri

Connect to URI (default: Xen)

  –csv file

Log statistics to CSV file

  –no-csv-cpu

Disable CPU stats in CSV

  –no-csv-block

Disable block device stats in CSV

  –no-csv-net

Disable net stats in CSV

  -d delay

Delay time interval (seconds)

  –debug file

Send debug messages to file

  –end-time time

Exit at given time

  –hist-cpu secs

Historical CPU delay

  –init-file file

Set name of init file

  –no-init-file

Do not read init file

  -n iterations

Number of iterations to run

  -o sort

Set sort order (cpu|mem|time|id|name)

  -s

Secure (“kiosk”) mode

  –script

Run from a script (no user interface)

  -help

Display this list of options

  –help

Display this list of options
Advertisements

Enable vhost-net

Enable vhost-net to mitigate overheads on virtualiazation environment.
[1] Load vhost-net module on KVM Host.  
[root@dlp ~]# 

modprobe vhost_net 

[root@dlp ~]# 

lsmod | grep vhost 

vhost_net

25194 0

macvtap

7629 1 vhost_net

tun

14146 3 vhost_net
[2] It’s Ok all. Virtual Machines start with enabling vhost-net. By default, if vhost-net is loaded, virtual machines start with “vhost=on” automatically like follows.
[root@dlp ~]# 

virsh start www 
# start

Domain www started

[root@dlp ~]# 

ps -ef | grep vhost

qemu 3257 1 29 22:55 ? 00:00:02 /usr/bin/qemu-kvm -S -M pc-0.14 -enable-kvm -m 1024 -smp 2,sockets=2,cores=1,threads=1 -name www -uuid 8f1a7952-1866-9257-cbda-71d23833bad5 -nographic -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/www.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -drive file=/var/kvm/images/www.img,if=none,id=drive-virtio-disk0,format=raw -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,fd=23,id=hostnet0,

vhost=on

,vhostfd=24 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:bf:0e:e7,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -device usb-tablet,id=input0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
root 3285 2 0 22:55 ? 00:00:00 [vhost-3257]
root 3290 2060 0 22:55 pts/0 00:00:00 grep –color=auto vhost

Virtual Machine Operations

Operarions with virsh command.
[1] Start Virtual Machine  
[root@dlp ~]# 

virsh start www 
# start Virtual Machine ‘www’

Domain www started

[root@dlp ~]# 

virsh start www –console 
# start and connect to console of ‘www’

Domain www started
Connected to domain www

[2] Stop Virtual Machine
[root@dlp ~]# 

virsh shutdown www 
# stop Virtual Machine ‘www’ ( ‘acpid’ needs to be running on a guest )

Domain www is being shutdown

[root@dlp ~]# 

virsh destroy www 
# stop fourcely Virtual Machine ‘www’

Domain www destroyed

[3] Set auto-start for Virtual Machines
[root@dlp ~]# 

virsh autostart www 
# enable auto-start for ‘www’

Domain www marked as autostarted

[root@dlp ~]# 

virsh autostart –disable www 
# disable auto-start for ‘www’

Domain www unmarked as autostarted

[4] List all Virtual Machines
[root@dlp ~]# 

virsh list 
# list all active Virtual Machines

  Id Name

State

——————————————

  2   win2k8

running

[root@dlp ~]# 

virsh list –all 
# list all Virtual Machines include inactives

  Id Name

State

——————————————
  2   win2k8

running

  1   www

shut off
[5] Switch console
Move to GuestOS to HostOS with Ctrl + ] key.
Move to HostOS to GuestOS with a command ‘virsh console (name of virtual machine)’.
[root@dlp ~]# 

virsh console www 
# connect to ‘www’

Connected to domain www
Escape character is ^]

# Enter
Fedora release 16 (Verne)
Kernel 3.1.0-7.fc16.x86_64 on an x86_64 (ttyS0)
www login:

# just switched on Guest

Password:
Wed Nov 9 22:52:50 on ttyS0
[root@www ~]# 

# Ctrl + ] key

[root@dlp ~]# 

# just switched on Host
[6] Other options. There are many options, please try to execute them.
[root@dlp ~]# 

virsh –help
virsh [options]… [<command_string>]
virsh [options]… <command> [args…]
options:

-c | –connect <uri>
hypervisor connection URI

-r | –readonly
connect readonly

-d | –debug <num>
debug level [0-5]

-h | –help
this help

-q | –quiet
quiet mode

-t | –timing
print timing information

-l | –log <file>
output logging to file

-v | –version
program version
commands (non interactive mode):
Domain Management (help keyword ‘domain’)

attach-device
attach device from an XML file

attach-disk
attach disk device

attach-interface
attach network interface

autostart
autostart a domain

console
connect to the guest console

cpu-baseline
compute baseline CPU

cpu-compare
compare host CPU with a CPU described by an XML file

create
create a domain from an XML file

define
define (but don’t start) a domain from an XML file

destroy
destroy a domain

detach-device
detach device from an XML file

detach-disk
detach disk device

detach-interface
detach network interface

domid
convert a domain name or UUID to domain id

domjobabort
abort active domain job

domjobinfo
domain job information

domname
convert a domain id or UUID to domain name

domuuid
convert a domain name or id to domain UUID

domxml-from-native
Convert native config to domain XML

domxml-to-native
Convert domain XML to native config

dump
dump the core of a domain to a file for analysis

dumpxml
domain information in XML

edit
edit XML configuration for a domain

managedsave
managed save of a domain state

managedsave-remove
Remove managed save of a domain

maxvcpus
connection vcpu maximum

memtune
Get or set memory parameters

migrate
migrate domain to another host

migrate-setmaxdowntime
set maximum tolerable downtime

reboot
reboot a domain

restore
restore a domain from a saved state in a file

resume
resume a domain

save
save a domain state to a file

schedinfo
show/set scheduler parameters

setmaxmem
change maximum memory limit

setmem
change memory allocation

setvcpus
change number of virtual CPUs

shutdown
gracefully shutdown a domain

start
start a (previously defined) inactive domain

suspend
suspend a domain

ttyconsole
tty console

undefine
undefine an inactive domain

update-device
update device from an XML file

vcpucount
domain vcpu counts

vcpuinfo
detailed domain vcpu information

vcpupin
control domain vcpu affinity

version
show version

vncdisplay
vnc display
Domain Monitoring (help keyword ‘monitor’)

domblkinfo
domain block device size information

domblkstat
get device block stats for a domain

domifstat
get network interface stats for a domain

dominfo
domain information

dommemstat
get memory statistics for a domain

domstate
domain state

list
list domains
Host and Hypervisor (help keyword ‘host’)

capabilities
capabilities

connect
(re)connect to hypervisor

freecell
NUMA free memory

hostname
print the hypervisor hostname

nodeinfo
node information

qemu-monitor-command
Qemu Monitor Command

sysinfo
print the hypervisor sysinfo

uri
print the hypervisor canonical URI
Interface (help keyword ‘interface’)

iface-define
define (but don’t start) a physical host interface from an XML file

iface-destroy
destroy a physical host interface (disable it / “if-down”)

iface-dumpxml
interface information in XML

iface-edit
edit XML configuration for a physical host interface

iface-list
list physical host interfaces

iface-mac
convert an interface name to interface MAC address

iface-name
convert an interface MAC address to interface name

iface-start
start a physical host interface (enable it / “if-up”)

iface-undefine
undefine a physical host interface (remove it from configuration)
Network Filter (help keyword ‘filter’)

nwfilter-define
define or update a network filter from an XML file

nwfilter-dumpxml
network filter information in XML

nwfilter-edit
edit XML configuration for a network filter

nwfilter-list
list network filters

nwfilter-undefine
undefine a network filter
Networking (help keyword ‘network’)

net-autostart
autostart a network

net-create
create a network from an XML file

net-define
define (but don’t start) a network from an XML file

net-destroy
destroy a network

net-dumpxml
network information in XML

net-edit
edit XML configuration for a network

net-info
network information

net-list
list networks

net-name
convert a network UUID to network name

net-start
start a (previously defined) inactive network

net-undefine
undefine an inactive network

net-uuid
convert a network name to network UUID
Node Device (help keyword ‘nodedev’)

nodedev-create
create a device defined by an XML file on the node

nodedev-destroy
destroy a device on the node

nodedev-dettach
dettach node device from its device driver

nodedev-dumpxml
node device details in XML

nodedev-list
enumerate devices on this host

nodedev-reattach
reattach node device to its device driver

nodedev-reset
reset node device
Secret (help keyword ‘secret’)

secret-define
define or modify a secret from an XML file

secret-dumpxml
secret attributes in XML

secret-get-value
Output a secret value

secret-list
list secrets

secret-set-value
set a secret value

secret-undefine
undefine a secret
Snapshot (help keyword ‘snapshot’)

snapshot-create
Create a snapshot

snapshot-current
Get the current snapshot

snapshot-delete
Delete a domain snapshot

snapshot-dumpxml
Dump XML for a domain snapshot

snapshot-list
List snapshots for a domain

snapshot-revert
Revert a domain to a snapshot
Storage Pool (help keyword ‘pool’)

find-storage-pool-sources-as
find potential storage pool sources

find-storage-pool-sources
discover potential storage pool sources

pool-autostart
autostart a pool

pool-build
build a pool

pool-create-as
create a pool from a set of args

pool-create
create a pool from an XML file

pool-define-as
define a pool from a set of args

pool-define
define (but don’t start) a pool from an XML file

pool-delete
delete a pool

pool-destroy
destroy a pool

pool-dumpxml
pool information in XML

pool-edit
edit XML configuration for a storage pool

pool-info
storage pool information

pool-list
list pools

pool-name
convert a pool UUID to pool name

pool-refresh
refresh a pool

pool-start
start a (previously defined) inactive pool

pool-undefine
undefine an inactive pool

pool-uuid
convert a pool name to pool UUID
Storage Volume (help keyword ‘volume’)

vol-clone
clone a volume.

vol-create-as
create a volume from a set of args

vol-create
create a vol from an XML file

vol-create-from
create a vol, using another volume as input

vol-delete
delete a vol

vol-dumpxml
vol information in XML

vol-info
storage vol information

vol-key
returns the volume key for a given volume name or path

vol-list
list vols

vol-name
returns the volume name for a given volume key or path

vol-path
returns the volume path for a given volume name or key

vol-pool
returns the storage pool for a given volume key or path

vol-wipe
wipe a vol
Virsh itself (help keyword ‘virsh’)

cd
change the current directory

echo
echo arguments

exit
quit this interactive terminal

help
print help

pwd
print the current directory

quit
quit this interactive terminal
(specify help <group> for details about the commands in the group)

(specify help <command> for details about the command)

Install Virtual Machine2

Create a Virtual Machine from template.
[1] Create a Virtual Machine from template that is made in previous page.  
# copy disk image and XML file for a new Virtual Machine

[root@dlp ~]# 

virt-clone –original template –name mail –file /var/kvm/images/mail.img 

Allocating ‘mail.img’

| 20 GB 01:44
Clone ‘mail’ created successfully.

[root@dlp ~]# 

virsh start mail –console 

Domain mail started
Connected to domain mail
Fedora release 16 (Verne)
Kernel 3.1.0-7.fc16.x86_64 on an x86_64 (ttyS0)

localhost login:

# complete
[2] News GuestOS’ network is failed to boot because it is the same to existing GuestOS’s one. So Change network settings for new one.
[root@localhost ~]# 

ifconfig -a 

eth0

Link encap:Ethernet HWaddr 00:16:3E:72:BD:4E

BROADCAST MULTICAST MTU:1500 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

 

RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
lo

Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

 

RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

[root@localhost ~]# 

cd /etc/sysconfig/network-scripts 

[root@localhost network-scripts]# 

vi ifcfg-eth0
# change the name and MAC address to correct one

# If you set static IP address, See initial config

DEVICE=”eth0″
BOOTPROTO=”dhcp”
HWADDR=”

00:16:3E:72:BD:4E


ONBOOT=”yes”
NM_CONTROLLED=”yes”

[root@dlp ~]# 

systemctl restart network.service 

Install Virtual Machine1

Install GuestOS and create Virtual Machine. This example shows to install Fedora 16.
[1] Install on text mode via network, it’s OK on Console or remote connection with Putty and so on. Furthermore, Virtual Machine’s images are placed at /var/lib/libvirt/images by default as a Storage Pool, but this example shows to create and use a new Storage Pool.
[root@dlp ~]# 

mkdir -p /var/kvm/images 
# create a new Storage Pool

[root@dlp ~]# 

virt-install \

-n www \
-r 1024 \
-f /var/kvm/images/www.img \
-s 20 \
–vcpus=2 \
–os-type linux \
–os-variant=fedora16 \
–network bridge=br0 \
–nographics \
–location=’http://ftp.jaist.ac.jp/pub/Linux/Fedora/releases/16/Fedora/x86_64/os/&#8217; \
–extra-args=’console=tty0 console=ttyS0,115200n8 serial’

Starting install…

# installation starts
 
For options, read ‘man virt-install’, there are many options.

-n specify the name of Virtual Machine
-r specify the amount of memories of Virtual Machine
-f specify the location of disks of Virtual Machine
-s specify the amount of disks of Virtual Machine
–vcpus=

specify the virtual CPUs

–os-type

specify types of GuestOS

–network=

specify network types of Virtual Machine. If you’ like to use more than 2 Networtk interfaces for virtual machine, add a line like “–network bridge=br1”.

–nographics 

nographics

–location=

specify location of installation where from

–extra-args=

specify parameters that is set in kernel
[2] Install with text mode, it’s the same with common procedure of installation. After finishing installation, reboot first and then login prompt is shown like follwos.
Fedora release 16 (Verne)
Kernel 3.1.0-7.fc16.x86_64 on an x86_64 (ttyS0)
localhost login:

# login

Password:
[root@localhost ~]#

[3] Move to GuestOS to HostOS with Ctrl + ] key.
Move to HostOS to GuestOS with a command ‘virsh console (name of virtual machine)’.
[root@localhost ~]# 

# push Ctrl + ]

[root@dlp ~]#

# Host’s console

[root@dlp ~]# 

virsh console www 
# move to Guest

Connected to domain www
Escape character is ^]

# Enter key

[root@localhost ~]#

# Guest’s console
[4] Because after installing GuestOS from network, it is minimum settings, it’s useful to save it as a template in order to create new virtual machines later. Please refer to next procedure to create a new virtual machine from template below. 
[root@localhost ~]# 

# push Ctrl + ]

[root@dlp ~]#

# Host’s console

[root@dlp ~]# 

virt-clone –original www –name template –file /var/kvm/images/template.img 

Cloning http://www.img

| 20 GB 01:44
Clone ‘template’ created successfully.

[root@dlp ~]# 

ll /var/kvm/images/template.img 

  

# disk image

-rwxr-xr-x 1 root root 21474836480 Nov 9 21:48 /var/kvm/images/template.img
[root@dlp ~]# 

ll /etc/libvirt/qemu/template.xml 

  

# xml file

-rw——- 1 root root 1562 Nov 9 21:47 /etc/libvirt/qemu/template.xml

[5] Set basic initial configuration to GuestOS first before using it.
[6] Define a new Storage Pool
[root@dlp ~]# 

mkdir /etc/libvirt/storage 

[root@dlp ~]# 

vi /etc/libvirt/storage/disk01.xml
  

# create new

<pool type=’dir’>
  

# any name

  <name>disk01</name>
  <capacity>0</capacity>
  <allocation>0</allocation>
  <available>0</available>
  <source>
  </source>
  <target>
    

# specify pool directory

    <path>/var/kvm/images</path>
    <permissions>
        <mode>0700</mode>
        <owner>-1</owner>
        <group>-1</group>
    </permissions>
  </target>
</pool>

# define a pool

[root@dlp ~]# 

virsh pool-define /etc/libvirt/storage/disk01.xml 

Pool disk01 defined from /etc/libvirt/storage/disk01.xml
# start the pool

[root@dlp ~]# 

virsh pool-start disk01 

Pool disk01 started
# set auto-start

[root@dlp ~]# 

virsh pool-autostart disk01 

Pool disk01 marked as autostarted
# confirm to show the pool list

[root@dlp ~]# 

virsh pool-list 

Name

State
Autostart

—————————————–
disk01

active
yes
# confirm to show the details

[root@dlp ~]# 

virsh pool-info disk01 

Name:

disk01

UUID:

3f8ec915-8f40-49de-5be4-bea452bf0c21

State:

running

Persistent:

yes

Autostart:

yes

Capacity:

283.33 GB

Allocation:

3.58 GB

Available:

279.75 GB

Install KVM

It’s Virtualization with KVM ( Kernel-based Virtual Machine ) + QEMU. This requires that the CPU on your computer has a function Intel VT or AMD-V.
[1] Install KVM
[root@dlp ~]# 

yum -y install qemu-kvm libvirt python-virtinst bridge-utils

[root@dlp ~]# 

lsmod | grep kvm 

kvm_intel

43336 0

kvm 

306680 1 kvm_intel

[root@dlp ~]# 

systemctl start libvirtd.service 

[root@dlp ~]# 

chkconfig libvirtd on
[2] Configure Bridge networking for KVM virtual machine.
[root@dlp ~]# 

cd /etc/sysconfig/network-scripts 

[root@dlp network-scripts]# 

cp ifcfg-eth0 ifcfg-br0 

[root@dlp network-scripts]# 

vi ifcfg-br0
DEVICE=

br0
# change

HWADDR=00:22:68:5E:34:06
ONBOOT=yes
BOOTPROTO=none
NM_CONTROLLED=yes
IPADDR=10.0.0.30
NETMASK=255.255.255.0
TYPE=

Bridge
# change

GATEWAY=10.0.0.1
DNS1=10.0.0.1
IPV6INIT=no
USERCTL=no
PREFIX=24

[root@dlp network-scripts]# 

vi ifcfg-eth0
DEVICE=eth0
HWADDR=00:22:68:5E:34:06
ONBOOT=yes
BOOTPROTO=none
NM_CONTROLLED=yes
IPADDR=10.0.0.30
NETMASK=255.255.255.0
TYPE=Ethernet
GATEWAY=10.0.0.1
DNS1=10.0.0.1
IPV6INIT=no
USERCTL=no
PREFIX=24

BRIDGE=br0
# add
[root@dlp network-scripts]# 

[root@dlp ~]# 

br0       Link encap:Ethernet  HWaddr 00:22:68:5E:34:06
          inet addr:10.0.0.30  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::222:68ff:fe5e:3406/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:336 errors:0 dropped:0 overruns:0 frame:0
          TX packets:350 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:26530 (25.9 KiB)  TX bytes:40462 (39.5 KiB)

eth0      Link encap:Ethernet  HWaddr 00:22:68:5E:34:06
          inet6 addr: fe80::222:68ff:fe5e:3406/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:362 errors:0 dropped:0 overruns:0 frame:0
          TX packets:365 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:34070 (33.2 KiB)  TX bytes:41504 (40.5 KiB)
          Interrupt:44 Base address:0xa000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:62 errors:0 dropped:0 overruns:0 frame:0
          TX packets:62 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:5640 (5.5 KiB)  TX bytes:5640 (5.5 KiB)

virbr0    Link encap:Ethernet  HWaddr 52:54:00:CD:6D:55
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Add Hard Drives

This is an example to create a new partition when you add new Hard Drives on your Machine.

The follows shows to create a LVM partition.

[root@dlp ~]# 

fdisk /dev/sdb
# enter to the fdisk operation mode

WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to

  switch off the mode (command ‘c’) and change display units to

  sectors (command ‘u’).
Command (m for help): 

p
# show partition table

Disk /dev/sdb: 320.1 GB, 320071851520 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000c881d

  Device Boot

Start
End
Blocks
Id
System

 

# none

Command (m for help): 

n
# create a partition

Command action
  e    extended
  p    primary partition (1-4)

p
# primary

Partition number (1-4): 

1
# partition number

First cylinder (1-1-38913, default 1): 

# starting cylinder

Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-38913, default 38913):  

# end cylinder

Using default value 38913
Command (m for help): 

p
# show partition table

Disk /dev/sdb: 320.1 GB, 320071851520 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000c881d

  Device Boot

Start
End
Blocks
Id
System

  /dev/sdb1

1
38913
312568641
83
Linux   

# just created

Command (m for help): 

t
# change type

Selected partition 1
Hex code (type L to list codes): 

L
# show lists

0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris 1 FAT12 39 Plan 9 82 Linux swap / So c1 DRDOS/sec (FAT- 2 XENIX root 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT- 3 XENIX usr 40 Venix 80286 84 OS/2 hidden C: c6 DRDOS/sec (FAT- 4 FAT16 <32M 41 PPC PReP Boot 85 Linux extended c7 Syrinx 5 Extended 42 SFS 86 NTFS volume set da Non-FS data 6 FAT16 4d QNX4.x 87 NTFS volume set db CP/M / CTOS / . 7 HPFS/NTFS 4e QNX4.x 2nd part 88 Linux plaintext de Dell Utility 8 AIX 4f QNX4.x 3rd part 8e Linux LVM df BootIt 9 AIX bootable 50 OnTrack DM 93 Amoeba e1 DOS access a OS/2 Boot Manag 51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O b W95 FAT32 52 CP/M 9f BSD/OS e4 SpeedStor c W95 FAT32 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi eb BeOS fs e W95 FAT16 (LBA) 54 OnTrackDM6 a5 FreeBSD ee GPT f W95 Ext’d (LBA) 55 EZ-Drive a6 OpenBSD ef EFI (FAT-12/16/ 10 OPUS 56 Golden Bow a7 NeXTSTEP f0 Linux/PA-RISC b 11 Hidden FAT12 5c Priam Edisk a8 Darwin UFS f1 SpeedStor 12 Compaq diagnost 61 SpeedStor a9 NetBSD f4 SpeedStor 14 Hidden FAT16 ❤ 63 GNU HURD or Sys ab Darwin boot f2 DOS secondary 16 Hidden FAT16 64 Novell Netware af HFS / HFS+ fb VMware VMFS 17 Hidden HPFS/NTF 65 Novell Netware b7 BSDI fs fc VMware VMKCORE 18 AST SmartSleep 70 DiskSecure Mult b8 BSDI swap fd Linux raid auto 1b Hidden W95 FAT3 75 PC/IX bb Boot Wizard hid fe LANstep 1c Hidden W95 FAT3 80 Old Minix be Solaris boot ff BBT 1e Hidden W95 FAT1

Hex code (type L to list codes): 

8e

   

# select Linux LVM number

Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): 

p
# show partition table

Disk /dev/sdb: 320.1 GB, 320071851520 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000c881d

  Device Boot

Start
End
Blocks
Id
System

  /dev/sdb1

1
38913
312568641
8e
Linux LVM   

# just changed

Command (m for help): 

w
# save and quit

The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

[root@dlp ~]# 

sfdisk -l /dev/sdb
# show status

Disk /dev/sdb: 38913 cylinders, 255 heads, 63 sectors/track

Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

Device

  Boot
Start
End
#cyls
#blocks
Id
System

/dev/sdb1

0+
20022
38913-
312568641
8e
Linux LVM  

# just changed

/dev/sdb2

0
0
0
0
Empty

/dev/sdb3

0
0
0
0
Empty

/dev/sdb4

0
0
0
0
Empty

Install Clam AntiVirus

Install Clam AntiVirus to protect from virus.
[1] Install Clamav  
[root@dlp ~]# 

yum -y install clamav clamav-update
[root@dlp ~]# 

vi /etc/freshclam.conf
# line 8: make it comment

#

Example

[root@dlp ~]# 

freshclam
# update pattern files

ClamAV update process started at Wed Nov 9 22:37:15 2011
Downloading main.cvd [100%]
main.cvd updated (version: 54, sigs: 1044387, f-level: 60, builder: sven)
Downloading daily.cvd [100%]
daily.cvd updated (version: 13907, sigs: 27095, f-level: 60, builder: ccordes)
Downloading bytecode.cvd [100%]
bytecode.cvd updated (version: 152, sigs: 38, f-level: 60, builder: edwin)
Database updated (1071520 signatures) from database.clamav.net (IP: 211.10.155.48)

[2] Try to scan
[root@dlp ~]# 

clamscan –infected –remove –recursive /home
———– SCAN SUMMARY ———–
Known viruses: 1070266
Engine version: 0.97.3
Scanned directories: 2
Scanned files: 3
Infected files: 0
Data scanned: 0.00 MB
Data read: 0.00 MB (ratio 0.00:1)
Time: 2.381 sec (0 m 2 s)
# download trial virus

[root@dlp ~]# 

wget http://www.eicar.org/download/eicar.com
[root@dlp ~]# 

clamscan –infected –remove –recursive .

./eicar.com: Eicar-Test-Signature FOUND
./eicar.com: Removed.

# just detected

———– SCAN SUMMARY ———–
Known viruses: 1070266
Engine version: 0.97.3
Scanned directories: 2
Scanned files: 13
Infected files: 1
Data scanned: 0.28 MB
Data read: 0.14 MB (ratio 2.00:1)
Time: 2.497 sec (0 m 2 s)

Create SSL Certificate

Create a your server’s original SSL Certificate. If you use your server as a business, it had better buy and use a Formal Certificate fromVerisign and so on.
[root@www ~]# 

cd /etc/pki/tls/certs 

[root@www certs]# 

make server.key 

umask 77 ; \
/usr/bin/openssl genrsa -aes128 2048 > server.key
Generating RSA private key, 2048 bit long modulus
..+++
…+++
e is 65537 (0x10001)
Enter pass phrase:

# set passphrase

Verifying – Enter pass phrase:

# confirm

# remove passphrase from private key

[root@www certs]# 

openssl rsa -in server.key -out server.key 

Enter pass phrase for server.key:

# input passphrase

writing RSA key

[root@www certs]# 

make server.csr 

umask 77 ; \
/usr/bin/openssl req -utf8 -new -key server.key -out server.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [XX]:

JP
# country

State or Province Name (full name) []:

Hiroshima

   

# state

Locality Name (eg, city) [Default City]:

Hiroshima
# city

Organization Name (eg, company) [Default Company Ltd]:

GTS

   

# company

Organizational Unit Name (eg, section) []:

Server World

   

# department

Common Name (eg, your name or your server’s hostname) []:

   

# server’s FQDN

Email Address []:

xxx@server.world
# email address
Please enter the following ‘extra’ attributes
to be sent with your certificate request
A challenge password []:

# Enter

An optional company name []:

# Enter

[root@www certs]# 

openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 3650

Signature ok
subject=/C=JP/ST=Hiroshima/L=Hiroshima/O=GTS/OU=Server World/CN=www.server.world/emailAddress=xxx@server.world
Getting Private key
[root@www certs]# 

chmod 400 server.*

Install VNC Server

[1] Install VNC Server to operate Server with GUI remotely from Windows client.
[root@dlp ~]# 

yum -y install tigervnc-server

[root@dlp ~]# 

su – fedora 
# switch to a user you’d like to config VNC

[fedora@dlp ~]$ 

vncpasswd 
# set VNC password

Password:

# input

Verify:

# confirm

[fedora@dlp ~]$ 

vncserver :1
# start

xauth: file /home/fedora/.Xauthority does not exist

New ‘dlp.server.world:1 (fedora)’ desktop is dlp.server.world:1
Creating default startup script /home/fedora/.vnc/xstartup
Starting applications specified in /home/fedora/.vnc/xstartup
Log file is /home/fedora/.vnc/dlp.server.world:1.log

[fedora@dlp ~]$ 

vncserver -kill :1
# stop

Killing Xvnc process ID 1872

[fedora@dlp ~]$ 

vi /home/fedora/.vnc/xstartup
#

twm & 

# add at the last line: make it comment

exec gnome-session &
# use Ghome
# run with diplay number ‘1’, screen resolution ‘800×600′, color depth ’24’

[fedora@dlp ~]$ 

vncserver :1 -geometry 800×600 -depth 24
[2]
Install VNC viewer on client computer next. Download from the site below to install.

Start VNC viewer after installing. Then following scrren is shown. Input [(Server’s hostname or IP address):(display number)] like following example.

 
[3] Password is required. Input VNC password you set in the section [1].
 
[4] Just connected.