Ubuntu ist eine weit verbreitete und relativ einfach handhabbare Version von Linux.
!!!Hostname ändern
Der Hostname ist in /etc/hosts und /etc/hostname gespeichert. Nach dem Ändern kann er mit dem Kommando hostname -F /etc/hostname neu eingelesen werden.
!!!Netzwerk
Es existieren einige Mechanismen in [Ubuntu] um das Netzwerk zu steuern.
!!DNS Server
Die DNS-Server stehen eigentlich in /etc/resolv.conf. Ubuntu bringt allerdings sein eigenes System mit, das die Datei überschreibt. Die Einträge stehen daher unter /etc/network/interfaces:
{{{
dns-nameservers <ip1> <ip2> [...]
}}}
Seit Ubuntu 18.4 wird systemd-resolved verwendet:
{{{
systemd-resolve --set-dns=<DNS> --interface=<IF>
}}}
__Hinweis:__ IF ist das Interface, oft eth0, abrufbar mit "ip a"
__Siehe:__ [https://wiki.ubuntuusers.de/DNS-Konfiguration/], [https://wiki.archlinux.org/index.php/Systemd-resolved]
!!DNS Deaktivieren
Möchte man einen anderen DNS-Server installieren (ISC Bind), kann man den [systemd-resolve deaktivieren|https://askubuntu.com/questions/907246/how-to-disable-systemd-resolved-in-ubuntu]:
{{{
systemctl disable systemd-resolved.service
systemctl stop systemd-resolved
rm /etc/resolv.conf
}}}
__Hinweis:__ resolv.conf ist unter systemd-resolve ein symbolischer Link. Nach dem Löschen kann er durch eine richtige Datei ersetzt werden.
Unter /etc/NetworkManager/NetworkManager.conf nach [Main] dns=none eintragen und systemctl restart NetworkManager.
!!IP Konfiguration
Folgende Befehle sind zum Konfigurieren des IP Netzwerks:
{{{
networkctl
networkctl status docker0
ifconfig
ifconfig docker0
systemctl restart systemd-networkd
}}}
!!!IP Config
Ubuntu (min. ab Version 22) /etc/netplan/00-installer-config.yaml oder /etc/netplan/01-netcfg.yaml. Nach dem Editieren, kann der Netplan angewendet werden:
{{{
netplan apply
}}}
__Siehe:__ [https://linuxconfig.org/how-to-configure-static-ip-address-on-ubuntu-22-04-jammy-jellyfish-desktop-server]
!!!Remote Desktop Connection
Auch Linux kann Remote Desktop Connection (RDP) mit dem Windows Client herstellen. Dazu gibt es das fertige Script [http://c-nergy.be/blog/?p=12761] das die nötigen Änderungen vornimmt.
!!!Limits
Unter Linux gibt es verschiedene Limits.
Die Zahl der aktuellen Filehandles kann man abfragen:
{{{
lsof | wc -l
ulimit -n
}}}
Datei /etc/security/limits.conf:
{{{
* soft nofile 1000000
* hard nofile 1000000
root soft nofile 1000000
root hard nofile 1000000
* soft nproc 1000000
* hard nproc 1048576
root soft nproc 1000000
root hard nproc 1048576
* soft stack 1000000
* hard stack 1000000
root soft stack 1000000
root hard stack 1000000
* soft memlock 100000000
* hard memlock 100000000
root soft memlock 100000000
root hard memlock 100000000
}}}
In neueren Versionen muss offenbar noch /etc/pam.d/common-session bearbeitet werden:
{{{
session required pam_limits.so
}}}
!!Systemvariablen
Systemvariablen anzeigen: sysctl -a, sysctl <variable>
Systemvariablen temporär setzen: sysctl -w <variable>=<value>
Permanente Systemvariablen in /etc/sysctl.conf:
{{{
fs.file-max = 200000
}}}
Systemvariablen neu laden: sysctl -p
!!!Partitionieren
!!gparted
Die Festplatte kann mit "gparted" partitioniert werden. Falls gparted nicht installiert ist, mit
{{{
apt install gparted
}}}
installieren und dann einfach starten.
!!GPT-Disk partitionieren
Früher wurde MBR (Master Boot Record) verwendet, heute verwendet man GPT (GUID partition table). Auflisten mit sgdisk -p.
1. Partition mit sgdisk erstellen
2. Partition mit mkfs formatieren
3. Partition mit mount anmelden
{{{
sgdisk -n 2:4096:5119 -c 2:"Test" -t 2:9300 /dev/sda
mkfs -t ext4 /dev/sda2
mount -t auto /dev/sda2 /mnt
}}}
* [https://phoenixnap.com/kb/linux-format-disk]
* [https://wiki.ubuntuusers.de/gdisk/]
* [https://unix.stackexchange.com/questions/38164/create-partition-aligned-using-parted]
!!!SSH
Unter Ubuntu kann openssh installiert werden:
{{{
apt install openssh-server
}}}
Danach die Konfiguration anpassen:
{{{
nano /etc/ssh/sshd_config
}}}
Folgende Eintragungen vornehmen:
{{{
PermitRootLogin yes
StrictModes yes
HostbasedAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
UsePAM yes
AllowUsers root
}}}
Konfiguration neu einlesen:
{{{
service sshd restart
}}}
Mit "passwd" ein Unix-Passwort anlegen.
!!!Swap
Swap-File anzeigen:
{{{
ls -lh /swapfile
swapon --show
}}}
Swap-File erstellen:
{{{
free -h
fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
}}}
"/swapfile none swap sw 0 0" zu /etc/fstab hinzufügen.
!!!Update
Um die Softwarepakete und das System upzudaten gibt es eine Reihe von Kommandos:
{{{
apt update
apt upgrade
apt dist-upgrade
apt autoremove
}}}
!!!Links
* [firewalld|https://computingforgeeks.com/install-and-use-firewalld-on-ubuntu-18-04-ubuntu-16-04/]
* [Upgrade|https://linuxconfig.org/how-to-upgrade-ubuntu-to-20-04-lts-focal-fossa]
* [ulimit|https://medium.com/@muhammadtriwibowo/set-permanently-ulimit-n-open-files-in-ubuntu-4d61064429a]
* [limits|https://www.thegeekdiary.com/understanding-etc-security-limits-conf-file-to-set-ulimit/]
* [sysctl|https://wiki.manitu.de/index.php/Server:Sysctl-Variablen_(sysctl.conf)]
* [SSH|https://askubuntu.com/questions/497895/permission-denied-for-rootlocalhost-for-ssh-connection]
* [Permanent ulimit|https://muhammadtriwibowo.medium.com/set-permanently-ulimit-n-open-files-in-ubuntu-4d61064429a]
* [Swap|https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04-de]
* [Swap neu erstellen|https://askubuntu.com/questions/1264859/watchdog-bug-soft-lockup-cpu6-stuck-for-23s]