Linux for Operations
HOGENT toegepaste
informatica
Thomas Parmentier, Andy Van Maele, Bert Van Vreckem
2024-2025
/etc/httpd/
: configuratie Apache
/etc/httpd/conf/httpd.conf
/etc/httpd/conf.d/*.conf
/var/www/html/
: Apache DocumentRoot/var/log/httpd/
: logbestanden
access_log
error_log
$ sudo systemctl start mariadb
$ sudo systemctl enable mariadb
$ sudo systemctl start httpd
$ sudo systemctl enable httpd
start
: nu opstartenenable
: automatisch opstarten bij booten/var/www/html/info.php
Show sockets: ss
netstat
is obsolete, replaced by ss
netstat
uses /proc/net/tcp
ss
directly queries the kernelTask | Command |
---|---|
Show server sockets | ss -l ,
--listening |
Show TCP sockets | ss -t ,
--tcp |
Show UDP sockets | ss -u ,
--udp |
Show port numbers(*) | ss -n ,
--numeric |
Show process(†) | ss -p ,
--processes |
(*) instead of service names from /etc/services
(†) root permissions required
$ sudo ss -tlnp
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:* users:(("sshd",pid=1290,fd=3))
LISTEN 0 100 127.0.0.1:25 *:* users:(("master",pid=1685,fd=13))
LISTEN 0 128 :::80 :::* users:(("httpd",pid=4403,fd=4),("httpd",pid=4402,fd=4),("httpd",pid=4401,fd=4),("httpd",pid=4400,fd=4),("httpd",pid=4399,fd=4),("httpd",pid=4397,fd=4))
LISTEN 0 128 :::22 :::* users:(("sshd",pid=1290,fd=4))
LISTEN 0 100 ::1:25 :::* users:(("master",pid=1685,fd=14))
LISTEN 0 128 :::443 :::* users:(("httpd",pid=4403,fd=6),("httpd",pid=4402,fd=6),("httpd",pid=4401,fd=6),("httpd",pid=4400,fd=6),("httpd",pid=4399,fd=6),("httpd",pid=4397,fd=6))
Voorbeeld voor Apache:
$ sudo journalctl
$ sudo journalctl -u httpd
$ sudo journalctl -flu httpd
$ sudo tail -f /var/log/httpd/access_log
$ sudo tail -f /var/log/httpd/error_log
journalctl
journalctl
requires root permissions
adm
or
systemd-journal
/var/log/messages
(gone in Fedora!)/var/log/httpd/access_log
and
error_log
Action | Command |
---|---|
Show latest log and wait for changes | journalctl -f ,
--follow |
Show only log of SERVICE | journalctl -u SERVICE ,
--unit=SERVICE |
Match executable,
e.g. dhclient |
journalctl /usr/sbin/dhclient |
Match device node,
e.g. /dev/sda |
journalctl /dev/sda |
Show auditd logs | journalctl _TRANSPORT=audit |
Action | Command |
---|---|
Show log since last boot | journalctl -b ,
--boot |
Kernel messages (like
dmesg ) |
journalctl -k ,
--dmesg |
Reverse output (newest first) | journalctl -r ,
--reverse |
Show only errors and worse | journalctl -p err ,
--priority=err |
Since yesterday | journalctl --since=yesterday |
Filter on time (example):
journalctl --since=2018-06-00 \
--until="2018-06-07 12:00:00"
Much more options in the man-page!
ip a
Hou je wachtwoorden goed bij!
$ mysql -uroot -pR2rrbLV02TA1hAjN mysql
...
MariaDB [mysql]> SHOW DATABASES;
MariaDB [mysql]> SELECT user,password from user;
MariaDB [mysql]> quit
-uroot
: inloggen als MariaDB-root-pR2rrbLV02TA1hAjN
: gekozen wachtwoord
-p
)mysql
: inloggen op database mysql