首页
归档
时光轴
推荐
Cloud
图床
导航
Search
1
Deploy OpenStack offline based on Kolla
736 阅读
2
openstact 基础环境安装 (手动版)
686 阅读
3
Mariadb 主从复制&读写分离
642 阅读
4
Typecho 1.2.0 部署
639 阅读
5
FusionCompute8.0 体验
573 阅读
Python
Linux
随笔
mysql
openstack
Search
标签搜索
linux
Pike
python
爬虫
openstack
mysql
Essay
Ansible
docker
Zabbix
kolla
Internet
Redis
1+X
Hyper-V
jenkins
Kickstart
自动化
sh
pxe
Acha
累计撰写
77
篇文章
累计收到
1
条评论
首页
栏目
Python
Linux
随笔
mysql
openstack
页面
归档
时光轴
推荐
Cloud
图床
导航
搜索到
77
篇与
的结果
2024-06-13
ipxe autoinstall debian12.4
ipxe autoinstall debian12.4 配置文件 目录结构 使用镜像源 mount -o loop /root/debian-12.4.0-amd64-DVD-1.iso /var/www/html/debian/ initrd.gz、linux # /var/www/html [root@localhost html]# tree -L 2 . ├── debian ├── ipxe │ ├── boot.ipxe │ ├── initrd.gz │ ├── ipxe.efi │ ├── linux │ └── undionly.kpxe └── preseed.cfg initrd.gz 改动 添加 scsi-modules https://mirrors.tuna.tsinghua.edu.cn/debian/pool/main/l/linux-signed-amd64/scsi-modules-6.1.0-15-amd64-di_6.1.69-1_amd64.udeb 修改 /usr/share/debconf/confmodule # 第四行添加 忽略源gpg报错 [ -f /usr/lib/apt-setup/generators/50mirror ] && \ sed -i 's/trusted=""/trusted="[trusted=yes] "/g' /usr/lib/apt-setup/generators/50mirror boot.ipxe #!ipxe kernel http://192.168.1.11/ipxe/linux vga=788 auto=true priority=critical preseed/url=http://192.168.1.11/preseed.cfg initrd http://192.168.1.11/ipxe/initrd.gz boot preseed.cfg ### 本地化 # 语言 d-i debian-installer/locale string en_US ### 键盘 d-i keyboard-configuration/xkb-keymap select us ### 网络 d-i netcfg/choose_interface select auto d-i netcfg/enable boolean true ### Mirror d-i mirror/country string manual d-i mirror/http/hostname string 192.168.1.11 d-i mirror/http/directory string /debian d-i mirror/http/proxy string ### Account setup d-i passwd/root-login boolean false d-i passwd/user-fullname string user d-i passwd/username string user d-i passwd/user-password password 123 d-i passwd/user-password-again password 123 ### 时区 d-i clock-setup/utc boolean true d-i time/zone string Asia/Shanghai d-i clock-setup/ntp boolean true ### 分区 d-i partman-auto/disk string /dev/sda d-i partman-auto/method string regular d-i partman-lvm/device_remove_lvm boolean true d-i partman-md/device_remove_md boolean true d-i partman-auto/choose_recipe select atomic d-i partman-partitioning/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true ### Apt setup d-i apt-setup/non-free boolean false d-i apt-setup/contrib boolean false d-i apt-setup/services-select multiselect main d-i debian-installer/allow_unauthenticated boolean true ### Package selection tasksel tasksel/first multiselect standard cinnamon-desktop # 选择桌面环境 d-i pkgsel/upgrade select none d-i pkgsel/language-packs multiselect en, zh d-i pkgsel/update-policy select none # d-i pkgsel/include string nano ### Boot loader installation d-i grub-installer/only_debian boolean true d-i grub-installer/bootdev string default ### Finishing up the installation d-i finish-install/keep-consoles boolean true dnsmasq 安装 yum install -y dnsmasq httpd 配置 dnsmasq.conf [root@localhost html]# grep -Ev '^#|^$' /etc/dnsmasq.conf conf-dir=/etc/dnsmasq.d,.rpmnew,.rpmsave,.rpmorig bind-interfaces dhcp-range=192.168.1.200,192.168.1.250,255.255.255.0,8h dhcp-option=option:router,192.168.1.2 dhcp-option=option:dns-server,223.5.5.5,223.6.6.6 enable-tftp tftp-root=/var/www/html/ipxe dhcp-match=set:bios,option:client-arch,0 dhcp-match=set:ipxe,175 dhcp-boot=tag:!ipxe,tag:bios,undionly.kpxe dhcp-boot=tag:!ipxe,tag:!bios,ipxe.efi dhcp-boot=tag:ipxe,boot.ipxe httpd rm /etc/httpd/conf.d/welcome.conf 添加配置文件 1. 上传 ipxe-debian12.4.tar.xz 2. 解压 tar xf ipxe-debian12.4.tar.xz -C /var/www/html 3. 修改 ip [root@localhost html]# grep -r 192.168.1.11 . ./ipxe/boot.ipxe:kernel http://192.168.1.11/ipxe/linux vga=788 auto=true priority=critical preseed/url=http://192.168.1.11/preseed.cfg ./ipxe/boot.ipxe:initrd http://192.168.1.11/ipxe/initrd.gz ./preseed.cfg:d-i mirror/http/hostname string 192.168.1.11 启动 systemctl start httpd systemctl start dnsmasq
2024年06月13日
167 阅读
0 评论
0 点赞
2023-09-25
PNET 裸机安装
PNET 镜像: Ubuntu18.04 部署步骤 sudo su root cd /etc/apt cp sources.list sources.list.bak vi sources.list apt-get update apt-get install pnetlab -y # 安装完后 reboot mirrors -- tuna # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse deb [trusted=yes] http://repo.pnetlab.com ./ 异常处理 # 报错: The following packages have unmet dependencies: pnetlab : Conflicts: netplan. io but 0.99-0ubuntu3~18.04.4 is to be installed E: Unable to correct problems, you have held broken packages. # 解决 apt-get install netplan # 安装异常中断 # 解决 apt-get update apt-get install pnetlab -y 升级内核 root@pnetlab:~# dpkg -i linux-image-5.17.8-eve-ng-uksm-wg+_1_amd64.deb root@pnetlab:~# grep menuentry /boot/grub/grub.cfg root@pnetlab:~# vim /etc/default/grub GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 5.17.8-eve-ng-uksm-wg+" root@pnetlab:~# update-grub 获取镜像 wget https://i-share.top/repo/pool/ishare-agent.deb dpkg -i https://i-share.top/repo/pool/ishare-agent.deb ishare search [Name] ishare pull [Name]
2023年09月25日
417 阅读
0 评论
0 点赞
2023-09-25
python 调用 OpenStack API
OpenStack API 状态码 代码 原因 400 - Bad Request 请求中的某些内容无效。 401 - Unauthorized 用户必须在提出请求之前进行身份验证。 403 - Forbidden 策略不允许当前用户执行此操作。 404 - Not Found 找不到请求的资源。 405 - Method Not Allowed 方法对此端点无效。 413 - Request Entity Too Large 请求大于服务器愿意或能够处理的。 503 - Service Unavailable 服务不可用。这主要是由于服务配置错误导致服务无法成功启动。 Token def get_token(): url = "http://192.168.200.37:35357/v3/auth/tokens" body = { "auth": { "identity": { "methods": ["password"], "password": { "user": { "id": "2b70e2e3e794433a912c15edafa8c5f1", "password": "000000" } } }, "scope": { "project": { "id": "c3694df0e8b748baafcb68b0a92f8b0d" } } } } result = requests.post(url, data=json.dumps(body)).headers['X-Subject-Token'] # print(result) return result User import json import requests url = "http://192.168.100.10:5000/v3/users" body = { "user": { "domain_id": "b64e5c08e1944b5fa6a8725240490aa7", "name": "API-test-user", "description": "API CREATER USER" } } result = requests.post(url, headers={"X-Auth-Token": get_token()}, data=json.dumps(body)).json() # print(result) print("user") Image import json import requests from rc import RC def jprint(data): print(json.dumps(data, indent=2, sort_keys=True)) def get_images(): url = "http://178.120.2.100:9292/v2.1/images" r1 = requests.get(url, headers={"X-Auth-Token": get_token()}).json() jprint(r1) def create_image(): url = "http://178.120.2.100:9292/v2.1/images" body = { "container_format": "bare", "disk_format": "qcow2", "name": "api-image", } r1 = requests.post(url, headers={"X-Auth-Token": get_token()}, data=json.dumps(body)).json() jprint(r1) return r1['id'] def upload_images(): id = create_image() url = "http://178.120.2.100:9292/v2.1/images/" + id + "/file" path_file = "./cirros-0.3.4-x86_64-disk.img" data = open(path_file, 'rb') headers = {"X-Auth-Token": get_token(), 'Content-Type': 'application/octet-stream'} result = requests.put(url, headers=headers, data=data).status_code print(result) upload_images() flavor import json import requests def create_flavor(): url = "http://178.120.2.100:8774/v2.1/flavors" body = { "flavor": { "id": "8848", "name": "api_flavor", "disk": "20", "ram": "1024", "vcpus": "1", } } # r1 = requests.get(url, headers={"X-Auth-Token": get_token()}).json() r1 = requests.post(url, headers={"X-Auth-Token": get_token()}, data=json.dumps(body)).json() print(r1) Network import json import requests def jprint(data): print(json.dumps(data, indent=2, sort_keys=True)) def create_net(): url = "http://192.168.200.37:9696/v2.0/networks" # r1 = requests.get(url, headers={"X-Auth-Token": get_token()}).json() body = { "network": { "name": "api-net", } } r1 = requests.post(url, headers={"X-Auth-Token": get_token()}, data=json.dumps(body)).json() # jprint(r1['network']['id']) jprint(r1) return r1['network']['id'] # net_id = r1['network']['id'] def create_sub(): net_id = create_net() url = "http://192.168.200.37:9696/v2.0/subnets" body = { "subnet": { "name": "api-sub2", "cidr": "172.16.1.0/24", "gateway_ip": "172.16.1.1", "network_id": net_id, "ip_version": 4, } } r1 = requests.post(url, headers={"X-Auth-Token": get_token()}, data=json.dumps(body)).json() jprint(r1) get_token() VM import json import requests def jprint(data): print(json.dumps(data, indent=2, sort_keys=True)) url = "http://192.168.200.37:8774/v2.1/servers" body = { "server": { "imageRef": "97d6642f-4cf5-43b6-b505-645b1313fb6e", "flavorRef": "8848", "networks": [{"uuid": "e01e0ce3-4ef2-4b9e-b9e5-74726f351051"}], "name": "api-vm" } } r1 = requests.post(url, headers={"X-Auth-Token": get_token()}, data=json.dumps(body)).json() jprint(r1)
2023年09月25日
454 阅读
0 评论
0 点赞
2023-09-25
gitbook 制作文档
gitbook 制作文档 1、安装 [root@gitbook date]# history curl -O http://file.youto.club/Script/init.sh sh init.sh gitbook wget https://registry.npmmirror.com/-/binary/node/v10.23.0/node-v10.23.0-linux-x64.tar.xz tar xf node-v10.23.0-linux-x64.tar.xz -C /usr/local/ ln -s node-v10.23.0-linux-x64 node vim /etc/profile source /etc/profile node -v npm -v npm config set registry https://registry.npm.taobao.org npm config get registry npm install -g gitbook-cli mkdir /date cd /date/ gitbook init gitbook build gitbook serve 2、检查 node 版本 [root@gitbook local]# node -v v10.23.0 [root@gitbook local]# npm -v 6.14.8 3、测试 [root@gitbook date]# ls README.md SUMMARY.md [root@gitbook date]# cat SUMMARY.md # Summary * [Introduction](README.md) [root@gitbook date]# cat README.md # Introduction [root@gitbook date]# gitbook build info: 7 plugins are installed info: 6 explicitly listed info: loading plugin "highlight"... OK info: loading plugin "search"... OK info: loading plugin "lunr"... OK info: loading plugin "sharing"... OK info: loading plugin "fontsettings"... OK info: loading plugin "theme-default"... OK info: found 1 pages info: found 0 asset files info: >> generation finished with success in 0.3s ! [root@gitbook date]# gitbook serve Live reload server started on port: 35729 Press CTRL+C to quit ... info: 7 plugins are installed info: loading plugin "livereload"... OK info: loading plugin "highlight"... OK info: loading plugin "search"... OK info: loading plugin "lunr"... OK info: loading plugin "sharing"... OK info: loading plugin "fontsettings"... OK info: loading plugin "theme-default"... OK info: found 1 pages info: found 0 asset files info: >> generation finished with success in 0.3s ! Starting server ... Serving book on http://localhost:4000 4、美化 & 安装插件 [root@gitbook date]# cat book.json { "title": "Acha Note Book", "description": "histry", "author": "Acha <wz.0527@qq.com>", "lang": "zh-hans", "plugins": [ "-search","-sharing","fontsettings","expandable-chapters","chapter-fold","code","lightbox","anchor-navigation-ex","local-video" ], "pluginsConfig": { "anchor-navigation-ex": { "showLevel": false, "showGoTop": false } } } npm i gitbook-plugin-expandable-chapters npm i gitbook-plugin-chapter-fold npm i gitbook-plugin-code npm i gitbook-plugin-lightbox npm i gitbook-plugin-anchor-navigation-ex npm i gitbook-plugin-local-video 5、目录结构 [root@gitbook date]# cat SUMMARY.md # Summary * [简介](README.md) * [杂谈](杂谈/README.md) * [docker for windows](杂谈/docker for windows.md) * [Hyper-V](杂谈/Hyper-V.md) * [Windows Server 2022 使用](杂谈/Windows Server 2022 使用.md)
2023年09月25日
265 阅读
0 评论
0 点赞
2023-09-25
python 代码打包 exe
python 代码打包 exe 1、虚拟环境 1、准备存放文件夹 D:\python_env\ 2、创建虚拟环境 python -m venv <环境名称> 3、激活虚拟环境 D:\python_env\<环境名称>\Scripts\activate 4、退出虚拟环境 deactivate 2、打包 1、安装打包模块 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyinstaller 2、打包 Pyinstaller -F -w -i apple.ico py_word.py
2023年09月25日
247 阅读
0 评论
0 点赞
1
2
...
16