首页
归档
时光轴
推荐
Cloud
图床
导航
Search
1
openstact 基础环境安装 (手动版)
414 阅读
2
Mariadb 主从复制&读写分离
283 阅读
3
Typecho 1.2.0 部署
272 阅读
4
域名
243 阅读
5
模拟登录古诗文网
234 阅读
Python
Linux
随笔
mysql
openstack
登录
Search
标签搜索
linux
Pike
python
爬虫
openstack
mysql
Essay
Ansible
docker
Zabbix
kolla
Internet
Redis
1+X
Hyper-V
jenkins
Kickstart
自动化
sh
Acha
累计撰写
76
篇文章
累计收到
1
条评论
首页
栏目
Python
Linux
随笔
mysql
openstack
页面
归档
时光轴
推荐
Cloud
图床
导航
搜索到
76
篇与
Acha
的结果
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日
6 阅读
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日
7 阅读
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日
4 阅读
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日
7 阅读
0 评论
0 点赞
2023-09-25
windows 编译 nginx
windows 编译 nginx 参考网址: https://nginx.org/en/docs/howto_build_on_win32.html https://blog.csdn.net/u014552102/article/details/116378786 1、准备编译环境 系统:windows 软件: msys2-x86_64-20230318 vs_BuildTools strawberry-perl-5.32.1.1-64bit sed-4.2.1-setup nginx ... 位置:http://pan.youto.club/s/ryU9 1.先创建windows虚拟机做编译环境 2. 安装编译环境 3. 软件说明 http://hg.nginx.org/nginx 包含 windows编译的代码 https://nginx.org/download/ 只包含 linux 默认编译出来的是 32 位 nginx 依赖 PCRE, zlib and OpenSSL 正则 压缩 加密 4. 开始编译 NGX_MSVC_VER CL 的版本 ”VS 2017 x64_86 交叉工具命令提示符" OK nginx.exe 是编译出来的,我们需要的东西 验证 5. 添加 模块 重复 4 的步骤 fancyindex 默认的主题 看一下其他的 6.配置 7. 更换主题 提示: 安照官网文档先编译一遍,软件版本选择 官网提供的版本 nginx-1.24.0-RELEASE pcre2-10.39.tar.gz zlib-1.2.11.tar.gz openssl-1.1.1m.tar.gz nginx_fancyindex http://pan.youto.club/s/KaHX MD5 的 nginx.zip 哈希: b35e78de2976f8a5a718cda6ef28d213 fancyindex 项目地址:https://github.com/aperezdc/ngx-fancyindex 主题推荐: https://github.com/fraoustin/Nginx-Fancyindex-Theme https://github.com/leshniak/fancyindex-royal-theme https://github.com/TheInsomniac/Nginx-Fancyindex-Theme https://github.com/alehaa/nginx-fancyindex-flat-theme https://github.com/artyuum/Nginx-FancyIndex-Theme https://github.com/lfelipe1501/Nginxy
2023年09月25日
3 阅读
0 评论
0 点赞
1
2
...
16