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
+7
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
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/
+7 -1
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
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
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
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
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
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
+7
View File
@@ -0,0 +1,7 @@
# singel ui program
>> ubuntu server 18 安装独立桌面环境, 开机进入单独ui程序
```bash
```
+6 -1
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
```
```