系统盘:
https://mirror.lzu.edu.cn/debian-cd/12.9.0/amd64/iso-dvd/debian-12.9.0-amd64-DVD-1.iso
需要的依赖包,无需安装ruby( sudo apt install -y ruby-full ruby-dev rubygems ) :
apt install -y iptabes;
apt install -y curl;
root@debian129:~# dpkg -l iptables
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================================
ii iptables 1.8.9-2 amd64 administration tools for packet filtering and NAT
root@debian129:~#
root@debian129:~# dpkg -l curl
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-==================-============-=======================================================
ii curl 7.88.1-10+deb12u12 amd64 command line tool for transferring data with URL syntax
root@debian129:~#
apt install --print-uris -y libvirt-daemon-system libvirt-clients qemu-kvm libvirt-dev virtinst | tee ~/bbb.log;
grep -oE "'https?://[^ ]+" /root/bbb.log > /download_urls_filtered_virt.txt
cd /tmp&&(
cat /download_urls_filtered_virt.txt | xargs -I {} sh -c 'wget -4 --no-check-certificate {} && echo 0.1'
)
dpkg -i *.deb;
wget https://releases.hashicorp.com/vagrant/2.4.5/vagrant_2.4.5-1_amd64.deb&&dpkg -i vagrant_2.4.5-1_amd64.deb;
apt install --print-uris -y build-essential patch zlib1g-dev liblzma-dev libxml2-dev libxslt-dev | tee ~/bbb2.log;
grep -oE "'https?://[^ ]+" /root/bbb2.log > /download_urls_filtered_build-essential.txt
cd /tmp&&(
ls -la;
cat /download_urls_filtered_build-essential.txt | xargs -I {} sh -c 'wget -4 --no-check-certificate {} && echo 0.1'
)
dpkg -i *.deb;
apt install --print-uris -y clang | tee ~/bbb3.log;
grep -oE "'https?://[^ ]+" /root/bbb3.log > /download_urls_filtered_clang.txt
cd /tmp&&(
ls -la;
cat /download_urls_filtered_clang.txt | xargs -I {} sh -c 'wget -4 --no-check-certificate {} && echo 0.1'
)
dpkg -i *.deb;
root@debian129:~# dpkg -l build-essential patch zlib1g-dev liblzma-dev libxml2-dev libxslt-dev iptables curl clang gcc make ruby libvirt-daemon-system libvirt-clients qemu-kvm libvirt-dev virtinst vagrant
dpkg-query: no packages found matching ruby
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=====================-=======================-============-=========================================================================
ii build-essential 12.9 amd64 Informational list of build-essential packages
ii clang 1:14.0-55.7~deb12u1 amd64 C, C++ and Objective-C compiler (LLVM based), clang binary
ii curl 7.88.1-10+deb12u12 amd64 command line tool for transferring data with URL syntax
ii gcc 4:12.2.0-3 amd64 GNU C compiler
ii iptables 1.8.9-2 amd64 administration tools for packet filtering and NAT
ii liblzma-dev:amd64 5.4.1-1 amd64 XZ-format compression library - development files
ii libvirt-clients 9.0.0-4+deb12u2 amd64 Programs for the libvirt library
ii libvirt-daemon-system 9.0.0-4+deb12u2 amd64 Libvirt daemon configuration files
ii libvirt-dev:amd64 9.0.0-4+deb12u2 amd64 development files for the libvirt library
ii libxml2-dev:amd64 2.9.14+dfsg-1.3~deb12u1 amd64 GNOME XML library - development files
un libxslt-dev <none> <none> (no description available)
ii make 4.3-4.1 amd64 utility for directing compilation
ii patch 2.7.6-7 amd64 Apply a diff file to an original
un qemu-kvm <none> <none> (no description available)
ii vagrant 2.4.5-1 amd64 Vagrant is a tool for building and distributing development environments.
ii virtinst 1:4.1.0-2 all utilities to create and edit virtual machines
ii zlib1g-dev:amd64 1:1.2.13.dfsg-1 amd64 compression library - development
root@debian129:~#
root@xx:~# curl -4kLO https://rubygems.org/gems/vagrant-libvirt-0.12.2.gem
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 133k 100 133k 0 0 1861k 0 --:--:-- --:--:-- --:--:-- 1873k
root@xx:~# ls -al *.gem
-rw-r--r-- 1 root root 136192 Jun 1 14:48 vagrant-libvirt-0.12.2.gem
root@xx:~# md5sum vagrant-libvirt-0.12.2.gem
62114243fcced1be21349735aaa0c791 vagrant-libvirt-0.12.2.gem
root@xx:~#
mkdir -p /root/ppp;
cd /root/ppp;
export PATH="/opt/vagrant/embedded/bin:$PATH" ;
export http_proxy="http://192.168.111.1:12334" ;
export https_proxy=$http_proxy ;
gem fetch --verbose vagrant-libvirt;
root@debian129:~/ppp# gem fetch --verbose vagrant-libvirt
Fetching vagrant-libvirt-0.12.2.gem
Downloaded vagrant-libvirt-0.12.2
root@debian129:~/ppp# ls -al
total 152
drwxr-xr-x 2 root root 4096 Jun 1 22:56 .
drwx------ 16 root root 12288 Jun 1 22:55 ..
-rw-r--r-- 1 root root 136192 Jun 1 22:56 vagrant-libvirt-0.12.2.gem
root@debian129:~/ppp#
gem install --verbose ./vagrant-libvirt-0.12.2.gem 2>&1 | tee -a ~/vvruby.log ;
#联网下载,国内需要走http代理
grep -oE "https?://[^ ]+" /root/vvruby.log | grep -E "\.gem" | grep -v -E "\.rz" | awk '{printf "%02d-%s\n", NR, $0}' > /root/urls_with_numbers.txt
root@debian129:~/ppp# cat ~/urls_with_numbers.txt
01-https://index.rubygems.org/gems/nokogiri-1.18.8-x86_64-linux-gnu.gem
02-https://index.rubygems.org/gems/diffy-3.4.3.gem
03-https://index.rubygems.org/gems/xml-simple-1.1.9.gem
04-https://index.rubygems.org/gems/mime-types-data-3.2025.0527.gem
05-https://index.rubygems.org/gems/mime-types-3.7.0.gem
06-https://index.rubygems.org/gems/formatador-1.1.0.gem
07-https://index.rubygems.org/gems/excon-1.2.7.gem
08-https://index.rubygems.org/gems/builder-3.3.0.gem
09-https://index.rubygems.org/gems/fog-core-2.6.0.gem
10-https://index.rubygems.org/gems/ruby-libvirt-0.8.4.gem
11-https://index.rubygems.org/gems/fog-xml-0.1.5.gem
12-https://index.rubygems.org/gems/multi_json-1.15.0.gem
13-https://index.rubygems.org/gems/fog-json-1.2.0.gem
14-https://index.rubygems.org/gems/fog-libvirt-0.13.2.gem
root@debian129:~/ppp#
while IFS= read -r line; do
number=$(echo "$line" | cut -d'-' -f1)
url=$(echo "$line" | cut -d'-' -f2-)
filename="$number-$(basename "$url")"
wget -O "/root/ppp/$filename" "$url"
done < /root/urls_with_numbers.txt
cd /opt/vagrant/embedded/lib/ruby/gems/3.3.0/cache/;ls -al ;
cp ./racc-1.7.3.gem /root/ppp/ ;
ls -al -ltr --time-style=full-iso /opt/vagrant/embedded/gems/cache/;
gem list | grep libvirt;
gem generate_index --verbose ;
root@debian129:~/ppp# gem list | grep libvirt;
fog-libvirt (0.13.2)
ruby-libvirt (0.8.4)
vagrant-libvirt (0.12.2)
root@debian129:~/ppp#
root@debian129:~/ppp# gem generate_index --verbose ;
Fetching rubygems-generate_index-1.1.3.gem
Fetching compact_index-0.15.0.gem
Generating Marshal quick index gemspecs for 0 gems
Complete
Generated Marshal quick index gemspecs: 0.000s
Generating specs index
Generated specs index: 0.000s
Generating latest specs index
Generated latest specs index: 0.000s
Generating prerelease specs index
Generated prerelease specs index: 0.000s
Generating compact index files for 0 gems
1/2: /names
2/2: /versions
Complete
Generated compact index files: 0.000s
Compressing indices
Compressed indices: 0.000s
Moving index into production dir .
mkdir -p ./quick
rm -rf ./quick/Marshal.4.8
mv -f /tmp/gem_generate_index20250601-1555-6y67ma/quick/Marshal.4.8 ./quick/Marshal.4.8
rm -rf ./specs.4.8
mv -f /tmp/gem_generate_index20250601-1555-6y67ma/specs.4.8 .
rm -rf ./specs.4.8.gz
mv -f /tmp/gem_generate_index20250601-1555-6y67ma/specs.4.8.gz .
rm -rf ./latest_specs.4.8
mv -f /tmp/gem_generate_index20250601-1555-6y67ma/latest_specs.4.8 .
rm -rf ./latest_specs.4.8.gz
mv -f /tmp/gem_generate_index20250601-1555-6y67ma/latest_specs.4.8.gz .
rm -rf ./prerelease_specs.4.8
mv -f /tmp/gem_generate_index20250601-1555-6y67ma/prerelease_specs.4.8 .
rm -rf ./prerelease_specs.4.8.gz
mv -f /tmp/gem_generate_index20250601-1555-6y67ma/prerelease_specs.4.8.gz .
rm -rf ./info
mv -f /tmp/gem_generate_index20250601-1555-6y67ma/info .
rm -rf ./names
mv -f /tmp/gem_generate_index20250601-1555-6y67ma/names .
rm -rf ./versions
mv -f /tmp/gem_generate_index20250601-1555-6y67ma/versions .
root@debian129:~/ppp#
tar -czf /root/gem.tar.gz .
root@debian129:~# tar -tvf /root/gem.tar.gz
drwxr-xr-x root/root 0 2025-06-01 21:10 ./
drwxr-xr-x root/root 0 2025-06-01 21:10 ./info/
-rw-r--r-- root/root 102912 2025-06-01 20:49 ./10-ruby-libvirt-0.8.4.gem
-rw-r--r-- root/root 12288 2025-06-01 20:49 ./05-xml-simple-1.1.9.gem
-rw-r--r-- root/root 168960 2025-06-01 20:49 ./01-mime-types-data-3.2025.0527.gem
-rw-r--r-- root/root 24 2025-06-01 21:10 ./prerelease_specs.4.8.gz
-rw-r--r-- root/root 171008 2025-06-01 20:49 ./07-excon-1.2.7.gem
-rw-r--r-- root/root 17920 2025-06-01 20:49 ./04-diffy-3.4.3.gem
-rw-r--r-- root/root 13824 2025-06-01 20:49 ./06-formatador-1.1.0.gem
-rw-r--r-- root/root 5 2025-06-01 21:10 ./names
-rw-r--r-- root/root 24 2025-06-01 21:10 ./latest_specs.4.8.gz
-rw-r--r-- root/root 11264 2025-06-01 20:49 ./11-fog-xml-0.1.5.gem
-rw-r--r-- root/root 4 2025-06-01 21:10 ./prerelease_specs.4.8
-rw-r--r-- root/root 42 2025-06-01 21:10 ./versions
-rw-r--r-- root/root 4 2025-06-01 21:10 ./specs.4.8
-rw-r--r-- root/root 31744 2025-06-01 20:49 ./14-fog-libvirt-0.13.2.gem
-rw-r--r-- root/root 8704 2025-06-01 20:49 ./13-fog-json-1.2.0.gem
-rw-r--r-- root/root 24 2025-06-01 21:10 ./specs.4.8.gz
-rw-r--r-- root/root 30208 2025-06-01 20:49 ./08-builder-3.3.0.gem
-rw-r--r-- root/root 22016 2025-06-01 20:49 ./12-multi_json-1.15.0.gem
-rw-r--r-- root/root 41984 2025-06-01 20:49 ./02-mime-types-3.7.0.gem
-rw-r--r-- root/root 4073472 2025-06-01 20:49 ./03-nokogiri-1.18.8-x86_64-linux-gnu.gem
-rw-r--r-- root/root 64000 2025-06-01 21:10 ./racc-1.7.3.gem
drwxr-xr-x root/root 0 2025-06-01 21:10 ./quick/
drwxr-xr-x root/root 0 2025-06-01 21:10 ./quick/Marshal.4.8/
-rw-r--r-- root/root 47104 2025-06-01 20:49 ./09-fog-core-2.6.0.gem
-rw-r--r-- root/root 4 2025-06-01 21:10 ./latest_specs.4.8
-rw-r--r-- root/root 136192 2025-06-01 20:49 ./vagrant-libvirt-0.12.2.gem
-rw-r--r-- root/root 136192 2025-06-01 20:49 ./15-vagrant-libvirt-0.12.2.gem
root@debian129:~#
root@debian129:~# ls -al -ltr --time-style=full-iso /opt/vagrant/embedded/lib/ruby/gems/3.3.0/cache
total 6768
-rw-r--r-- 1 root root 75264 2025-04-09 17:23:04.000000000 +0800 typeprof-0.21.9.gem
-rw-r--r-- 1 root root 94208 2025-04-09 17:23:04.000000000 +0800 test-unit-3.6.1.gem
-rw-r--r-- 1 root root 53248 2025-04-09 17:23:04.000000000 +0800 rss-0.3.1.gem
-rw-r--r-- 1 root root 104448 2025-04-09 17:23:04.000000000 +0800 rexml-3.3.9.gem
-rw-r--r-- 1 root root 1043968 2025-04-09 17:23:04.000000000 +0800 rbs-3.4.0.gem
-rw-r--r-- 1 root root 84992 2025-04-09 17:23:04.000000000 +0800 rake-13.1.0.gem
-rw-r--r-- 1 root root 64000 2025-04-09 17:23:04.000000000 +0800 racc-1.7.3.gem
-rw-r--r-- 1 root root 11264 2025-04-09 17:23:04.000000000 +0800 prime-0.1.2.gem
-rw-r--r-- 1 root root 15360 2025-04-09 17:23:04.000000000 +0800 power_assert-2.0.3.gem
-rw-r--r-- 1 root root 17408 2025-04-09 17:23:04.000000000 +0800 net-smtp-0.5.1.gem
-rw-r--r-- 1 root root 14336 2025-04-09 17:23:04.000000000 +0800 net-pop-0.1.2.gem
-rw-r--r-- 1 root root 155136 2025-04-09 17:23:04.000000000 +0800 net-imap-0.4.19.gem
-rw-r--r-- 1 root root 17920 2025-04-09 17:23:04.000000000 +0800 net-ftp-0.3.4.gem
-rw-r--r-- 1 root root 95744 2025-04-09 17:23:04.000000000 +0800 minitest-5.20.0.gem
-rw-r--r-- 1 root root 27136 2025-04-09 17:23:04.000000000 +0800 matrix-0.4.2.gem
-rw-r--r-- 1 root root 99328 2025-04-09 17:23:04.000000000 +0800 debug-1.9.2.gem
drwxr-xr-x 9 root root 4096 2025-05-31 23:16:31.900803083 +0800 ..
-rw-r--r-- 1 root root 168960 2025-05-31 23:24:33.768609905 +0800 mime-types-data-3.2025.0527.gem
-rw-r--r-- 1 root root 41984 2025-05-31 23:24:34.820743161 +0800 mime-types-3.7.0.gem
-rw-r--r-- 1 root root 4073472 2025-05-31 23:24:37.865130974 +0800 nokogiri-1.18.8-x86_64-linux-gnu.gem
-rw-r--r-- 1 root root 17920 2025-05-31 23:24:38.381197052 +0800 diffy-3.4.3.gem
-rw-r--r-- 1 root root 12288 2025-05-31 23:24:38.957270868 +0800 xml-simple-1.1.9.gem
-rw-r--r-- 1 root root 13824 2025-05-31 23:24:39.417329960 +0800 formatador-1.1.0.gem
-rw-r--r-- 1 root root 171008 2025-05-31 23:24:40.273440033 +0800 excon-1.2.7.gem
-rw-r--r-- 1 root root 30208 2025-05-31 23:24:41.101546728 +0800 builder-3.3.0.gem
-rw-r--r-- 1 root root 47104 2025-05-31 23:24:43.941914419 +0800 fog-core-2.6.0.gem
-rw-r--r-- 1 root root 102912 2025-05-31 23:24:44.585998178 +0800 ruby-libvirt-0.8.4.gem
-rw-r--r-- 1 root root 11264 2025-05-31 23:24:44.826029400 +0800 fog-xml-0.1.5.gem
-rw-r--r-- 1 root root 22016 2025-05-31 23:24:45.406104976 +0800 multi_json-1.15.0.gem
-rw-r--r-- 1 root root 8704 2025-05-31 23:24:45.630134186 +0800 fog-json-1.2.0.gem
-rw-r--r-- 1 root root 31744 2025-05-31 23:24:45.950175913 +0800 fog-libvirt-0.13.2.gem
-rw-r--r-- 1 root root 136192 2025-05-31 23:24:52.223000364 +0800 vagrant-libvirt-0.12.2.gem
drwxr-xr-x 2 root root 4096 2025-05-31 23:24:52.223000364 +0800 .
root@debian129:~#
tar -xf gem.tar.gz -C /root/
CHECKPOINT_DISABLE=1 vagrant plugin install --debug vagrant-libvirt --plugin-clean-sources --plugin-source file:///root/
CHECKPOINT_DISABLE=1 vagrant plugin list --debug
root@debian129:~# cat ~/.vagrant.d/plugins.json
{"version":"1","installed":{"vagrant-libvirt":{"ruby_version":"3.3.8","vagrant_version":"2.4.5","gem_version":"","require":"","sources":["file:///root/"],"installed_gem_version":"0.12.2","env_local":false}}}root@debian129:~#
root@debian129:~# sudo systemctl status libvirtd
* libvirtd.service - Virtualization daemon
Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; preset: enabled)
Active: inactive (dead) since Sun 2025-06-01 21:22:13 CST; 1h 3min ago
Duration: 2min 104ms
TriggeredBy: * libvirtd-ro.socket
* libvirtd-admin.socket
* libvirtd.socket
Docs: man:libvirtd(8)
https://libvirt.org
Main PID: 2570 (code=exited, status=0/SUCCESS)
CPU: 182ms
Jun 01 21:20:13 debian129 systemd[1]: Starting libvirtd.service - Virtualization daemon...
Jun 01 21:20:13 debian129 systemd[1]: Started libvirtd.service - Virtualization daemon.
Jun 01 21:20:13 debian129 libvirtd[2570]: libvirt version: 9.0.0, package: 9.0.0-4+deb12u2 (Debian)
Jun 01 21:20:13 debian129 libvirtd[2570]: hostname: debian129
Jun 01 21:20:13 debian129 libvirtd[2570]: <E6><97><A0><E6><B3><95><E6><89><93><E5><BC><80> tty /dev/kvm: <E6><B2><A1><E6><9C><89><E9><82><A3><E4><B8><AA><E6><96><87><E4><BB><B6><E6><88><96><E7><E5><BD><95>
Jun 01 21:22:13 debian129 systemd[1]: libvirtd.service: Deactivated successfully.
root@debian129:~#