Skip to main content

Primary links

  • Home
  • AI
  • Kubernetes
  • Incus
  • Ansible
  • Terraform
  • OpenStack
  • Virtualization
  • Linux
  • SmartHome
  • HowTo

Misc

  • Linux
  • Hardware
  • Programming
  • Databases
  • Multimedia
  • Windows

Cloud

  • OpenStack
  • cloud-config
  • nextcloud

Virtualization

  • Virtualization
  • Incus
  • Docker
  • KVM
  • Kubernetes
  • LXC
  • LXD
  • QEMU
  • VMware
  • VirtualBox
  • multipass
  • podman
  • vagrant
  • XEN

Network

  • DNS
  • Firewall
  • Linux
  • OpenvSwitch
  • SSL
  • VLAN
  • VPN
  • iPXE
  • namespaces
  • nmcli
  • tcpdump

Storage

  • CEPH
  • DRBD
  • LVM
  • S3
  • ZFS
  • btrfs

Automation / CI/CD

  • Install
  • Ansible
  • GitLab
  • LLM
  • Preseed
  • Puppet
  • Terraform
  • Ubuntu autoinstall

Monitoring / Visualisation

  • Grafana
  • Icinga
  • Prometheus
  • Monitoring
  • ELK
  • mermaid

WordPress

OPTIONAL: Create LXD container

lxc launch ubuntu-minimal:lts wordpress
lxc shell wordpress

Ubuntu package
https://ubuntu.com/tutorials/install-and-configure-wordpress#1-overview

sudo apt update
sudo apt install -y apache2 ghostscript libapache2-mod-php mysql-server php php-bcmath php-curl php-imagick php-intl php-json php-mbstring php-mysql php-xml php-zip apg vim

rm /var/www/html/index.html

sudo chown www-data: /var/www/html
curl https://wordpress.org/latest.tar.gz | sudo -u www-data tar zx -C /var/www/html


cat</etc/apache2/sites-available/wordpress.conf

        DocumentRoot /var/www/html/wordpress

            Options FollowSymLinks
            AllowOverride Limit Options FileInfo
            DirectoryIndex index.php
            Require all granted


            Options FollowSymLinks
            Require all granted


EOF

sudo a2ensite wordpress
sudo a2enmod rewrite
sudo a2dissite 000-default
sudo service apache2 reload


DB_PASS=$(apg -m 16 -n1)
WP_PHASE=$(apg -m 32 -n1)


cat < /tmp/wordpress.sql
CREATE DATABASE wordpress;
CREATE USER wordpress@localhost IDENTIFIED BY '${DB_PASS}';
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON wordpress.* TO wordpress@localhost;
FLUSH PRIVILEGES;
EOF

cat /tmp/wordpress.sql | sudo mysql --defaults-extra-file=/etc/mysql/debian.cnf


cd /var/www/html/wordpress
sudo -u www-data cp wp-config-sample.php wp-config.php

sudo -u www-data sed -i 's/database_name_here/wordpress/' wp-config.php
sudo -u www-data sed -i 's/username_here/wordpress/' wp-config.php
sudo -u www-data sed -i "s/password_here/${DB_PASS}/" wp-config.php
sudo -u www-data sed -i "s/put your unique phrase here/${WP_PHASE}/" wp-config.php

# OPTIONAL: enforce https
sed -i '2i\$_SERVER['HTTPS'] = 'on';\' wp-config.php

# Access the server under:
http://your_server/wordpress

OLD

cat < /etc/wordpress/config-localhost.php
<?php
define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpress');
define('DB_PASSWORD', 'yourpasswordhere');
define('DB_HOST', 'localhost');
define('WP_CONTENT_DIR', '/usr/share/wordpress/wp-content');
?>
EOF

ln -s /etc/wordpress/config-localhost.php /etc/wordpress/config-10.0.129.230.php

# Links
https://help.ubuntu.com/lts/serverguide/wordpress.html

Manual installation

DMA (Dragonfly Mail Agent)

# ansible role
https://github.com/panticz/ansible/tree/master/roles/dma

# preconfigure
echo "dma dma/relayhost string mail.example.com" | debconf-set-selections
echo "dma dma/mailname string $(hostname -f)" | debconf-set-selections

# install
apt-get install -y dma

# configure relayhost
echo "user|smarthost:password" >> /etc/dma/auth.conf

# send testmail
echo "This is a test message from ${USER}@$(hostname -f) at $(date)" | /usr/sbin/sendmail foo@exaple.com

Configuration files

# /etc/dma/dma.conf
AUTHPATH /etc/dma/auth.conf
SMARTHOST smtp.example.de
PORT 587
MAILNAME example.com
MASQUERADE foo@example.com
SECURETRANSFER
STARTTLS

# /etc/dma/auth.conf
foo@example.com|smtp.example.com:pass1234

view log

journalctl _COMM=sendmail -f

Fix on wheezy

echo "deb http://archive.debian.org/debian squeeze main" > /etc/apt/sources.list.d/squeeze.list
apt-get update

Cleanup domain not found

for MAIL in $(grep "Domain not found" /var/log/mail.log | cut -d"<" -f2 | cut -d">" -f1 | sort -u); do
    for FILE in $(grep -l ${MAIL} /var/spool -r); do
        rm ${FILE}
    done
done

Links
https://wiki.mageia.org/en/Dma_Dragonfly_Mail_Agent

Journalctl

# display logs from current boot
journalctl -b

sudo journalctl --since yesterday
journalctl --since "2015-01-10" --until "2015-01-11 03:00"
journalctl --since 09:00 --until "1 hour ago"

journalctl -u ssh --since "2019-11-04"

journalctl -u nginx.service

# journals disc usage
sudo journalctl --disk-usage

# show errors
journalctl -p err -b
journalctl -p 3 -xb

# show dmesg
journalctl has a --dmesg

journalctl --disk-usage

# Clear systemd journals older than X days
journalctl --vacuum-time=31d

# Clear systemd journals if they exceed X storage
journalctl --vacuum-size=1G

# show NetworkManager logs
journalctl -u NetworkManager

# show cron logs
journalctl -f -u cron

Links
https://www.digitalocean.com/community/tutorials/how-to-use-journalctl-to-view-and-manipulate-systemd-logs
http://0pointer.de/blog/projects/journalctl.html
http://blog.delouw.ch/2013/07/24/why-journalctl-is-cool-and-syslog-will-survive-for-another-decade/

Use ecrypted home directory and sshuttle

sudo apt-get install -y ecryptfs-utils sshuttle
sudo adduser --encrypt-home foo

ecryptfs-mount-private foo

sudo usermod -aG sudo foo

su - foo
sshuttle --dns --remote foo@example.com 10.0.0.0/8 192.168.251.36/3 -x 192.168.179.0/24

LXC: Installation under Ubuntu / Debian

<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/install.lxc.sh";

echo "wget --no-check-certificate $URL -O - | bash -";
echo "<div><pre>";
</pre></div>

$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);

echo htmlspecialchars(curl_exec($c));

curl_close($c);

echo "";

?>

# install under Debian Jessie
apt-get install bridge-utils
wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/installit/master/install.lxc.sh -O - | bash -s -- -b

#wget http://mirrors.kernel.org/ubuntu/pool/main/l/lxc/lxc_1.0.7-0ubuntu0.2_amd64.deb -P /tmp/
#dpkg -x /tmp/lxc_1.0.7-0ubuntu0.2_amd64.deb /tmp/
#cp -a /tmp/etc/* /etc/

# Check kernel configuration

lxc-checkconfig

systemd

journalctl
http://www.panticz.de/journalctl

Services

# list services
service  --status-all
systemctl list-units --type service --state running,failed

# enable service
systemctl enable service_name
sudo systemctl enable --now service_name

# disable service
systemctl disable service_name

systemctl status mariadb.service

journalctl -f
systemd-analyze verify 

systemd-analyze critical-chain
systemctl list-units
systemctl list-unit-files --type=service

# override / edit job
systemctl edit cron.service
# systemd/system/cron.service.d/override.conf

# list reboots
journalctl --list-boots

# list dhcp client logs
sudo journalctl --since "7 days ago" -u dnsmasq-dhcp
sudo journalctl --since "7 days ago" | grep -i dhcp

# suspend system
sleep 10m && systemctl suspend

# Fix slow SSH login
systemctl restart systemd-logind

# restart user service
systemctl --user restart pulseaudio.service

# list all service names
systemctl list-units -t service --state active --no-pager --full --plain --no-legend "ceph*" | awk '/ceph-/ {print $1}'

Example
[embed_url: https://raw.githubusercontent.com/panticz/preseed/master/late_command.service]

# test
[Unit]
After=getty.target

[Service]
TTYPath=/dev/tty1

# test
journalctl -xn
systemctl list-unit-files --all

Disable systemd-resolved service

GitLab: Web-based Git repository manager

Install
http://www.panticz.de/install-gitlab

CLI

# restart gitlab
gitlab-ctl restart

# git home directory
/var/opt/gitlab

Reset admin password

# change root password
sudo gitlab-rails console
user = User.where(id: 1).first 
user.password = user.password_confirmation ='xxx' 
user.save!

Gitlab settings API

https://docs.gitlab.com/ee/api/settings.html
curl --header "PRIVATE-TOKEN: 11112222333344445555" https://gitlab.example.com/api/v4/application/settings

Disalbe register / Singup

sudo gitlab-rails console
ApplicationSetting.last.update_attributes(signup_enabled: false)

backup
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/raketasks/backup_restore.md

# full backup
gitlab-rake gitlab:backup:create

# backup without reposiories
sudo gitlab-rake gitlab:backup:create SKIP=repositories

# backup target
ls -l /var/opt/gitlab/backups

gitlab_rails['backup_keep_time'] = 604800

# backup to s3
gitlab_rails['artifacts_enabled'] = true
gitlab_rails['artifacts_object_store_enabled'] = true
gitlab_rails['artifacts_object_store_remote_directory'] = "artifacts"
gitlab_rails['artifacts_object_store_connection'] = {
  'provider' => 'AWS',
  'region' => 'foo-west-1',
  'aws_access_key_id' => '1111111111111111111111',
  'aws_secret_access_key' => '22222222222222222222222222222',
  'endpoint' => 'https://s3.example.com'
}

restore

sudo gitlab-rake gitlab:backup:restore force=yes
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/raketasks/backup_restore.md

Send email via SMTP
https://docs.gitlab.com/omnibus/settings/smtp.html
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/smtp.md

# /etc/gitlab/gitlab.rb
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.example.com"

# reconfigure GitLab
gitlab-ctl reconfigure

# send testmail
gitlab-rails console
Notify.test_email('foo@example.com', 'GitLab Test', 'Test message from GitLab server').deliver_now

Create backup

LXC: create Debian Jessie container

<?php
$URL="https://raw.githubusercontent.com/panticz/lxc/master/create.jessie.sh";

echo "wget -q --no-check-certificate $URL -O - | bash -s";
echo "<div><pre>";
</pre></div>

$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);

echo htmlspecialchars(curl_exec($c));

curl_close($c);

echo "";

?>

(re)create container

wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/lxc/master/create.jessie.sh -O - | bash -s -- -f

Allow root SSH login with password

CONTAINER=jessie
sudo lxc-attach -n ${CONTAINER} -- sed -i 's|PermitRootLogin without-password|PermitRootLogin yes|' /etc/ssh/sshd_config
sudo lxc-attach -n ${CONTAINER} -- service ssh restart

Fix DNS

echo nameserver 8.8.8.8 | sudo tee /var/lib/lxc/${CONTAINER}/rootfs/etc/resolv.conf

Default login credentials
user: root
pass: root

FixMe
"Failed to mount cgroup at /sys/fs/cgroup/systemd: Permission denied"
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1346734

Failed to open /dev/autofs: No such file or directory
Failed to initialize automounter: No such file or directory
[FAILED] Failed to set up automount Arbitrary Executable File Formats File System Automount Point.
See 'systemctl status proc-sys-fs-binfmt_misc.automount' for details.
Unit proc-sys-fs-binfmt_misc.automount entered failed state.

Socket service systemd-udevd.service not loaded, refusing.
[FAILED] Failed to listen on udev Kernel Socket.
See 'systemctl status systemd-udevd-kernel.socket' for details.
Socket service systemd-udevd.service not loaded, refusing.
[FAILED] Failed to listen on udev Control Socket.
See 'systemctl status systemd-udevd-control.socket' for details.

Bugs
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1347020
https://wiki.debian.org/LXC#Incompatibility_with_systemd

Fix DNS

Debian Jessie

<?php
$URL="https://raw.githubusercontent.com/panticz/lxc/master/create.jessie.sh";

echo "wget -q --no-check-certificate $URL -O - | bash -";
echo "<div><pre>";
</pre></div>

$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);

echo htmlspecialchars(curl_exec($c));

curl_close($c);

echo "";

?>

LXC: create Debian Wheezy container

<?php
$URL="https://raw.githubusercontent.com/panticz/lxc/master/create.wheezy.sh";

echo "wget -q --no-check-certificate $URL -O - | bash -";
echo "<div><pre>";
</pre></div>

$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);

echo htmlspecialchars(curl_exec($c));

curl_close($c);

echo "";

?>

(re)create container

wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/lxc/master/create.wheezy.sh -O - | bash -s -- -f

Default login credentials
user: root
pass: root

Fix DNS

echo nameserver 8.8.8.8 > /var/lib/lxc/${CONTAINER}/rootfs/etc/resolv.conf

Pagination

  • First page
  • Previous page
  • …
  • Page 24
  • Page 25
  • Page 26
  • Page 27
  • Page 28
  • Page 29
  • Page 30
  • Page 31
  • Page 32
  • …
  • Next page
  • Last page
Profiles GitHub StackOverflow LinkedIn Xing
Contact Imprint
© panticz 2026

Cookie-Einstellungen

Diese Website nutzt eingebettete Inhalte von Drittanbietern (z.B. YouTube, SoundCloud). Beim Laden dieser Inhalte werden Daten an die jeweiligen Anbieter übermittelt. Datenverarbeitungserklärung