alpine 开机自启动
rc-update add local
脚本放 /etc/local.d/
xxx.start 启动执行脚本,字母顺序
xxx.stop 关机执行脚本,字母顺序
rc-update add local
脚本放 /etc/local.d/
xxx.start 启动执行脚本,字母顺序
xxx.stop 关机执行脚本,字母顺序
1.启用 rc.local,见上一篇
2.显示文件夹颜色
vi /root/.bashrc ,去掉注释
export LS_OPTIONS='--color=auto'
eval "$(dircolors)"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
3.vi 右键成了visual,不能复制
vi /usr/share/vim/vim82/defaults.vim
在mouse=a的=前面加个-
if has('mouse')
set mouse-=a
endif
4.docker-compose不是最新
apt remove docker-compose --purge
curl -L "https://github.com/docker/compose/releases/download/2.5.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/bin/docker-compose
chmod +x /usr/bin/docker-compose
rc.local是一个令大家耳熟详的文件,它在Redhat系列操作系统中可以让用户添加自定义开机脚本并运行。但是在Debian 11操作系统中,这个功能不被默认开启。这篇文章将介绍如何开启rc.local。话不多说,开始~
先通过以下命令对systemd注入rc-local服务:
cat>>/etc/systemd/system/rc-local.service<<EOF
[Unit]
Description=/etc/rc.local
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
EOF
执行daemon reload和启动服务开机启动
systemctl daemon-reload && systemctl enable rc-local
vi /etc/rc.local
#!/bin/sh -e
<your command>
exit 0
对rc.local赋予权限以执行
chmod a+x /etc/rc.local
到这里,就全部完成了,在下一次重启中,该文件将会被自动调用并执行。
alpine默认用udhcpc,运行 udhcpc6无法发现公网ipv6
apk add dhclient
vi /etc/network/interfaces
iface eth0 inet6 manual
post-up dhclient -6 eth0
1.kvm安装 参见https://sharadchhetri.com/install-kvm-on-ubuntu-20-04-lts-desktop/
sudo apt -y update
sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
sudo adduser `id -un` libvirt
sudo adduser `id -un` kvm
sudo grep `id -un` /etc/group
virsh list --all
sudo apt install virt-manager
2.WebVirtMgr 参见 https://blog.csdn.net/qq_34146694/article/details/84871240
docker run -itd --name virtmgr -p6080:6080 -p8080:8080 --restart=always jieshao/web_kvm:onlyweb
修改网络为桥接
sudo vi /etc/netplan/00-installer-config.yaml
network:
ethernets:
eno5:
dhcp4: no
dhcp6: no
eno6:
dhcp4: no
dhcp6: no
eno7:
dhcp4: no
dhcp6: no
eno8:
dhcp4: no
dhcp6: no
version: 2
bridges:
br0:
interfaces:
- eno5
- eno6
- eno7
- eno8
addresses:
- 192.168.1.140/24
optional: true
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses:
- 233.5.5.5
- 114.114.114.114
dhcp4: no
dhcp6: yes
打开主机防火墙
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo vi /etc/libvirt/libvirtd.conf
listen_tls = 0
listen_tcp = 1
auth_tcp = "none"
sudo vi /etc/default/libvirtd
LIBVIRTD_ARGS="-l -d"
start_libvirtd=yes
重启 sudo service libvirtd restart ,可能会报错,不用管它。 netstat -an|grep 16509 端口起来就行。
sudo systemctl enable docker
sudo systemctl enable libvirtd
修改webVirMgr密码
sudo docker exec virtmgr bash
/webvirmgr/manage.py changepassword admin
登录后
add connection 172.17.0.1,用户名密码暂时没什么用,随便设
添加存储池
Create Custom Instance
修改xml
网络:
<interface type='bridge'>
<mac address='52:54:00:4b:73:d6'/>
<source bridge='br0'/>
<target dev='vnet0'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
差异磁盘:
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='子盘路径.img' index='2'/>
<backingStore type='file' index='3'>
<format type='qcow2'/>
<source file='父盘路径.img'/>
<backingStore/>
</backingStore>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
双光驱
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source/>
<backingStore/>
<target dev='hda' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='1' target='0' unit='1'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source/>
<backingStore/>
<target dev='hdb' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>
建差分盘用命令
sudo qemu-img create -f qcow2 -F qcow2 -o backing_file=父盘路径.img,size=60G 子盘路径.img