Linux: Unterschied zwischen den Versionen
| (26 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 5: | Zeile 5: | ||
=== Installation === | === Installation === | ||
==== Grundlegendes ==== | |||
<syntaxhighlight lang="bash"> | |||
apt update && apt upgrade -y | |||
apt install qemu-guest-agent putty nmap iptables net-tools wget cron dialog nano curl bash sudo npm cifs-utils keyutils gnupg2 git apache2-utils samba libasound2 libasound2-data software-properties-common build-essential libxml2-dev bzip2 bsdutils libpcre3 mailutils file gzip unzip bsdmainutils util-linux ca-certificates binutils bc tmux toilet figlet apt-transport-https jq lib32stdc++6 libjq1 libonig5 -y | |||
journalctl --vacuum-size=100M | |||
</syntaxhighlight> | |||
====Crontab==== | |||
<syntaxhighlight lang="bash"> | |||
0 8 * * * journalctl --vacuum-time=7d #Um 8 Uhr /var/log/journal aufräumen | |||
0 7 * * * apt update && apt upgrade -y #Updates | |||
</syntaxhighlight> | |||
====Netzwerk==== | |||
<syntaxhighlight lang="bash"> | |||
nano /etc/netplan/*.yaml | |||
network: | |||
version: 2 | |||
renderer: networkd | |||
ethernets: | |||
enp0s3: # replace with your network interface name | |||
dhcp4: no | |||
dhcp6: no | |||
addresses: | |||
- 192.168.1.12/24 | |||
- fe80::5054:ff:fef1:5a7a/64 | |||
gateway4: 192.168.1.1 | |||
gateway6: 2a00:6020:1000:50::2fe1 | |||
nameservers: | |||
addresses: | |||
- 192.168.1.14 | |||
- 192.168.1.1 | |||
- 2001:4860:4860::8888 # Google's IPv6 DNS | |||
- 2001:4860:4860::8844 | |||
search: | |||
- fritz.box | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="bash"> | |||
netplan generate | |||
netplan try -timeout 30 | |||
</syntaxhighlight> | |||
====Hostname==== | |||
hostnamectl set-hostname host.fqdn.tld | |||
====Cockpit==== | |||
<syntaxhighlight lang="bash"> | |||
cat /etc/os-release | |||
apt install -t ${VERSION_CODENAME}-backports cockpit | |||
</syntaxhighlight> | |||
Aufruf mit https://localhost:9090 | |||
=== Konfiguration === | === Konfiguration === | ||
==== Zugriff auf sudo gewähren ==== | |||
<syntaxhighlight lang="bash"> | |||
visudo | |||
www-data ALL=(ALL) NOPASSWD: /sbin/iptables -L -n | |||
</syntaxhighlight> | |||
Gewährt dem User www-data Zugriff auf /sbin/iptables -L -n | |||
==== Emails versenden ==== | ==== Emails versenden ==== | ||
Prüfen<syntaxhighlight lang="bash"> | Prüfen<syntaxhighlight lang="bash"> | ||
| Zeile 13: | Zeile 67: | ||
</syntaxhighlight>Einrichten<syntaxhighlight lang="bash"> | </syntaxhighlight>Einrichten<syntaxhighlight lang="bash"> | ||
https://www.cloudsigma.com/installing-and-configuring-postfix-as-a-send-only-smtp-server-on-ubuntu-20-04/ | https://www.cloudsigma.com/installing-and-configuring-postfix-as-a-send-only-smtp-server-on-ubuntu-20-04/ | ||
</syntaxhighlight> | |||
====Swapfile anlegen ==== | |||
<syntaxhighlight lang="bash"> | |||
fallocate -l 4G /swapfile | |||
chmod 600 /swapfile | |||
mkswap /swapfile | |||
swapon /swapfile | |||
echo >> /etc/fstab "/swapfile swap swap defaults 0 0" | |||
sysctl vm.swappiness=10 | |||
</syntaxhighlight> | |||
====SWAP File löschen==== | |||
<syntaxhighlight lang="bash"> | |||
nano /etc/fstab | |||
swapoff -v /swap.img oder swapoff -a | |||
rm /swap.img | |||
</syntaxhighlight> | </syntaxhighlight> | ||
====Swapfile vergrößern==== | ====Swapfile vergrößern==== | ||
count=8 bedeutet es wird 8x1GB vergrößert<syntaxhighlight lang="bash"> | count=8 bedeutet es wird 8x1GB vergrößert | ||
<syntaxhighlight lang="bash"> | |||
swapon --show | |||
swapoff /swapfile | swapoff /swapfile | ||
dd if=/dev/zero of=/swapfile bs=1G count=8 oflag=append conv=notrunc | dd if=/dev/zero of=/swapfile bs=1G count=8 oflag=append conv=notrunc | ||
| Zeile 22: | Zeile 95: | ||
swapon /swapfile | swapon /swapfile | ||
</syntaxhighlight> | </syntaxhighlight> | ||
====Volume vergrößern==== | |||
<syntaxhighlight lang="bash"> | |||
lvs | |||
vgs | |||
lvresize -r -v -L +10g /dev/mapper/vvg_shc_stua9726_misc01-shared | |||
</syntaxhighlight> | |||
ODER | |||
<syntaxhighlight lang="bash"> | |||
growpart /dev/sda 1 | |||
resize2fs /dev/sda1 | |||
</syntaxhighlight> | |||
====Festplatte vergrößern==== | |||
<syntaxhighlight lang="bash"> | |||
Libvirt: | |||
qemu-img resize ARK.qcow2 +10G | |||
virt-resize –expand /dev/vda3 undercloud-orig.qcow2 undercloud.qcow2 | |||
in VM: | |||
fdisk /dev/vda | |||
p | |||
w | |||
reboot now | |||
resize2fs /dev/vda3 | |||
ODER | |||
lvs | |||
vgs | |||
lvextend -L +1G /dev/mapper/ubuntu--vg-ubuntu--lv -r | |||
lvresize -r -v -L +5G /sybase/SOL/sybsystem | |||
</syntaxhighlight> | |||
====Neue Festplatte mounten==== | |||
<syntaxhighlight lang="bash"> | |||
lsblk | |||
fdisk -l | |||
fdisk /dev/sdb | |||
n | |||
p | |||
w | |||
mkfs.ext4 /dev/sdb1 | |||
blkid /dev/sdb1 | |||
echo >> /etc/fstab "UUID=8C296B72-0C8B-4A06-BE21-9205F7E2C5A5 /mnt/Archiv ntfs defaults 0 0" | |||
mkdir /MOUNTNAME | |||
chmod 777 /MOUNTNAME | |||
mount -a | |||
</syntaxhighlight> | |||
===== Benutzer einer Gruppe hinzufügen ===== | |||
<syntaxhighlight lang="bash"> | |||
usermod -aG {Gruppenname} {Benutzername} | |||
</syntaxhighlight> | |||
=== SLES Update === | |||
Im Suse Manager die Repositorys einstellen und kurz warten. Anschließend mit zypper lr prüfen, ob die aktuellen Channel schon aktualisiert worden sind. | |||
<syntaxhighlight lang="bash"> | |||
zypper lr | |||
zypper update | |||
</syntaxhighlight> | |||
Anschließden neu starten | |||
<syntaxhighlight lang="bash"> | |||
sudo reboot | |||
</syntaxhighlight> | |||
Im Infotool die aktuelle SLES Version eintragen | |||
===Test=== | ===Test=== | ||
| Zeile 27: | Zeile 162: | ||
===Codeschnipsel=== | ===Codeschnipsel=== | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Nützliche Links=== | ===Nützliche Links=== | ||
Aktuelle Version vom 13. Dezember 2024, 12:46 Uhr
Beschreibung
Linux ist ein kostenloses und Open-Source-Betriebssystem, das auf der Unix-Philosophie basiert. Es wurde von Linus Torvalds entwickelt und wird von einer großen Community von Entwicklern auf der ganzen Welt unterstützt. Linux ist bekannt für seine Stabilität, Sicherheit, Flexibilität und Skalierbarkeit und wird in verschiedenen Anwendungen eingesetzt, von Desktop-Computern und Servern bis hin zu mobilen Geräten, eingebetteten Systemen und Supercomputern. Es gibt viele verschiedene Distributionen von Linux, wie zum Beispiel Ubuntu, Fedora, Debian und viele mehr, die jeweils ihre eigenen Schwerpunkte und Funktionen haben.
Download
Installation
Grundlegendes
apt update && apt upgrade -y
apt install qemu-guest-agent putty nmap iptables net-tools wget cron dialog nano curl bash sudo npm cifs-utils keyutils gnupg2 git apache2-utils samba libasound2 libasound2-data software-properties-common build-essential libxml2-dev bzip2 bsdutils libpcre3 mailutils file gzip unzip bsdmainutils util-linux ca-certificates binutils bc tmux toilet figlet apt-transport-https jq lib32stdc++6 libjq1 libonig5 -y
journalctl --vacuum-size=100MCrontab
0 8 * * * journalctl --vacuum-time=7d #Um 8 Uhr /var/log/journal aufräumen
0 7 * * * apt update && apt upgrade -y #UpdatesNetzwerk
nano /etc/netplan/*.yaml
network:
version: 2
renderer: networkd
ethernets:
enp0s3: # replace with your network interface name
dhcp4: no
dhcp6: no
addresses:
- 192.168.1.12/24
- fe80::5054:ff:fef1:5a7a/64
gateway4: 192.168.1.1
gateway6: 2a00:6020:1000:50::2fe1
nameservers:
addresses:
- 192.168.1.14
- 192.168.1.1
- 2001:4860:4860::8888 # Google's IPv6 DNS
- 2001:4860:4860::8844
search:
- fritz.boxnetplan generate
netplan try -timeout 30Hostname
hostnamectl set-hostname host.fqdn.tld
Cockpit
cat /etc/os-release
apt install -t ${VERSION_CODENAME}-backports cockpitAufruf mit https://localhost:9090
Konfiguration
Zugriff auf sudo gewähren
visudo
www-data ALL=(ALL) NOPASSWD: /sbin/iptables -L -nGewährt dem User www-data Zugriff auf /sbin/iptables -L -n
Emails versenden
Prüfen
which sendmailEinrichten
https://www.cloudsigma.com/installing-and-configuring-postfix-as-a-send-only-smtp-server-on-ubuntu-20-04/Swapfile anlegen
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo >> /etc/fstab "/swapfile swap swap defaults 0 0"
sysctl vm.swappiness=10SWAP File löschen
nano /etc/fstab
swapoff -v /swap.img oder swapoff -a
rm /swap.imgSwapfile vergrößern
count=8 bedeutet es wird 8x1GB vergrößert
swapon --show
swapoff /swapfile
dd if=/dev/zero of=/swapfile bs=1G count=8 oflag=append conv=notrunc
mkswap /swapfile
swapon /swapfileVolume vergrößern
lvs
vgs
lvresize -r -v -L +10g /dev/mapper/vvg_shc_stua9726_misc01-sharedODER
growpart /dev/sda 1
resize2fs /dev/sda1Festplatte vergrößern
Libvirt:
qemu-img resize ARK.qcow2 +10G
virt-resize –expand /dev/vda3 undercloud-orig.qcow2 undercloud.qcow2
in VM:
fdisk /dev/vda
p
w
reboot now
resize2fs /dev/vda3
ODER
lvs
vgs
lvextend -L +1G /dev/mapper/ubuntu--vg-ubuntu--lv -r
lvresize -r -v -L +5G /sybase/SOL/sybsystemNeue Festplatte mounten
lsblk
fdisk -l
fdisk /dev/sdb
n
p
w
mkfs.ext4 /dev/sdb1
blkid /dev/sdb1
echo >> /etc/fstab "UUID=8C296B72-0C8B-4A06-BE21-9205F7E2C5A5 /mnt/Archiv ntfs defaults 0 0"
mkdir /MOUNTNAME
chmod 777 /MOUNTNAME
mount -aBenutzer einer Gruppe hinzufügen
usermod -aG {Gruppenname} {Benutzername}SLES Update
Im Suse Manager die Repositorys einstellen und kurz warten. Anschließend mit zypper lr prüfen, ob die aktuellen Channel schon aktualisiert worden sind.
zypper lr
zypper updateAnschließden neu starten
sudo rebootIm Infotool die aktuelle SLES Version eintragen