openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt
Monthly Archives: March 2023
Convert OpenVZ to LXC
Convert OpenVZ VM to LXC VM
Install same version lxc OS
lxc launch ubuntu:20.04 lxc-server
lxc stop lxc-server
rm -rf /var/snap/lxd/common/lxd/storage-pools/default/containers/lxc-server/rootfs
mkdir /var/snap/lxd/common/lxd/storage-pools/default/containers/lxc-server/rootfs
On Ubuntu 20.04 OpenVZ VM run:
rsync -avz -e ssh --exclude=etc/inittab --exclude=etc/network/interfaces --exclude=dev/ --exclude=sys/ --exclude=proc/ / [email protected]:/var/snap/lxd/common/lxd/storage-pools/default/containers/lxc-server/rootfs/
vim /var/snap/lxd/common/lxd/storage-pools/default/containers/lxc-server/rootfs/etc/network/interfaces
auto lo
iface lo inet loopback
source /etc/network/interfaces.d/*.cfg
mkdir /var/snap/lxd/common/lxd/storage-pools/default/containers/lxc-server/rootfs/etc/network/interfaces.d/
vim /var/snap/lxd/common/lxd/storage-pools/default/containers/lxc-server/rootfs/etc/network/interfaces.d/eth0.cfg
# The primary network interface
auto eth0
iface eth0 inet dhcp
lxc start lxc-server
For sure you need to stop MySQL/PostgreSQL before rsync or if huge database you can resync database after syncing data from OpenVZ server
apt install keep skip alternatives
To keep php7.2 default
before apt change priority value 72 -> 92 to keep this value biggest
/var/lib/dpkg/alternatives/php
/var/lib/dpkg/alternatives/php-fpm.sock
update-alternatives --query php
Name: php
Link: /usr/bin/php
Slaves:
php.1.gz /usr/share/man/man1/php.1.gz
Status: auto
Best: /usr/bin/php7.2
Value: /usr/bin/php7.2
Alternative: /usr/bin/php7.2
Priority: 92
Slaves:
php.1.gz /usr/share/man/man1/php7.2.1.gz
Alternative: /usr/bin/php7.4
Priority: 74
Slaves:
php.1.gz /usr/share/man/man1/php7.4.1.gz
nameserver 127.0.0.53 not working
iptables -t nat -I POSTROUTING 1 ! -o lo -j MASQUERADE
iptables -t nat -D POSTROUTING -j MASQUERADE
exclude local interface should fix systemd-resolved
sed extract single table from mysqldump
grep -n "Table structure" database.sql sed -n '[starting_line_number],[ending_line_number] p' database.sql.sql > database_one_table.sql
zabbix [113] No route to host
systemctl stop firewalld.service
elasticsearch cluster.routing.allocation.disk.watermark.low
curl -X PUT "localhost:9200/_cluster/settings?pretty" -H 'Content-Type: application/json' -d ' { "transient": { "cluster.routing.allocation.disk.watermark.low": "90%", "cluster.routing.allocation.disk.watermark.high": "95%", "cluster.routing.allocation.disk.watermark.flood_stage": "98%" } } '
change nameserver 127.0.0.53
rm -f /etc/resolv.conf
ln -sv /run/systemd/resolve/resolv.conf /etc/resolv.conf
SSH Received disconnect from 192.168.0.100 port 22:2: Too many authentication failures
ssh -o IdentitiesOnly=yes 192.168.0.100