This commit is contained in:
veypi 2020-12-21 10:40:31 +08:00
parent db7b3a2889
commit ce3e1a284d
21 changed files with 1280 additions and 13 deletions

View File

@ -58,3 +58,15 @@ character_set_connection=utf8
character_set_server=utf8
```
### 指令
```mysql
show databases;
create database dbtest CHARACTER SET utf8 COLLATE utf8_general_ci;
use dbtest;
```

View File

@ -1,14 +1,16 @@
# 部署docker register
# 部署docker registry
```bash
docker run -d --name docker-registry -p 5000:5000 -v /opt/data/registry:/var/lib/registry registry
docker run -d --restart=always --name registry -p 5000:5000 -v /opt/data/registry:/var/lib/registry registry:2
# /etc/docker/daemon.json
"insecure-registries":["lightsdocker:5000"]
"insecure-registries":["docker.local:5000"]
sudo systemctl daemon-reload
sudo systemctl restart docker
curl -XGET http://docker.local:5000/v2/_catalog
```
```bash

View File

@ -0,0 +1,25 @@
# elasticsearch
## goang sdk
```go
// https://github.com/elastic/go-elasticsearch
import (
github.com/elastic/go-elasticsearch/v7
)
es, err := elasticsearch.NewClient(elasticsearch.Config{})
// create document
req := esapi.IndexRequest{
Index: "sample_edge",
Body: bytes.NewReader(body),
}
res, err := req.Do(context.Background(), es)
if err != nil {
return
}
defer res.Body.Close()
```

45
es/es.md Normal file
View File

@ -0,0 +1,45 @@
# elsaticsearch
### 部署
```bash
docker pull elasticsearch:7.9.0
docker run -d -p 9200:9200 -e ES_JAVA_POTS="-Xms256m -Xmx256m" -e "discovery.type=single-node" --name es elasticsearch:7.9.0
docker run -p 9800:9800 -d --link es:demo --name eshd containerize/elastichd
docker logs es
# 有时会出现启动错误, 如
# max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
cat >> /etc/sysctl.conf <<EOF
vm.max_map_count=262144
EOF
# the default discovery settings are unsuitable for production use;
# docker run 添加 -e "discovery.type=single-node" 环境变量
# 检测
curl http://127.0.0.1:9200/
{
"name" : "5d14d3fe4551",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "JTZCqaKTTl-SxOMGypNimQ",
"version" : {
"number" : "7.9.0",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "a479a2a7fce0389512d6a9361301708b92dff667",
"build_date" : "2020-08-11T21:36:48.204330Z",
"build_snapshot" : false,
"lucene_version" : "8.6.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
# 访问 127.0.0.1:9800 如下图所示, 左上角地址改成demo
```
![image-20200827143540543](https://public.veypi.com/img/screenshot/20200827143546.png)

View File

@ -56,4 +56,4 @@ go build
go install
cd ~/go/bin
./hello
```
```

7
linux/cloud-init.md Normal file
View File

@ -0,0 +1,7 @@
# cloud-init
```bash
# 关闭
sudo systemctl disable cloud-init-local cloud-init cloud-config cloud-final
sudo systemctl stop cloud-init-local cloud-init cloud-config cloud-final
```

362
linux/cobbler.md Normal file
View File

@ -0,0 +1,362 @@
# centos7 Cobbler
[TOC]
## 安装
```bash
# cobbler 在epel源中
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum install cobbler xinetd dhcpd
```
## 配置
```bash
# 配置文件 /etc/cobbler/settings
# 自动化部署系统的密码的哈希, 用下行命令生成
# openssl passwd -1
# $1$j9.kasLF$4v5dJWXMDUmxYTXO9qPiG.
# 密文第一项 1 指hash方式 第二项 j9.kasLF 指的salt这样子用以系统判断密码是否正确但是又不存储密码密码和salt都相同时才能计算出唯一的密文
default_password_crypted: "$1$j9.kasLF$4v5dJWXMDUmxYTXO9qPiG."
# 设置cobbler的ip 不要设置0.0.0.0设置一个不隔离广播域的内网ip
server: 192.168.1.2
# 设置的tftp ip用于下载镜像通常与上一个一样
next_server: 192.168.1.2
# 是否开启DHCP0不开启 1开启
# 为了启动 pxe 需要开启dhcp分发地址 并引导系统 到tftp server下载网络启动文件
manage_dhcp: 1
```
```bash
# 配置DHCP /etc/cobbler/dhcp.template
# 不要修改 next-server 项,该配置会自动从上面拉取变量
# 不要修改 #for dhcp_tag in $dhcp_tags.keys(): 这一行之后的内容
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
option domain-name-servers 114.114.114.114,8.8.8.8;
option subnet-mask 255.255.255.0;
filename "/pxelinux.0";
default-lease-time 2.8.0;
max-lease-time 43200;
next-server $next_server;
}
```
```bash
systemctl enable cobbler httpd xinetd
systemctl start cobbler httpd xinetd
# 需要关闭seliux和防火墙
vim /etc/selinux/config
systemctl stop firewalld.service
systemctl disable firewalld.service
reboot
# 检测 会提示一些操作, 根据需要去做
cobbler check
# 返回下面7条
The following are potential configuration items that you may want to fix:
1 : ISC DHCP server (dhcp/dhcpd) is not installed
2 : change 'disable' to 'no' in /etc/xinetd.d/tftp
3 : Some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
4 : enable and start rsyncd.service with systemctl
5 : debmirror package is not installed, it will be required to manage debian deployments and repositories
6 : ksvalidator was not found, install pykickstart
7 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
Restart cobblerd and then run 'cobbler sync' to apply changes.
# 1
yum install dhcp
# 2
# 3
cobbler get-loaders
# 4
systemctl enable rsyncd
systemctl start rsyncd
# 5
yum install debmirror
# 6
yum -y install pykickstart
# 7
yum -y install fence-agents
# 一切正常
cobbler sync
```
## 导入镜像
```bash
# http://mirrors.aliyun.com/centos 下载镜像, 下载minimal版方便测试
mkdir /mnt/centos7
mount -t iso9660 -o loop,ro ~/CentOS-7-x86_64-Minimal-2003.iso /mnt/centos7
# 导入
cobbler import --name=centos7 --path=/mnt/centos7
## profile url http://192.168.10.60/cblr/svc/op/ks/profile/centos7-x86_64
## 访问这个链接可以查看完整版的ks文件 也可以验证ks是否正确
# 检测
cobbler distro list
centos7-x86_64
cobbler profile list
centos7-x86_64
➜ ~ cobbler distro report --name=centos7-x86_64
Name : centos7-x86_64
Architecture : x86_64
TFTP Boot Files : {}
Breed : redhat
Comment :
Fetchable Files : {}
Initrd : /var/www/cobbler/ks_mirror/centos7/images/pxeboot/initrd.img
Kernel : /var/www/cobbler/ks_mirror/centos7/images/pxeboot/vmlinuz
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/centos7-x86_64'}
Management Classes : []
OS Version : rhel7
Owners : ['admin']
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Template Files : {}
➜ ~ cobbler profile report --name=centos7-x86_64
Name : centos7-x86_64
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : centos7-x86_64
Enable gPXE? : 0
Enable PXE Menu? : 1
Fetchable Files : {}
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart : /var/lib/cobbler/kickstarts/sample_end.ks
Kickstart Metadata : {}
Management Classes : []
Management Parameters : <<inherit>>
Name Servers : []
Name Servers Search Path : []
Owners : ['admin']
Parent Profile :
Internal proxy :
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Repos : []
Server Override : <<inherit>>
Template Files : {}
Virt Auto Boot : 1
Virt Bridge : xenbr0
Virt CPUs : 1
Virt Disk Driver Type : raw
Virt File Size(GB) : 5
Virt Path :
Virt RAM (MB) : 512
Virt Type : kvm
```
修改centos用的kickstart文件
```bash
cd /var/lib/cobbler/kickstarts/
cp sample_end.ks centos8.ks
cobbler profile edit --name=centos7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos7.ks# 验证
cobbler profile report --name=centos7-x86_64 | grep kickstart
# 同步
cobbler sync
```
## Centos7.ks
```bash
#platform=x86, AMD64, or Intel EM64T
#os=centos7
# Install OS instead of upgrade
install
# Use text mode install
text
# System keyboard
keyboard us
# System language
lang en_US
# System timezone
timezone Asia/ShangHai
# System authorization information
auth --useshadow --enablemd5
# Root password
rootpw --iscrypted $default_password_crypted
# Firewall configuration
firewall --disabled
# SELinux configuration
selinux --disabled
# Use network installation
url --url=$tree
# Clear the Master Boot Record
zerombr
# System bootloader configuration
# bootloader --location=mbr
# interface can be named as eth*
bootloader --location=mbr --append="net.ifnames=0 biosdevname=0 rhgb quiet"
# Partition clearing information
clearpart --all --initlabel
# Allow anaconda to partition the system as needed
autopart
# or
# # create 1MB biosboot type partition, centos7 and centos8 .
# part biosboot --fstype=biosboot --size=1
# # Disk partitioning information
# part /boot --fstype=xfs --size=300
# part pv.122 --fstype="lvmpv" --grow
# volgroup VolGroup00 --pesize=16384 pv.122
# logvol / --fstype="xfs" --size=10000 --name=LogVol00 --vgname=VolGroup00
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
$yum_repo_stanza
# add repo manually
# repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream
# Network information
$SNIPPET('network_config')
# Do not configure the X Window System
skipx
# Run the Setup Agent on first boot
firstboot --disable
# Reboot after installation
reboot
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end
%packages
$SNIPPET('func_install_if_enabled')
# if you need puppet to install pkgs, just uncomment it
# $SNIPPET('puppet_install_if_enabled')
@core
@base
tree
nmap
wget
telnet
%end
%post --nochroot
$SNIPPET('log_ks_post_nochroot')
%end
%post
$SNIPPET('log_ks_post')
# Start yum configuration
$yum_config_stanza
# End yum configuration
$('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('puppet_register_if_enabled')
$SNIPPET('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('redhat_register')
$SNIPPET('cobbler_register')
# Enable post-install boot notification
$SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps
%end
%post --nochroot
$SNIPPET('log_ks_post_nochroot')
# 关闭这两项可以避免ssh连接设备时卡顿
sed -ri "/^#UseDNS/c\UseDNS no" /etc/ssh/sshd_config
sed -ri "/^GSSAPIAuthentication/c\GSSAPIAuthentication no" /etc/ssh/sshd_config
# 根据ip地址设计host
id=compute_$(ip addr | grep "192" -m 1 | awk -F'[/.]+' '{print $4;}')
hostnamectl set-hostname --static $id
%end
```
## 验证
## 配置 centos7 本地源
```bash
# 添加
cobbler repo add --name=Centos7-Base --mirror=http://mirrors.aliyun.com/centos/7.8.2003/os/x86_64/ --arch=x86_64 --breed=yum
cobbler repo add --name=Centos7-Updates --mirror=http://mirrors.aliyun.com/centos/7.8.2003/updates/x86_64/ --arch=x86_64 --breed=yum
cobbler repo add --name=Centos7-extras --mirror=http://mirrors.aliyun.com/centos/7.8.2003/extras/x86_64/ --arch=x86_64 --breed=yum
cobbler repo add --name=Centos7-Epel --mirror=http://mirrors.aliyun.com/epel/7/x86_64/ --arch=x86_64 --breed=yum
cobbler repo add --name=Centos7-Openstack-train --mirror=http://mirrors.aliyun.com/centos/7/cloud/x86_64/openstack-train/ --arch=x86_64 --breed=yum
# 查看
cobbler repo list
# 同步
# 需要 sudo apt install yum-utils, 安装完后重启cobbler
# 存储在 /var/lib/cobbler/www/cobbler/repo_mirror/
cobbler reposync
cobbler profile edit --name=centos7-x86_64 --repos='Centos7-Base Centos7-Updates Centos7-extras Centos7-Epel'
cobbler profile report --name=centos7-x86_64
# 或者手动在ks文件里添加
# repo --name="BaseOS" --baseurl=http://192.168.10.50/cblr/repo_mirror/Centos8-BaseOS/
```
---------------
[1]: http://cobbler.github.io
[2]: https://cobbler.readthedocs.io/en/latest/
[3]: https://www.golinuxcloud.com/rhel-centos-8-kickstart-example-generator/

View File

@ -74,4 +74,10 @@ deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial stable
# deb-src [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial stable
```
```
```bash
sudo wget https://public.veypi.com/linux/repo/ubuntu18.list -O /etc/apt/sources.list
sudo wget https://public.veypi.com/linux/repo/ubuntu20.list -O /etc/apt/sources.list
```

63
linux/freerdp.md Normal file
View File

@ -0,0 +1,63 @@
# install freerpd.md
## v2.0
```bash
git clone https://github.com/FreeRDP/FreeRDP.git
git checkout origin/stable-2.0 -b 2.0
cd FreeRDP
sudo apt install cmake ninja-build build-essential debhelper cdbs dpkg-dev autotools-dev cmake pkg-config xmlto libssl-dev docbook-xsl xsltproc libxkbfile-dev libx11-dev libwayland-dev libxrandr-dev libxi-dev libxrender-dev libxext-dev libxinerama-dev libxfixes-dev libxcursor-dev libxv-dev libxdamage-dev libxtst-dev libcups2-dev libpcsclite-dev libasound2-dev libpulse-dev libjpeg-dev libgsm1-dev libusb-1.0-0-dev libudev-dev libdbus-glib-1-dev uuid-dev libxml2-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libfaad-dev libfaac-dev libavutil-dev libavcodec-dev libavresample-dev
cmake -DWITH_ALSA=ON -DWITH_OPENH264=ON -DWITH_FFMPEG=ON -DWITH_JPEG=ON -DWITH_X264=ON --build .
cmake --build . --target install
# test
xfreerdp /video /size:1067x600 /gfx-h264:AVC444 +gfc-thin-client +multitransport /gdi:hw /multimedia:sys:alsa,decoder:ffmpeg /network:auto /cert-ignore -decorations /dynamic-resolution /window-position:8x240 /v:10.69.136.109 /u:admin /p:Pride1952
xfreerdp /video /size:1067x600 /gfx-h264:AVC444 +gfx-thin-client +multitransport /gdi:hw /network:auto /cert-ignore -decorations /nsc /dynamic-resolution /window-position:0x0 /v:10.69.136.109 /u:admin /p:Pride1952
# 卸载
sudo xargs rm < install_manifest.txt
# 编译 openh264
git clone https://github.com/cisco/openh264.git
cd openh264/
sudo apt install nasm
make
sudo make install
# 编译 x264
git clone https://code.videolan.org/videolan/x264.git
cd x264
./configure --enable-shared
sudo make install
# 编译 ffmpeg
git clone https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg
./configure \
--enable-shared \
--enable-libopenh264 \
--enable-libx264 \
--enable-gpl \
--prefix=/usr/local/ffmpeg
cd /etc/ld.so.conf.d/
# 创建 ffmpeg.conf写入 "/usr/local/ffmpeg/lib"
sudo ldconfig
sudo ln -s /usr/local/ffmpeg/bin/ffmpeg /usr/local/bin/
sudo ln -s /usr/local/ffmpeg/bin/ffprobe /usr/local/bin/
sudo ln -s /usr/local/ffmpeg/bin/ffserver /usr/local/bin/
```
```bash
http://www.bubuko.com/infodetail-973117.html
```

12
linux/nosudopassword.md Normal file
View File

@ -0,0 +1,12 @@
# no sudo passsword
```bash
# ubuntu
sudo visudo
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
username ALL=(ALL:ALL) NOPASSWD: ALL
```

18
linux/openbox.md Normal file
View File

@ -0,0 +1,18 @@
# insall openbox
> env: ubuntu server-18.04
```bash
sudo apt install xserver-xorg-core
sudo apt install x-window-system-core
sudo apt install openbox
sudo apt install chromium-browser
```
```bash
# 配置目录
/etc/xdg/openbox
~/.config/openbox
```

15
linux/repo/ubuntu18.list Normal file
View File

@ -0,0 +1,15 @@
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

15
linux/repo/ubuntu20.list Normal file
View File

@ -0,0 +1,15 @@
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

View File

@ -0,0 +1,7 @@
# singel ui program
>> ubuntu server 18 安装独立桌面环境, 开机进入单独ui程序
```bash
```

View File

@ -3,6 +3,11 @@
``` bash
sudo apt install -y zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
sh -c "$(curl -fsSL https://public.veypi.com/install_zsh.sh)"
echo 'PROMPT=%m\ $PROMPT' >> ~/.zshrc
echo 'DISABLE_AUTO_UPDATE="true"' >> ~/.zshrc
chsh -s /bin/zsh
sudo reboot -h now
```
```

209
openstack/kolla.md Normal file
View File

@ -0,0 +1,209 @@
# kolla
环境 centos7 python3.6
## 注意事项
所有节点起名不要带 . - 等特殊符号
## build image
### install
```bash
yum install -y python3 python3-pip
git clone https://github.com/openstack/kolla.git -b stable/train
cd kolla
python3 -m venv ~/kolla_venv
source ~/kolla_venv/bin/activate
# 需要几分钟 会在当前目录 生成 etc/kolla/kolla-build.conf 可以复制到 /etc/kolla
pip install --upgrade pip
pip install tox
pip install -r requirements.txt
# 该步骤需要配置外网访问环境
tox -e genconfig
```
### build
```bash
# 基本命令
kolla-build
# 在源码目录使用这个
# 在上段venv虚拟环境下
python tools/build.py
# 单独build keystone
python tools/build.py keystone --registry docker.local:5000 --push
```
## deploy
```bash
git clone https://github.com/openstack/kolla.git -b stable/train
git clone https://github.com/openstack/kolla-ansible.git -b stable/train
python3 -m venv ~/kolla_venv
source ~/kolla_venv/bin/activate
pip install -U pip
pip install 'ansible<2.10'
pip install ./kolla
pip install ./kolla-ansible
sudo mkdir -p /etc/kolla
sudo chown $USER:$USER /etc/kolla
cp -r kolla-ansible/etc/kolla/* /etc/kolla
cp kolla-ansible/ansible/inventory/* .
# dowload image 该命令可以下载镜像
kolla-ansible -i ./all-in-one bootstrap-servers
kolla-ansible pull
# 生成密码
kolla-genpwd
## all-in-one
kolla-ansible -i ./all-in-one bootstrap-servers
kolla-ansible -i ./all-in-one prechecks
kolla-ansible -i ./all-in-one deploy
# 测试 连接
ansible -i multinode all -m ping
# multi_node
kolla-ansible -i ./multinode bootstrap-servers
kolla-ansible -i ./multinode prechecks
kolla-ansible -i ./multinode deploy
```
```bash
# multinode
[control]
controller01 ansible_ssh_user=<ssh-username> ansible_become=True ansible_private_key_file=<path/to/private-key-file>
[network]
controller01
[compute]
compute-[32:33]
[monitoring]
controller01
[storage]
[deployment]
localhost ansible_connection=local
```
```bash
# vim /etc/kolla/globals.yml
kolla_install_type: "binary"
kolla_base_distro: "centos"
openstack_release: "train"
network_interface: "eth0"
# 用的是eth0 组件api网络
api_interface: "{{ network_interface }}"
#eth0作为vxlan的承载网络 虚拟机内部通信网络
tunnel_interface: "eth0"
# 网络节点指定的外部网络通信网卡, eth1作为外部网络, 该网卡不要配置ip
neutron_external_interface: "eth1"
# 该参数会在网卡network_interface上创建第二个ip地址用以组件通讯horizon也是访问该ip 注意不要和原来的ip重复
kolla_internal_vip_address: ""
# 私有docker测试时不填部署时填
docker_registry: 'docker.local:5000'
# 使用虚拟机时必须改成qemu 默认kvm
nova_compute_virt_type: "kvm"
# 不启用
enable_haproxy: "no"
enable_cinder: "yes"
# 启用cinder
# cinder后端用lvm 或者iscsi
enable_cinder_backend_lvm: "no"
enable_cinder_backend_iscsi: "yes"
cinder_volume_group: "cinder-volumes"
```
## tips
```bash
## vim /etc/ansible/ansible.cfg
## ansible.cfg (位于当前目录中)
## ~/.ansible.cfg (位于家目录中)
## /etc/ansible/ansible.cfg
## 配置文件下载
## wget https://raw.githubusercontent.com/ansible/ansible/devel/examples/ansible.cfg
## 配置ansible
host_key_checking= False
## 配置ssh
# vim /etc/ssh/ssh_config
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
```
## image list
```bash
kolla/centos-binary-keystone-fernet train 770ef6f4ef27 12 hours ago 1.04GB
kolla/centos-binary-keystone-ssh train da94b8a5b2cf 12 hours ago 1.04GB
kolla/centos-binary-nova-compute train 646ef5ceaf11 12 hours ago 1.85GB
kolla/centos-binary-keystone train 10829c9218d3 12 hours ago 1.04GB
kolla/centos-binary-glance-api train e0c8341d43c1 12 hours ago 1.05GB
kolla/centos-binary-placement-api train 35286639fad7 12 hours ago 1.05GB
kolla/centos-binary-neutron-l3-agent train c0a059499114 12 hours ago 1.08GB
kolla/centos-binary-neutron-server train fe90e2d95b6f 12 hours ago 1.08GB
kolla/centos-binary-neutron-openvswitch-agent train dc8501d31b89 12 hours ago 1.08GB
kolla/centos-binary-neutron-metadata-agent train 6c3943894297 12 hours ago 1.05GB
kolla/centos-binary-neutron-dhcp-agent train c1a532c0eb1a 12 hours ago 1.05GB
kolla/centos-binary-horizon train 01a1889c965e 12 hours ago 1.2GB
kolla/centos-binary-nova-api train e051f99ff69e 12 hours ago 1.09GB
kolla/centos-binary-nova-conductor train 181a27891c90 12 hours ago 1.05GB
kolla/centos-binary-nova-novncproxy train 10bcad23acab 12 hours ago 1.06GB
kolla/centos-binary-nova-ssh train 57e67ee7bf82 12 hours ago 1.05GB
kolla/centos-binary-nova-scheduler train 11b8f5cd4b5f 12 hours ago 1.05GB
kolla/centos-binary-heat-engine train e494e62fbee3 12 hours ago 1.08GB
kolla/centos-binary-heat-api train ea95c1de82ff 12 hours ago 1.08GB
kolla/centos-binary-heat-api-cfn train 519589193563 12 hours ago 1.08GB
kolla/centos-binary-nova-libvirt train 9928983698b2 13 hours ago 1.26GB
kolla/centos-binary-openvswitch-vswitchd train 3ef665ba3fb4 13 hours ago 428MB
kolla/centos-binary-openvswitch-db-server train 9c15e0aa5c3c 13 hours ago 428MB
kolla/centos-binary-chrony train 29818573a4cc 13 hours ago 410MB
kolla/centos-binary-kolla-toolbox train c0a499f0b02b 13 hours ago 834MB
kolla/centos-binary-haproxy train 2f400b7595d0 13 hours ago 435MB
kolla/centos-binary-keepalived train e35a4ba6008f 13 hours ago 415MB
kolla/centos-binary-mariadb train 779223d0db58 13 hours ago 594MB
kolla/centos-binary-fluentd train 2e728e1b3f53 13 hours ago 667MB
kolla/centos-binary-cron train 4ee71cc3457e 13 hours ago 409MB
kolla/centos-binary-rabbitmq train b36561201752 13 hours ago 489MB
kolla/centos-binary-memcached
```
---------------
[1]: https://docs.openstack.org/kolla/train/admin/image-building.html
[2]: https://docs.openstack.org/kolla-ansible/train/

View File

@ -1,15 +1,35 @@
# 树莓派 配置 cobbler
[TOC]
## 安装
```bash
# 源码安装
sudo apt install git make python-dev python-setuptools python-cheetah openssl
sudo apt install createrepo apache2 python-cheetah python-netaddr python-simplejson python-urlgrabber python-yaml rsync yum-utils libapache2-mod-wsgi xinetd tftpd tftp python-django
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod rewrite
sudo a2ensite cobbler.conf
sudo apt install make git python3-yaml python3-cheetah python3-netaddr python3-simplejson python3-future python3-distro python3-setuptools python3-sphinx python3-coverage pyflakes3 python3-pycodestyle python3-django
git clone https://github.com/cobbler/cobbler.git
cd cobbler
git checkout release28
```
本来Google的方案需要从源码安装但是尝试了下apt 发现有现成的包,~~所以简单太多了~~ 版本太老,有额外的问题要处理.
```bash
sudo apt install cobbler cobbler-web
sudo apt install cobbler cobbler-web xinetd
# 安装过程中会让输密码
# 该包是2.6.6版本 有点老现在来说有好几个bug
# cobbler-web 有bug 不兼容新的
@ -76,6 +96,10 @@ subnet 192.168.1.0 netmask 255.255.255.0 {
max-lease-time 43200;
next-server $next_server;
}
# 树莓派版本用的dnsmasq所以改这个
# 配置DHCP /etc/cobbler/dnsmasq.template
```
cobbler 会将 镜像存储到 /var/lib/cobbler/www/cobbler/ks_mirror/下, 注意容量和权限
@ -112,7 +136,7 @@ sudo cobbler sync
```bash
# http://mirrors.aliyun.com/centos 下载镜像, 下载minimal版方便测试
sudo mkdir /mnt/centos_mini
sudo mount -t iso9660 -o loop,ro ~/CentOS-8.2.2004-x86_64-dvd1.iso /mnt
sudo mount -t iso9660 -o loop,ro ~/CentOS-8.2.2004-x86_64-dvd1.iso /mnt/centos_mini
sudo cobbler import --name=centos8-mini --arch=x86_64 --path=/mnt/centos_mini
# 出现这个问题
@ -122,7 +146,8 @@ No signature matched in /var/lib/cobbler/www/cobbler/ks_mirror/centos8-x86_64
!!! TASK FAILED !!!
# 使用该指令之后再导入一次
sudo cobbler signature update
sudo cobbler import --name=centos8 --arch=x86_64 --path=/mnt
sudo cobbler import --name=centos8-mini --arch=x86_64 --path=/mnt/centos_mini
# 出现这个问题
Exception occured: <type 'exceptions.KeyError'>
@ -320,7 +345,9 @@ timezone Asia/ShangHai
# System authorization information
auth --useshadow --enablemd5
# centos8 已经将authconfig 更新为authselect
# auth --useshadow --enablemd5
authselect --enableshadow --passlgo=sha512
#Root password
rootpw --iscrypted $default_password_crypted
@ -358,6 +385,9 @@ autopart
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
$yum_repo_stanza
# add repo manually
# repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream
# Network information
$SNIPPET('network_config')
# Do not configure the X Window System
@ -373,6 +403,7 @@ $SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end
%packages
$SNIPPET('func_install_if_enabled')
@ -395,7 +426,7 @@ $SNIPPET('log_ks_post')
# Start yum configuration
$yum_config_stanza
# End yum configuration
$SNIPPET('post_install_kernel_options')
$('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('puppet_register_if_enabled')
@ -408,12 +439,136 @@ $SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps
%end
```
## 验证
- failed to load ldlinux.c32
![image-20200714060726959](https://public.veypi.com/img/screenshot/20200714060727.png)
```bash
sudo cp /usr/lib/syslinux/ldlinux.c32 /var/lib/cobbler/tftp/
```
- Failed to load libutil.c32 failed to load COM32 file menu.c32
![image-20200714061319612](https://public.veypi.com/img/screenshot/20200714061319.png)
```bash
sudo cp /usr/lib/syslinux/libutil.c32 /var/lib/cobbler/tftp/
sudo cp /usr/lib/syslinux/menu.c32 /var/lib/cobbler/tftp/
```
- 暂时成功
![image-20200714061640172](https://public.veypi.com/img/screenshot/20200714061640.png)
- failed to fetch kickstart from http://.../cblr/svc/op/ks/profile/cobbler-centos8-mini-x86_x64
dracut-initqueue[944]: Warning: dracut-initqueue timeout
![image-20200714062152172](https://public.veypi.com/img/screenshot/20200714062152.png)
```bash
# 又是版本不对应的锅
# apache2 升级到2.4之后之前的的配置不能通过授权
sudo vim /etc/apache2/apache2.conf
<Directory />
Options FollowSymLinks
AllowOverride None
#Require all denied
Require all granted
</Directory>
# 查看日志有错误
Tue Jul 14 08:18:54 2020 - INFO | Exception occured: <class 'cobbler.cexceptions.CX'>
Tue Jul 14 08:18:54 2020 - INFO | Exception value: 'Error templating file, check cobbler.log for more details'
Tue Jul 14 08:18:54 2020 - INFO | Exception Info:
File "/usr/lib/python2.7/dist-packages/cobbler/remote.py", line 1062, in generate_kickstart
return self.api.generate_kickstart(profile,system)
File "/usr/lib/python2.7/dist-packages/cobbler/api.py", line 696, in generate_kickstart
return self.kickgen.generate_kickstart_for_profile(profile)
File "/usr/lib/python2.7/dist-packages/cobbler/kickgen.py", line 312, in generate_kickstart_for_profile
return self.generate_kickstart(profile=g)
File "/usr/lib/python2.7/dist-packages/cobbler/kickgen.py", line 290, in generate_kickstart
data = self.templar.render(raw_data, meta, None, obj)
File "/usr/lib/python2.7/dist-packages/cobbler/templar.py", line 116, in render
data_out = self.render_cheetah(raw_data, search_table, subject)
File "/usr/lib/python2.7/dist-packages/cobbler/templar.py", line 215, in render_cheetah
raise CX("Error templating file, check cobbler.log for more details")
# 修改该文件37行
sudo vim /usr/lib/python2.7/dist-packages/cobbler/templar.py
# 改为: fix_cheetah_class = (int(major), int(minor), int(release)) >= (2, 4, 2)
```
- 系统安装中出现一些异常
pykickstart.errors.KickstartError: /usr/sbin/authconfig is missing
![image-20200714085059931](https://public.veypi.com/img/screenshot/20200714085100.png)
```bash
# 该问题是centos 8 没有authconfig指令了更新为了 authselect
# 更改ks文件将auth 行 换成authselect
```
- missing packages: 配置本地源即可解决
-
![image-20200714184027547](https://public.veypi.com/img/screenshot/20200714184027.png)
- sbin/dmsquash-live-root: line 273: write error: No space left on device
确保虚拟机有至少2g内存
- pyanaconda.payload.PayloadError: Payload error - DNF installation has ended up abruptly: No available modular metadata for modular package Traceback
Dnf.exceptions.Error: No available modular metadata for modular package
![image-20200714233216115](https://public.veypi.com/img/screenshot/20200714233216.png)
## 配置 centos8 本地源
```bash
sudo apt install yum-utils
# 添加
sudo cobbler repo add --name=Centos8-BaseOS --mirror=http://mirrors.aliyun.com/centos/8.2.2004/BaseOS/x86_64/os/ --arch=x86_64 --breed=yum
sudo cobbler repo add --name=Centos8-AppStream --mirror=http://mirrors.aliyun.com/centos/8.2.2004/AppStream/x86_64/os/ --arch=x86_64 --breed=yum
sudo cobbler repo add --name=Centos8-extras --mirror=http://mirrors.aliyun.com/centos/8.2.2004/extras/x86_64/os/ --arch=x86_64 --breed=yum
sudo cobbler repo add --name=Centos8-Epel --mirror=http://mirrors.aliyun.com/epel/8/Everything/x86_64/ --arch=x86_64 --breed=yum
sudo cobbler repo add --name=Centos8-Openstack-ussuri --mirror=http://mirrors.aliyun.com/centos/8.2.2004/cloud/x86_64/openstack-ussuri/ --arch=x86_64 --breed=yum
# 查看
sudo cobbler repo list
# 同步
# 需要 sudo apt install yum-utils, 安装完后重启cobbler
# 存储在 /var/lib/cobbler/www/cobbler/repo_mirror/
sudo cobbler reposync
sudo cobbler profile edit --name=cobbler-centos8-mini-x86_64 --repos='Centos8-BaseOS Centos8-AppStream Centos8-extras Centos8-Epel Centos8-Openstack-ussuri'
# 或者手动在ks文件里添加
# repo --name="BaseOS" --baseurl=http://192.168.10.50/cblr/repo_mirror/Centos8-BaseOS/
```
@ -424,6 +579,10 @@ $SNIPPET('kickstart_done')
[2]: https://cobbler.readthedocs.io/en/latest/
[3]: https://bashtheshell.com/guide/setting-up-pxe-boot-server-on-raspberry-pi/
[4]: http://wiki.inford.net/使用树莓派3构建PXE服务器自动安装操作系统
[5]: https://blog.51cto.com/dyc2005/2130240
[6]: https://www.golinuxcloud.com/rhel-centos-8-kickstart-example-generator/

18
raspberry/golang.md Normal file
View File

@ -0,0 +1,18 @@
# golang raspberrr
## install
```bash
wget https://docs.studygolang.com/src/bootstrap.bash?m=text -O bootstrap.bash
chmod u+x bootstrap.bash
wget https://studygolang.com/dl/golang/go1.15.2.linux-armv6l.tar.gz -O go.tar.gz
sudo tar -C /usr/local -xzf go.tar.gz
PATH=$PATH:/usr/local/go/bin
GOPATH=$HOME/go
```

268
raspberry/kickstart.md Normal file
View File

@ -0,0 +1,268 @@
# 树莓派部署 kickstart 服务器
[TOC]
## dhcp
```bash
sudo apt install isc-dhcp-server
cat > /etc/dhcp/dhcpd.conf <<EOF
ddns-update-style interim;
allow booting;
allow bootp;
ignore client-updates;
set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
subnet 192.168.10.0 netmask 255.255.255.0 {
#option routers 192.168.10.1;
option domain-name-servers 223.5.5.5;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.10.100 192.168.10.254;
filename "/pxelinux.0";
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.10.50;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
if option pxe-system-type = 00:02 {
filename "ia64/elilo.efi";
} else if option pxe-system-type = 00:06 {
filename "grub/grub-x86.efi";
} else if option pxe-system-type = 00:07 {
filename "grub/grub-x86_64.efi";
} else if option pxe-system-type = 00:09 {
filename "grub/grub-x86_64.efi";
} else {
filename "pxelinux.0";
}
}
}
# group for Cobbler DHCP tag: default
group {
}
EOF
sudo /etc/init.d/isc-dhcp-server start
```
## tftp
```bash
sudo apt install xinetd tftpd tftp
sudo touch /etc/xinetd.d/tftp
cat > /etc/xinetd.d/tftp <<EOF
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -B 1380 -v -s /var/lib/tftpboot
per_source = 11
cps = 100 2
flags = IPv4
}
EOF
sudo mkdir /var/lib/tftpboot
# 授予所有读写权限
sudo chmod -R 777 /var/lib/tftpboot
sudo chown -R nobody /var/lib/tftpboot
sudo /etc/init.d/xinetd restart
```
## httpd
```bash
sudo apt install apache2
cd /var/www/html
rm index.html
sudo sed -i 's/\/var\/www\/html/\/var\/www/' /etc/apache2/sites-enabled/000-default.conf
sudo service apache2 restart
sudo chmod -R 777 /var/www
sudo mkdir /var/www/kickstart
sudo mkdir /var/www/images
sudo mkdir /var/www/images/centos7
sudo mkdir /var/www/repo
```
## 引导
```bash
wget http://mirrors.aliyun.com/centos/7.8.2003/os/x86_64/Packages/syslinux-4.05-15.el7.x86_64.rpm -O /tmp/syslinux.rpm
sudo apt install rpm2cpio
sudo rpm2cpio /tmp/syslinux.rpm | cpio -idmv
cp /tmp/usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
mkdir /var/lib/tftpboot/pxelinux.cfg
cat > /var/lib/tftpboot/pxelinux.cfg/default << EOF
DEFAULT menu
PROMPT 0
MENU TITLE PrideCloud
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT local
LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT -1
LABEL centos7-x86_64
kernel /images/centos7-x86_64/vmlinuz
MENU LABEL centos7-x86_64
append initrd=/images/centos7-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://192.168.10.50/kickstart/centos7.ks
ipappend 2
MENU end
EOF
```
## 挂载镜像
```bash
sudo mount -t iso9660 -o loop,ro ~/CentOS-7-x86_64-Minimal-2003.iso /var/www/images/centos7
# 编辑kickstart 文件
sudo vim /var/www/kickstart/centos7.ks
```
```bash
# /var/www/kickstart/centos7.ks
# platform =x86, AMD64, or Intel EM64T
# os=centos7
# Install OS instead of upgrade
install
# Use text mode install
text
# System keyboard
keyboard us
# System language
lang en_US
# System timezone
timezone Asia/ShangHai
# System authorization information
auth --useshadow --enablemd5
rootpw --iscrypted $1$XiTkwMpL$Y9cGAcWZC2koVK68De7LZ.
# Firewall configuration
firewall --disabled
# SELinux configuration
selinux --disabled
# Use network installation
url --url=http://192.168.10.50/images/centos7
# Clear the Master Boot Record
zerombr
# System bootloader configuration
# bootloader --location=mbr
# interface can be named as eth*
bootloader --location=mbr --append="net.ifnames=0 biosdevname=0 rhgb quiet"
# Partition clearing information
clearpart --all --initlabel
# Allow anaconda to partition the system as needed
autopart
# or
# # create 1MB biosboot type partition, centos7 and centos8 .
# part biosboot --fstype=biosboot --size=1
# # Disk partitioning information
# part /boot --fstype=xfs --size=300
# part pv.122 --fstype="lvmpv" --grow
# volgroup VolGroup00 --pesize=16384 pv.122
# logvol / --fstype="xfs" --size=10000 --name=LogVol00 --vgname=VolGroup00
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
# repo --name=Centos7-Base --baseurl=http://192.168.10.50/repo/Centos7-Base
# repo --name=Centos7-Updates --baseurl=http://192.168.10.50/repo/Centos7-Updates
# repo --name=Centos7-extras --baseurl=http://192.168.10.50/repo/Centos7-extras
# repo --name=Centos7-Epel --baseurl=http://192.168.10.50/repo/Centos7-Epel
# repo --name=source-1 --baseurl=http://192.168.10.50/images/centos7
# add repo manually
# repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# Do not configure the X Window System
skipx
# Run the Setup Agent on first boot
firstboot --disable
# Reboot after installation
reboot
%pre
set -x -v
exec 1>/tmp/ks-pre.log 2>&1
# Once root's homedir is there, copy over the log.
while : ; do
sleep 10
if [ -d /mnt/sysimage/root ]; then
cp /tmp/ks-pre.log /mnt/sysimage/root/
logger "Copied %pre section log to system"
break
fi
done &
# Enable installation monitoring
%end
%packages
# if you need puppet to install pkgs, just uncomment it
#
@core
@base
tree
nmap
wget
telnet
zsh
docker
python-pip
%end
%post --nochroot
set -x -v
exec 1>/mnt/sysimage/root/ks-post-nochroot.log 2>&1
%end
%post
set -x -v
exec 1>/root/ks-post.log 2>&1
wget http://192.168.10.50/pride/init.sh -O /tmp/init.sh
chmod u+x /tmp/init.sh
/tmp/init.sh
# wget http://192.168.10.60/cblr/pride/init.sh -O /tmp/init.sh && chmod u+x /tmp/init.sh && /tmp/init.sh
%end
```

View File

@ -52,6 +52,7 @@ deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui
```bash
sudo apt install zsh
sudo curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
sudo curl -L https://public.veypi.com/install_zsh.sh | sh
chsh -s /bin/zsh
```
@ -96,6 +97,12 @@ network={
sudo wpa_cli -i wlan0 reconfigure
```
## docker
```bash
sudo curl -sSL https://get.docker.com | sh
```
------------------------

12
vue/vuetify.md Normal file
View File

@ -0,0 +1,12 @@
# vuetify
## 离线使用mdi
```bash
yarn add @mdi/font
# main.js
import '@mdi/font/css/materialdesignicons.css'
```