What is immutable Linux:
https://www.zdnet.com/article/what-is-immutable-linux-heres-why-youd-run-an-immutable-linux-distro/
NVMe-over-TCP:
https://interface31.ru/tech_it/2024/10/nvme-over-tcp—prakticheskoe-znakomstvo-s-tehnologiey.html
https://www.zdnet.com/article/what-is-immutable-linux-heres-why-youd-run-an-immutable-linux-distro/
https://interface31.ru/tech_it/2024/10/nvme-over-tcp—prakticheskoe-znakomstvo-s-tehnologiey.html
https://docs.docker.com/engine/install/ubuntu/
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-22-04
https://habr.com/ru/post/310460/
https://docker-curriculum.com/
V1:
nano /etc/systemd/system/multi-user.target.wants/docker.service
#ExecStart=/usr/bin/dockerd -H fd:// –containerd=/run/containerd/containerd.sock
ExecStart=/usr/bin/dockerd -H fd:// -H XXX.XXX.XXX.XXX:2375
systemctl daemon-reload
systemctl restart docker.service
https://programmersought.com/article/76572985717/
V2
# These commands get run inside of your VM.
# Create the directory to store the configuration file.
mkdir -p /etc/systemd/system/docker.service.d
# Create a new file to store the daemon options.
nano /etc/systemd/system/docker.service.d/options.conf
# Now make it look like this and save the file when you’re done:
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H unix:// -H tcp://0.0.0.0:2375
# Reload the systemd daemon.
systemctl daemon-reload
# Restart Docker.
systemctl restart docker
https://nickjanetakis.com/blog/docker-tip-73-connecting-to-a-remote-docker-daemon
https://en-designetwork.daichi703n.com/entry/2018/05/02/docker-network-vlan-tag
https://stackoverflow.com/a/20686101
docker inspect -f ‘{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}’ container_name_or_id
nano /etc/init.d/script.sh
#!/bin/sh
perl /path/to/foobar.pl
chmod +x /etc/init.d/script.sh
sudo update-rc.d script.sh defaults
https://askubuntu.com/a/1226
du -hs /path/to/directory
cd to dir which size you want to know
du -chd 1 | sort -h (1 – subdirs shown in output, size output value not affected when changing)
df -h
Interesting utulity showing extended info about disk usage:
https://dev.yorhel.nl/ncdu
fdisk -l
su USERNAME
Example:
sleep .5 # Waits 0.5 second.
sleep 5 # Waits 5 seconds.
sleep 5s # Waits 5 seconds.
sleep 5m # Waits 5 minutes.
sleep 5h # Waits 5 hours.
sleep 5d # Waits 5 days.
One can also employ decimals when specifying a time unit; e.g. sleep 1.5s
https://stackoverflow.com/questions/21620406/how-do-i-pause-my-shell-script-for-a-second-before-continuing
grep -a “WORD-WE-NEED” /var/log/some.log
watch -n 1 cat /var/log/some-status.log
https://ph0en1x.net/102-linux-cpu-stress-test-load-cores-tools.html
yes > /dev/null
cat /dev/null > ~/.bash_history && history -c
https://askubuntu.com/a/192001
Prepare smaller VMDK
Stop original VM and copy VMDK in case of something going wrong to a safe place
Connect both old large and new small to a fresh created Ubuntu VM
Decrease old partition to fit new disk
Delete swap partition from original disk
Copy decreased partition with data to a new disk using dd: dd if=/dev/sdb of=/dev/sdc status=progress
Create swap partition on the new small disk and set it’s type as swap
Connect new small VMDK to original VM
Create swap file:
mkswap /dev/sda2
fallocate -l 512M /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
swapon --show
free -h
Discover current swap partition’s UUID by typing blkid
Setting new swap partition’s UUID in /etc/fstab.
Test how VM is running
If everyting is OK delete old original VMDK and it’s copy
Change swapfile size:
swapoff -a
rm -rf /swapfile
fallocate -l 512M /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
swapon --show
free -h
Check fstab for correct swap file record:
cat /etc/fstab
Add swap file if no relevant found in fstab:
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
Very useful swap file configuration:
https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04
https://linuxhint.com/use-nmap-scan-subnet/
nmap -sP 192.168.0.1/24
https://www.cyberciti.biz/faq/can-i-delete-var-cache-apt-archives-for-ubuntu-debian-linux/
Cache is located in /var/cache/apt/archives
apt-get clean
apt-get autoremove
rm -rf /var/lib/apt/lists/*
apt-get update -y
ls -l /var/cache/apt/archives
apt-get install ncdu
or
apt-get install gt5
https://stackoverflow.com/a/2853843
#!/bin/bash
set -x #echo on
ls $PWD
https://rus-linux.net/MyLDP/consol/dengeros-commands-linux.html
https://oss-it.ru/233
Хорошо объяснено
Быстро и просто:
https://itfollow.ru/ubuntu-nastroika-samba-server/
Для интереса можно почитать более сложную настройку:
https://help.ubuntu.ru/wiki/
How to redirect HTTP requests to HTTPS:
Example 2 – specific url:
$HTTP[“scheme”] == “httpss” {
$HTTP[“host”] =~ “.*” {
url.redirect = (“^/phpmyadmin/.*” => “https://%0$0”)
}
}
If you need it only for a specific directory or directories, use conditionals:
$HTTP[“url”] =~ “^/download($|/)” {
dir-listing.activate = “enable”
}
URL Rewrites with regular expressions:
Regular Expressions
Patterns (“wildcards”) are matched against a string
Special characters (see [https://www.regular-expressions.info/reference.html] for reference):
. (full stop) – match any character
\* (asterisk) – match zero or more of the previous symbol
\+ (plus) – match one or more of the previous symbol
? (question) – match zero or one of the previous symbol
\\? (backslash-something) – match special characters
^ (caret) – match the start of a string
$ (dollar) – match the end of a string
[set] – match any one of the symbols inside the square braces.
[^set] – match any symbol that is NOT inside the square braces.
(pattern) – grouping, remember what the pattern matched as a special variable
{n,m} – from n to m times matching the previous character (m could be omitted to mean >=n times)
(?!expression) – match anything BUT expression at the current position. Example: “^(/(?!(favicon.ico$|js/|images/)).*)” => “/fgci/$1”
Normal alphanumeric characters are treated as normal
Protect Different Directories With Different Password Files:
$HTTP[“url”] =~ “^/docs/” {
auth.backend = “plain”
auth.backend.plain.userfile = “/home/lighttpssd/.lighttpssdpassword-DOCS”
auth.require = ( “/docs/” =>
(
“method” => “basic”,
“realm” => “Password protected area”,
“require” => “user=tom”
)
)
}