diff --git a/database/mysql.md b/database/mysql.md index 2cbe2cc..429b965 100644 --- a/database/mysql.md +++ b/database/mysql.md @@ -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; + +``` + diff --git a/docker/register.md b/docker/register.md index 40b1330..8d9e412 100644 --- a/docker/register.md +++ b/docker/register.md @@ -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 diff --git a/elasticsearch/elasticsearch.md b/elasticsearch/elasticsearch.md new file mode 100644 index 0000000..120d76c --- /dev/null +++ b/elasticsearch/elasticsearch.md @@ -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() + +``` + diff --git a/es/es.md b/es/es.md new file mode 100644 index 0000000..5328c76 --- /dev/null +++ b/es/es.md @@ -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 <> +Red Hat Management Server : <> +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 : <> +Name Servers : [] +Name Servers Search Path : [] +Owners : ['admin'] +Parent Profile : +Internal proxy : +Red Hat Management Key : <> +Red Hat Management Server : <> +Repos : [] +Server Override : <> +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/ + + + + + + + + + diff --git a/linux/env.md b/linux/env.md index 437dc85..48b98b4 100644 --- a/linux/env.md +++ b/linux/env.md @@ -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 -``` \ No newline at end of file +``` + + +```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 +``` diff --git a/linux/freerdp.md b/linux/freerdp.md new file mode 100644 index 0000000..f527fe0 --- /dev/null +++ b/linux/freerdp.md @@ -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 +``` diff --git a/linux/nosudopassword.md b/linux/nosudopassword.md new file mode 100644 index 0000000..ddadaad --- /dev/null +++ b/linux/nosudopassword.md @@ -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 + +``` diff --git a/linux/openbox.md b/linux/openbox.md new file mode 100644 index 0000000..e6ca12c --- /dev/null +++ b/linux/openbox.md @@ -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 +``` diff --git a/linux/repo/ubuntu18.list b/linux/repo/ubuntu18.list new file mode 100644 index 0000000..410a343 --- /dev/null +++ b/linux/repo/ubuntu18.list @@ -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 + diff --git a/linux/repo/ubuntu20.list b/linux/repo/ubuntu20.list new file mode 100644 index 0000000..d62c942 --- /dev/null +++ b/linux/repo/ubuntu20.list @@ -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 + diff --git a/linux/single-ui-program.md b/linux/single-ui-program.md new file mode 100644 index 0000000..7db8454 --- /dev/null +++ b/linux/single-ui-program.md @@ -0,0 +1,7 @@ +# singel ui program + +>> ubuntu server 18 安装独立桌面环境, 开机进入单独ui程序 + +```bash + +``` diff --git a/linux/zsh.md b/linux/zsh.md index 0da7aaa..e10f8ce 100644 --- a/linux/zsh.md +++ b/linux/zsh.md @@ -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 -``` \ No newline at end of file +``` diff --git a/openstack/kolla.md b/openstack/kolla.md new file mode 100644 index 0000000..4fcfc99 --- /dev/null +++ b/openstack/kolla.md @@ -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= ansible_become=True ansible_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/ + + + diff --git a/raspberry/cobbler.md b/raspberry/cobbler.md index 5417c51..6d1613f 100644 --- a/raspberry/cobbler.md +++ b/raspberry/cobbler.md @@ -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: @@ -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 + + + Options FollowSymLinks + AllowOverride None + #Require all denied + Require all granted + + + # 查看日志有错误 + Tue Jul 14 08:18:54 2020 - INFO | Exception occured: + 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/ + + diff --git a/raspberry/golang.md b/raspberry/golang.md new file mode 100644 index 0000000..1488720 --- /dev/null +++ b/raspberry/golang.md @@ -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 + +``` + diff --git a/raspberry/kickstart.md b/raspberry/kickstart.md new file mode 100644 index 0000000..b35d618 --- /dev/null +++ b/raspberry/kickstart.md @@ -0,0 +1,268 @@ +# 树莓派部署 kickstart 服务器 + +[TOC] + + + +## dhcp + +```bash +sudo apt install isc-dhcp-server + +cat > /etc/dhcp/dhcpd.conf < /etc/xinetd.d/tftp < /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 +``` + diff --git a/raspberry/main.md b/raspberry/main.md index 8113b0d..1997721 100644 --- a/raspberry/main.md +++ b/raspberry/main.md @@ -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 +``` + ------------------------ diff --git a/vue/vuetify.md b/vue/vuetify.md new file mode 100644 index 0000000..0a26ed9 --- /dev/null +++ b/vue/vuetify.md @@ -0,0 +1,12 @@ +# vuetify + + + +## 离线使用mdi + +```bash +yarn add @mdi/font +# main.js +import '@mdi/font/css/materialdesignicons.css' +``` +