ipxe编译安装

ipxe默认ZLIB GZIP IMAGE_COMBOOT所以自己编译一下, 编译EFI版本的时候要去掉IMAGE_COMBOOT.

还有通过EMBED预置脚本编译成iso后, 在没有dhcp的机器上也可以进行ipxe引导.

 cat>/opt/tftp/boot.ipxe<<EOF
#!ipxe
isset ${ip} || dhcp || config
ifopen
show mac
route
chain --autofree http://你的pxe服务器地址/ipxe.php
EOF

cd /tmp
yum install git mkisofs gcc make  xz-devel  -y
git clone git://git.ipxe.org/ipxe.git
cd ipxe/src
cat>config/local/general.h<<EOF
#define DOWNLOAD_PROTO_HTTPS
#define IMAGE_COMBOOT
#define CONSOLE_CMD
#define VLAN_CMD
#define IMAGE_ZLIB
#define IMAGE_GZIP
EOF
make EMBED=/opt/tftp/boot.ipxe 

cat>config/local/general.h<<EOF
#define DOWNLOAD_PROTO_HTTPS
#define CONSOLE_CMD
#define VLAN_CMD
#define IMAGE_ZLIB
#define IMAGE_GZIP
EOF
make bin-x86_64-efi/{ipxe.efi,snponly.efi} EMBED=/opt/tftp/boot.ipxe 

install -p -D -m 0644  bin/{undionly.kpxe,undionly.kkpxe} /opt/tftp/
install -p -D -m 0644  bin-x86_64-efi/{ipxe.efi,snponly.efi} /opt/tftp/

还有 bin/ipxe.iso  bin/ipxe.lkrn bin/ipxe.pxe bin/ipxe.usb可以复制一下, 做ipxe网络启动只要一个ipxe.efi和snponly.efi 以及ipxe.kkpxe就够了

 

 

IPXE windows uefi http boot

最近在写自动装机管理, 等写完了才在github上发现一个项目https://github.com/OneB1t/uefihttpboot

当时要是多留个心, 也不至于后面走了很多弯路.

 

阅读剩余部分...

IPXE安装ESXI

最近折腾得比较头大

准备工作先建立一个web服务.

将esxi的iso下载解压并将boot.cfg配置修改好

#自定义内容
esxiurl=http://$sesrver/VMware-VMvisor-Installer-6.5.0.XXXX.x86_64.iso
isoname=VMware_esxi.iso
tmppath=tmp
isocache=esxipath
#-------------------------------------------------------------------------------------
mkdir $isocache $tmppath
wget -c $esxiurl -O $isoname
mount $isoname $tmppath
rsync -az $tmppath/ $isocache/
umount $tmppath
sed -i 's#/##g'  $isocache/boot.cfg
sed -i 's/prefix/#prefix/g'  $isocache/boot.cfg
sed -i 's/kernelopt/#kernelopt/g'  $isocache/boot.cfg

kickstart文件也可以一起丢到esxi的web目录下面

 

ipxe默认没有开启支持SYSLINUX COMBOOT,需要自己编译进去

yum install git mkisofs gcc make  rsync
git clone git://git.ipxe.org/ipxe.git
cd ipxe/src
cat>>config/local/general.h<<EOF
#define DOWNLOAD_PROTO_HTTPS
#define IMAGE_COMBOOT
EOF
make bin/{ipxe.iso,undionly.kkpxe,ipxe.usb} bin-x86_64-efi/ipxe.efi 
mkdir ipxe
cp bin/{ipxe.iso,undionly.kkpxe,ipxe.usb} bin-x86_64-efi/ipxe.efi ipxe

编译好的undionly.kkpxe放到tftp目录下, 然后dhcp引导加载

 

 

IPXE脚本部分:

#!ipxe
iseq ${platform} efi && goto is_efi ||
kernel {$mirror}/mboot.c32 -c  {$mirror}/boot.cfg  ks=http://{$server}/kickstart prefix={$mirror} nameserver={$dns}  BOOTIF={$mac} ip={$ip}   netmask={$netmask} gateway={$gateway} kernelopt=allowLegacyCPU=true
boot

:is_efi
kernel  {$mirror}/efi/boot/bootx64.efi -c  {$mirror}/boot.cfg  ks=http://{$server}/kickstart prefix={$mirror} nameserver={$dns}  BOOTIF={$mac} ip={$ip}   netmask={$netmask} gateway={$gateway} kernelopt=allowLegacyCPU=true
boot

{$mirror}是esxi的iso解压出来可以http访问的地址

 

这里特别感谢https://blog.open4j.com/2019/05/30/ipxe-build-embedded-script/ 点破了COMBOOT的问题.

Centos安装bgpq4

yum install git autoconf automake gcc libtool -y
git clone https://github.com/bgp/bgpq4
cd bgpq4
./bootstrap
./configure
make
make install

编译好后从as-set抓取IP直接生成配置

bgpq4 -Jl Baidu-list AS-55967

具体用法参考github上项目的说明文件.

nginx反向代理解决googleapis字体库问题

虽然有第三方的,但是自己nginx里面写死配置来得安稳些.

用法就是在网站目录里面直接引用一下配置文件include googleapis.conf;

这里做了一个虚拟目录/assets/vendor/, 可以根据自己的需求设置.

 

# cat ../googleapis.conf
sub_filter_once off;
sub_filter_types text/css text/xml text/javascript;
sub_filter "https://fonts.googleapis.com" "/assets/vendor/googleapis";
sub_filter "//fonts.googleapis.com" "/assets/vendor/googleapis";
sub_filter "https://ajax.googleapis.com" "/assets/vendor/ajax";
sub_filter "https://fonts.gstatic.com" "/assets/vendor/fonts_gstatic";
proxy_hide_header Link;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;

location ~  ^/assets/vendor/googleapis/ {
proxy_set_header Accept-Encoding "";
  rewrite ^/assets/vendor/googleapis/(.+)$ /$1 break;
  proxy_pass https://fonts.googleapis.com;
  proxy_set_header Host "fonts.googleapis.com";
  proxy_set_header User-Agent "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0";
  expires 1d;
  sub_filter "https://fonts.gstatic.com" "/assets/vendor/fonts_gstatic";
}

location ~ ^/assets/vendor/fonts_gstatic/ {
  rewrite ^/assets/vendor/fonts_gstatic/(.+)$ /$1 break;
  proxy_pass https://fonts.gstatic.com;
  proxy_set_header Host "fonts.gstatic.com";
  proxy_set_header User-Agent "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0";
  expires 1y;
}

location ~  ^/assets/vendor/gstatic/ {
  rewrite ^/assets/vendor/gstatic/(.+)$ /$1 break;
  proxy_pass https://www.gstatic.com;
  proxy_set_header Host "www.gstatic.com";
  expires 1y;
}

location ~  ^/assets/vendor/ajax/ {
  rewrite ^/assets/vendor/ajax/(.+)$ /$1 break;
  proxy_pass https://gajax.googleapis.com;
  proxy_set_header Host ajax.googleapis.com;
  expires 1y;
}

chrony时间同步

弃用ntp换chrony做时间同步了

cat /usr/share/zoneinfo/Asia/Shanghai>/etc/localtime
yum install -y chrony
systemctl enable chronyd
systemctl start chronyd

Centos8安装部署Caddy2以及typecho/wordpress伪静态

Centos8(Caddy2)

yum -y -q install epel-release
yum -y copr enable @caddy/caddy
yum -y -q install caddy


/etc/caddy/Caddyfile的typecho配置例子

DOMAIN='blog.domian'
cat>/etc/caddy/Caddyfile<<EOF
${DOMAIN}, www.${DOMAIN}
{
   tls admin@${DOMAIN}
   root * /home/${DOMAIN}/
   encode gzip
   file_server
   php_fastcgi unix//dev/shm/php-fpm.sock
   handle_path / {   try_files {path} {path}/index.php?{query} index.php?{query}  }
}
EOF

“域名.后缀”  替换成自己的域名

/dev/shm/php-fpm.sock换成自己的php-fpm路径

多个域名用逗号和空格隔开, 可以绑定多个域名.

php自己安装配置, Caddyfile配置已经验证可用.

Centos7安装Caddy

用caddy自动续签ssl太爽了, 之前编译安装太费心了,现在可以直接从epel安装.

但是如果要做4层协议转发,还是没有nginx效率强大.

Centos7

yum -y -q install epel-release
yum -y -q install caddy

阅读剩余部分...

Centos下安装部署Vaultwarden和Caddy1

Bitwarden的一个开放项目Vaultwarden基于rust编写, 可以使用Bitwarden的浏览器插件然后配置使用自建的服务器.

Caddy比nginx配置更简单自动SSL方便, teddy有编译好直接拿来用.

 注意:小内存编译需要4GB的swap

配套资料

官方资源页面: https://bitwarden.com/download/

Windows桌面软件: https://vault.bitwarden.com/download/?app=desktop&platform=windows
MacOS APP安装: https://itunes.apple.com/app/bitwarden/id1352778147
Chrome插件: https://chrome.google.com/webstore/detail/bitwarden-free-password-m/nngceckbapebfimnlniiiahkandclblb
Firefox插件: https://addons.mozilla.org/firefox/addon/bitwarden-password-manager/
微软EDGE插件: https://microsoftedge.microsoft.com/addons/detail/jbkfoedolllekgbhcbcoahefnbanhhlh

阅读剩余部分...

docker mail server

poste.io
mailu.io
mailcow
docker-mailserver
Mailu
Modoboa

都是docker容器的

sqlite3导出备份恢复

1、备份和还原数据库
sqlite> .backup 'backup.db'
sqlite> .restore 'backup.db'

2、导出及导入SQL脚本
shell方式:
# sqlite3 sqa.db ".dump [mytabl%]" > sqa.sql
# sqlite3 sqb.db < sqa.sql

命令行方式:
sqlite> .output backup.sql
sqlite> .dump [mytabl%]
sqlite> .read backup.sql

阅读剩余部分...

nginx fastcgi中SCRIPT_FILENAME的设置

在官方wiki找到的

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name

在alias下路径报错

-----------------------------------------------------------------------------

fastcgi_param SCRIPT_FILENAME $request_filename

index取值忽略fastcgi_index的设定, 直接取http或者server字段下的index设定值.

 

https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/

keepass/vaultwarden

想装一个玩玩,但是最近没有时间或又没又精力

https://github.com/dani-garcia/vaultwarden

 

https://nodeedge.com/keepass-to-vaultwarden.html

https://zhuanlan.zhihu.com/p/391010360

https://www.uskvm.com/p/196.html