kvm 虛擬化學(xué)習(xí)&運(yùn)維技巧(一)
一:VNC訪問(wèn)亂碼
cp /etc/locale.conf /etc/locale.conf.bak
vim /etc/locale.conf
#LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN.UTF-8:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.UTF-8:zh_CN:en_US.UTF-8:en_US:en"
SYSFONT="lat0-sun16"
vi /etc/sysconfig/i18n
LANG="en_US.UTF-8" #默認(rèn)語(yǔ)言改為英語(yǔ)
reboot #重啟服務(wù)器
二:創(chuàng)建虛擬機(jī)
vncviewer `virsh vncdisplay 41`
dd if=/dev/zero of=testtest.img bs=1G count=0 seek=20
每臺(tái)虛擬機(jī)VNC端口必須不一致
LINUX 操作系統(tǒng):
qemu-img create -f qcow2 test02.img 7G
virt-install --name=centos7 --os-variant=rhel6 --ram 512 --vcpus=1 --disk path=/vmdata/images/centos7.img,format=qcow2,size=5,bus=virtio --accelerate --cdrom /vmdata/iso/CentOS-7.0-1406-x86_64-DVD.iso --vnc --vncport=5910 --vnclisten=0.0.0.0 --network bridge=br0,model=virtio --noautoconsole
virsh edit lable
查看VNC 端口,通過(guò)VNC登陸虛擬機(jī),再配置IP
windows操作系統(tǒng):
virt-install --name=w2008 --ram 512 --vcpus=1 --disk path=/vmdata/images/w2008.img,size=8 --accelerate --cdrom /vmdata/iso/w2008.iso --vnc --vncport=5911 --vnclisten=0.0.0.0 --network bridge=br0 --force --autostart
三:克隆虛擬機(jī)
virt-clone -o centos7 -n centos7_sub -f /vmdata/images/centos7_sub.img
說(shuō)明:停機(jī)狀態(tài)下,以centos7 為模板,創(chuàng)建新的centos7_sub 虛擬機(jī),引用新文件為centos7_sub.img
變化項(xiàng)有:
<name> <uuid> <source file <mac address>
通過(guò)配置文件復(fù)制虛擬機(jī)
1.復(fù)制配置文件:virsh dumpxml centos7 > /etc/libvirt/qemu/centos7_sub.xml
2.復(fù)制鏡像文件:cp centos7.img centos7_sub.img &
3.修改name,uuid,disk位置,vnc端口
4.重新定義配置文件
virsh define /etc/libvirt/qemu/centos7_sub.xml
四:跨宿主機(jī)復(fù)制虛擬機(jī)實(shí)例
scp -r /data/ubuntu root@192.168.10.17:/data
scp /etc/libvirt/qemu/ubuntu.xml root@192.168.10.17:/data
cp /data/ubuntu.xml /etc/libvirt/qemu/
1.定義文件
virsh define /etc/libvirt/qemu/ubuntu.xml
2.確認(rèn)文件Img 路徑有效
virsh edit ubuntu
/data/ubuntu/ubuntu.img
3.啟動(dòng)虛擬機(jī)
virsh start ubuntu
4.vnc 訪問(wèn)
vncviewer `virsh vncdisplay id`
五:給虛擬機(jī)增加內(nèi)存
1.關(guān)閉虛擬機(jī)
virsh shutdown tmpl50
2.查看配置
[root@localhost tmpl50]# virsh dominfo tmpl50
Id: -
Name: tmpl50
UUID: edc054f3-b54b-4790-8447-298da5563323
OS Type: hvm
State: shut off
CPU(s): 1
Max memory: 16777216 KiB
Used memory: 16777216 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: none
Security DOI: 0
3.編輯虛擬機(jī)
virsh edit tmpl50
<name>tmpl50</name>
<memory unit='KiB'>16777216</memory> #數(shù)值1
<currentMemory unit='KiB'>16777216</currentMemory> #數(shù)值2
改成8G
8388608
4.重新定義使配置文件生效
[root@localhost tmpl50]# virsh define /etc/libvirt/qemu/tmpl50.xml
Domain tmpl50 defined from /etc/libvirt/qemu/tmpl50.xml
5.啟動(dòng)虛擬機(jī)
virsh start tmpl50
6.登錄檢查
vncviewer `virsh vncdisplay id`
vncviewer `virsh vncdisplay name`
Spire.Office 4.4.0已經(jīng)正式發(fā)布了。該版本添加了許多新功能,例如,Spire.PDF支持查找和高亮跨行的文本,Spire.Presnetation支持對(duì)文本添加動(dòng)畫,Spire.XLS支持設(shè)置文本框的內(nèi)邊距,Spire.Spreadsheet支持自定義語(yǔ)言配置文件的路徑。此外,本次更新還修復(fù)了大量漏洞。
該版本涵蓋了最新版的Spire.Doc、Spire.PDF、Spire.XLS、Spire.Presentation、Spire.DataExport、Spire.Barcode、Spire.DocViewer、Spire.PDFViewer、Spire.OfficeViewer、Spire.Email。
版本信息如下:
新功能:
PdfDocument doc=new PdfDocument(input); PdfTextFind[] result=null; foreach (PdfPageBase page in doc.Pages) { result=page.FindText("This is a test", TextFindParameter.CrossLine).Finds; for (int i=0; i < result.Length; i++) { result[i].ApplyHighLight(Color.Yellow); } } doc.SaveToFile(output);
PdfNewDocument doc=new PdfNewDocument(); PdfPageBase page=doc.Pages.Add(); String pfxPath=inputFile; PdfCertificate cer=new PdfCertificate(pfxPath, password, X509KeyStorageFlags.Exportable); PdfSignature signature=new PdfSignature(doc, page, cer, "s1"); signature.Bounds=new RectangleF(new PointF(100, 100), new SizeF(200, 200)); signature.ConfigureHttpOCSP(null, null); doc.Save(outputFile);
PdfRGBColor color=xxField.BackColor; xxField.BackColor=Color.Yellow;
PdfGridCellContent cellContent=new PdfGridCellContent(); cellContent.ImageLocation=new PointF(20,20);
問(wèn)題修復(fù):
新功能:
Presentation ppt=new Presentation(); ppt.LoadFromFile("test.pptx"); IAutoShape shape=(IAutoShape)ppt.Slides[0].Shapes[0]; AnimationEffect animation=shape.Slide.Timeline.MainSequence.AddEffect(shape, AnimationEffectType.Fly); animation.SetStartEndParagraphs(2, 3); IAutoShape shape2=(IAutoShape)ppt.Slides[0].Shapes[1]; AnimationEffect animation2=shape.Slide.Timeline.MainSequence.AddEffect(shape2, AnimationEffectType.FadedZoom); animation2.SetStartEndParagraphs(0, 0); ppt.SaveToFile("result.pptx", FileFormat.Pptx2010); ppt.Dispose();
Presentation ppt=new Presentation(); ppt.LoadFromFile(inputfile); PresentationPrintDocument document=new PresentationPrintDocument(ppt); //Set print task name document.DocumentName="print task 1"; document.Print0rder=Order.Horizontal; document.SlideFrameForPrint=true; document.GrayLevelForPrint=true; document.SlideCountPerPageForPrint=PageSlideCount.Three; document.PrinterSettings.PrintRange=PrintRange.AllPages; //Set continuous print area document.PrinterSettings.PrintRange=PrintRange.SomePages; document.PrinterSettings.FromPage=1; document.PrinterSettings.ToPage=ppt.Slides.Count - 1; //Set discontinuous print area //document.SelectSldiesForPrint("1", "2-6"); document.PrinterSettings.PrintToFile=true; document.PrinterSettings.PrintFileName=outputfile; ppt.Print(document); ppt.Dispose();
問(wèn)題修復(fù):
新功能:
Paragraph.Format.AutoSpaceDN;
Paragraph.Format.AutoSpaceDE;
問(wèn)題修復(fù):
新功能:
TextBoxShapeBase texbox=workbook.Worksheets[0].TextBoxes[0] as TextBoxShapeBase; texbox.InnerLeftMargin=1; texbox.InnerRightMargin=3; texbox.InnerTopMargin=1; texbox.InnerBottomMargin=3;
問(wèn)題修復(fù):
新功能:
spreadsheet.MenuLanguageConfigPath="D:/SpreadsheetTest/MenuLanguageConfig.xml";
問(wèn)題修復(fù):
點(diǎn)擊“了解更多”下載產(chǎn)品最新試用版
↓↓↓