2020年12月15日 星期二

Proxmox 6.x LXC 設定quota 摘要

1.host lxc
apt install -y quota

2.lxc
resource configure enable quota
quotacheck -cmug /
quotaon /

2020年12月11日 星期五

bash 尋找可用的port

 #!sh

j=10240

f(){ for i in $(netstat -an|grep TCP|awk '{print $2 }'|uniq|awk -F : '{print $2 }'|sort -n);do [ $1 -lt $i ]&&break;[ $1 -eq $i ]&&echo found&&break; done; };
p(){ for i in $(seq $1 65535);do [ -z "$(f $i)" ]&& echo $i && return 0;done;echo 0;return 1; };
ncvzn(){ r=$(echo|timeout ${3:-3} nc $1 $2 2>/dev/null);r0=$?;echo $r;return $r0;};

for i in p1 p2;do eval "$i=\$(p \$j);j=\$(expr \$$i + 1)";done;
echo $p1 $p2

2020年12月3日 星期四

pvcreate 錯誤訊息:Device /dev/sdx excluded by a filter.

原因為pvcreate 無法識別硬碟分割區訊息

pvcreate /dev/sdx
Device /dev/sdx excluded by a filter.

parted /dev/sdx
mklabel msdos

Proxmox VE 6.x 安裝 Proxmox backup server

 echo "deb http://download.proxmox.com/debian/pbs buster pbs-no-subscription" >/etc/apt/sources.list.d/pbs-no-subscription.list
apt update
apt-get install proxmox-backup-server

Debian 10 瘦身摘要

清除 dpkg cache 相關檔案
/var/lib/apt/lists/
apt clean
apt autoremove --purge

保留所需的 kernel 及module

消除沒用的設定檔
dpkg -l | grep ^rc | cut -d' ' -f3 | sudo xargs dpkg --purge

移除相關多國語言支援
/usr/lib/locale/
/usr/share/locale
apt-get install localepurge
dpkg --configure localepurge
localepurge

參考資料
https://wiki.debian.org/ReduceDebian

2020年12月2日 星期三

Debian 10 安裝 tftp server

apt-get install -y tftpd xinetd

cat <<REM > /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
REM

systemctl enable xinetd
systemctl restart xinetd

2020年11月30日 星期一

DReichLab / EIG 安裝摘要(debian 10)

target=/opt
src=https://github.com/DReichLab/EIG/archive/v7.2.1.tar.gz

apt-get install -y libgsl0-dev libopenblas-dev gfortran liblapacke-dev
pwd=$(pwd)
cd $target
wget -O- $src |tar zxv
cd EIG-7.2.1/src
sed  -i 's/# override LDLIBS += -llapacke/override LDLIBS += -llapacke/g' Makefile
make
make install
cd $pwd
for i in $(find ${target}/EIG-7.2.1/bin/ -type f  -perm /a=x);do ln -s $i /usr/local/bin/$(basename $i);done;