Install Cockpit on Debian 13 trixie

Cockpit provides an easy-to-use, web-based interface for administering Linux systems. It simplifies tasks such as monitoring logs, controlling system services, configuring networks, and managing virtual machines.

Cockpit has been described as a “useful and extensible tool to observe, manage, and troubleshoot Linux servers“.

Step 1

cockpit requires the use of the firewalld service to be able to make changes to your firewall rules.

If you are using ufw as a host-based firewall

Remove ufw before replacing it with firewalld.

$ sudo apt-get remove --purge --yes ufw

[sudo] password for yourusername:

Install firewalld as a host-based firewall

Install firewalld and maintain ssh access as well as enabling cockpit to receive incoming connections.

$ sudo -- bash -c 'apt-get install --show-progress --yes firewalld && systemctl enable --now firewalld.service && firewall-cmd --zone=public --add-service=ssh --permanent && firewall-cmd --zone=public --add-service=cockpit --permanent && firewall-cmd --reload && firewall-cmd --info-zone=public'

Step 2

Proceed to install cockpit and selected add-on applications.

$ sudo apt-get install --show-progress --yes cockpit cockpit-bridge cockpit-machines cockpit-podman nullmailer ssh tuned-utils

Step 3

If you selected a wireless interface as the primary network interface for use during installation of the Debian system, you may need to re-establish connection to the wireless network after rebooting.

Enable NetworkManager for the primary network interface and reboot your system.

$ sudo sed -i 's/managed=false/managed=true/' /etc/NetworkManager/NetworkManager.conf&&sudo sed -i '/# The primary network interface/,$d' /etc/network/interfaces && sudo reboot

Step 4

Access the Cockpit web console on https://localhost:9090 by entering your username and password.

Step 5

By default, the Cockpit web console listens on port 9090 for connections. If you want to make changes from the default, use the following command to edit /etc/systemd/system/cockpit.socket.d/override.conf.

$ sudo systemctl edit cockpit.socket

The example below changes the web console port from 9090 to 9091 and restricts access to the localhost only.

### Editing /etc/systemd/system/cockpit.socket.d/override.conf
### Anything between here and the comment below will become the new contents of the file

[Socket]
ListenStream=
ListenStream=127.0.0.1:9091

### Edits below this comment will be discarded

Use the following command for your changes to take effect.

$ sudo -- bash -c 'systemctl daemon-reload && systemctl restart cockpit.socket && systemctl status cockpit.socket'

Configure nullmailer with a relay host

If you wish to receive status updates from your Debian or Ubuntu system, you need to install and configure a mail transfer agent (MTA). nullmailer is a relay-only forwarding MTA that can be used as an alternative to more complex MTAs, such as Exim, Sendmail or Postfix.

A relay host, also referred to as a smarthost, can be defined as an email server for outgoing mail that is being afforded a good reputation by its peers. In this example, we use Fastmail because email deliverability depends on a number of different factors.

Configuration of nullmailer with Email Service Providers (ESPs) other than Fastmail should be similar, given that all ESPs implement the Simple Mail Transfer Protocol (SMTP).

Step 1

Generate an app password

Log into your Fastmail account and set up a new app password for SMTP authentication.

Create an alias

Set up a dedicated Fastmail alias to receive incoming messages.

Step 2

Use copy and paste to enter the following commands. Be careful not to miss any punctuation.

Create the new directory /etc/nullmailer and the file /etc/nullmailer/adminaddr.

$ sudo mkdir /etc/nullmailer && sudo nano /etc/nullmailer/adminaddr

The Fastmail alias you created in Step 1 should be the only entry in /etc/nullmailer/adminaddr.

target.email@fastmail.com

Step 3

Install the required packages.

$ sudo apt-get install --yes nullmailer mailutils

Step 4

Enter the system mailname. If you are setting up on a home network, you should use home.arpa as the domain name.

Configuring nullmailer

Mailname of your system:

tux.home.arpa

Ok

Configuring the smarthost

Configure nullmailer to use the Fastmail SMTP server as a smarthost. Use your Fastmail username and the app password from Step 1.

Configuring nullmailer

Smarthosts:

smtp.fastmail.com smtp --port=587 --auth-login --starttls --user=linus.torvalds@fastmail.com --pass=password

Ok

Step 5

Test your configuration with the following command.

$ echo "Test mail from nullmailer on tux.home.arpa to the local root user and forwarded on to Fastmail" | mail -s "Test nullmailer" root

Check your inbox!

Step 6

You can reconfigure nullmailer at any time by issuing the following comand.

$ sudo dpkg-reconfigure nullmailer

Codes we live by: Alex Klein at TEDxTeen 2014


Playing this video requires sharing information with Google. Read the privacy policy

“What you can do with a computer is incredible, because you don’t use it like a tool, you use it like a part of yourself.”

Alex Klein

Click to copy