分类 默认分类 下的文章

第一步,创建虚拟机。

第二步,登陆 SHELL,具体登陆方法自己探索。

使用 WinSCP 之类的软件把 img2kvm 和 IMG 镜像上传到 ROOT 目录,当然也可以使用 wget 命令下载到 PVE 宿主机。

img2kvm 下载地址:img2kvm.zip

  • 注:第二种方法无需 img2kvm。

第三步:IMG 转换

第一种:

chmod +x img2kvm
 ./img2kvm LEDE.img 101 vm-101-disk-1 local-lvm

上面2个101是虚拟机的VM ID, LEDE.img是需要引导的img文件,local-lvm是你的存储ID

第二种:

qemu-img convert -f raw -O qcow2 <firmware_name> <output_diskname>
#例子:qemu-img convert -f raw -O qcow2  LEDE.img vm-101-disk-1.qcow2
qm importdisk <vmid> <source> <storage>
#例子:qm importdisk 101 vm-101-disk-1.qcow2 local-lvm

第四步:登陆管理页面,加载磁盘

打开刚才创建的虚拟机的硬件,会看到有个未使用的磁盘,双击打开,点确认即可。

1.png

对应编辑一下引导顺序。
2.png
转自:https://vzone.me/913/

查看CPU支持的模式

[root@lxtxtech ~]# tuned-adm list
Available profiles:
- accelerator-performance     - Throughput performance based tuning with disabled higher latency STOP states
- balanced                    - General non-specialized tuned profile
- desktop                     - Optimize for the desktop use-case
- hpc-compute                 - Optimize for HPC compute workloads
- intel-sst                   - Configure for Intel Speed Select Base Frequency
- latency-performance         - Optimize for deterministic performance at the cost of increased power consumption
- network-latency             - Optimize for deterministic performance at the cost of increased power consumption, focused on low latency network performance
- network-throughput          - Optimize for streaming network throughput, generally only necessary on older CPUs or 40G+ networks
- powersave                   - Optimize for low power consumption
- throughput-performance      - Broadly applicable tuning that provides excellent performance across a variety of common server workloads
- virtual-guest               - Optimize for running inside a virtual guest
- virtual-host                - Optimize for running KVM guests
Current active profile: throughput-performance
[root@lxtxtech ~]#

设置高性能模式

[root@lxtxtech ~]# tuned-adm profile throughput-performance
[root@lxtxtech ~]#

设置省点模式

[root@lxtxtech ~]# tuned-adm profile server-powersave
[root@lxtxtech ~]#

查看当前模式

[root@lxtxtech ~]# tuned-adm active
Current active profile: throughput-performance
[root@lxtxtech ~]#

安装了PVE,会发现系统默认把空间分成了Local、Local-LVM两部分,这样的话对于像三角云、星际蜗牛这样的矿渣来说安装好了控件不是特别够,所以需要把两部分控件合并起来,具体操作如下:
1、备份虚拟机(如果是全新安装,则省略这一步)
2、删除虚拟机(如果是全新安装,则省略这一步)
3、删除local-lvm

root@pve:~# lvremove pve/data
Do you really want to remove and DISCARD active logical volume pve/data? [y/n]: y
  Logical volume "data" successfully removed
root@pve:~#

4、扩展Loacal,把删除的Local-LVM控件扩展给Local


root@pve:~# lvextend -l +100%FREE -r pve/root
  Size of logical volume pve/root changed from 96.00 GiB (24576 extents) to <550.23 GiB (140858 extents).
  Logical volume pve/root successfully resized.
resize2fs 1.44.5 (15-Dec-2018)
Filesystem at /dev/mapper/pve-root is mounted on /; on-line resizing required
old_desc_blocks = 12, new_desc_blocks = 69
The filesystem on /dev/mapper/pve-root is now 144238592 (4k) blocks long.

root@pve:~#

5、PVE页面删除Local-LVM储存
QQ截图20200902094808.jpg
6、编辑Local,内容全部打上勾
QQ截图20200902094938.jpg
7、搞定
QQ截图20200902095036.jpg
8、恢复虚拟机(如果是全新安装,则省略这一步)

1、更换PVE国内源

# 删除企业源
rm -rf /etc/apt/sources.list.d/pve-enterprise.list
#下载秘钥
wget http://download.proxmox.com/debian/proxmox-ve-release-6.x.gpg -O /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg
# 添加社区源
echo "deb http://download.proxmox.wiki/debian/pve stretch pve-no-subscription" >/etc/apt/sources.list.d/pve-install-repo.list

2、添加debian国内源

nano /etc/apt/sources.list.d/pve-install-repo.list
#添加以下内容
deb http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb http://mirrors.aliyun.com/debian-security buster/updates main
deb-src http://mirrors.aliyun.com/debian-security buster/updates main
deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib

3、更新pve

apt update&& apt upgrade -y

     在多线程操作界面控件的时候,需要用Invoke 或 BeginInvoke,但是有时候会出现"在创建窗口句柄之前,不能在控件上调用 Invoke 或 BeginInvoke",分析可能的原因是代码执行速度过快,在执行完"InitializeComponent()"之前就执行到了其他代码对界面进行了一些操作导致这个错误,现在发现一个巧妙的解决办法,就是在Invoke 或 BeginInvoke方然之前添加下面代码:

IntPtr i = this.Handle;

     代码就是在执行Invoke 或 BeginInvoke之前先获取句柄,如果获取不到,则下面的代码不会执行,实测可以解决问题!