Debian: Difference between revisions

From 太極
Jump to navigation Jump to search
 
(23 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Debian vs Ubuntu =
[https://www.howtogeek.com/749045/debian-vs-ubuntu/ Debian vs. Ubuntu Linux: Which Distro Should You Choose?]
= Download Debian =
= Download Debian =
[https://dflinux.frama.io/thebeginnershandbook/lcdd05-installation/ The beginner's handbook]: a simplified manual to install and take-over the Debian system.
[https://dflinux.frama.io/thebeginnershandbook/lcdd05-installation/ The beginner's handbook]: a simplified manual to install and take-over the Debian system.
Line 24: Line 27:
== Debian 10 ==
== Debian 10 ==
[https://www.debian.org/releases/buster/amd64/release-notes/ch-whats-new.en.html#secure-boot What's new in Debian 10]
[https://www.debian.org/releases/buster/amd64/release-notes/ch-whats-new.en.html#secure-boot What's new in Debian 10]
== Debian-edu ==
* https://wiki.debian.org/DebianEdu/
* [https://blends.debian.org/edu/tasks/ Debian Edu Packages]: The Debian Edu Pure Blend contains 551 packages which are grouped by metapackages. Each metapackage will cause the installation of packages for a specific topic.
== Debian-mac ==
* https://wiki.debian.org/DebianMac Debian for use in Macintosh environments


== Kali linux ==
== Kali linux ==
Line 51: Line 61:
== Step-by-step installation ==
== Step-by-step installation ==
[https://ostechnix.com/install-debian/ How To Install Debian 11 Bullseye [A Step By Step Guide]], especially the '''Software Selection''' part.
[https://ostechnix.com/install-debian/ How To Install Debian 11 Bullseye [A Step By Step Guide]], especially the '''Software Selection''' part.
== Domain name and .local ==
* [https://superuser.com/a/902691 Correct domain name for a home desktop Linux machine]. Something like '''yoursurname.local''' may be the domain name. See a [https://www.linuxtechi.com/how-to-install-debian-12-step-by-step/ screenshot].
* If you want to use .local as your domain name, you should use local without the leading dot. The leading dot is used to indicate that the domain name is a top-level domain, but when configuring your network or system, you should use the domain name without the leading dot.
* https://en.wikipedia.org/wiki/.local
* [https://superuser.com/a/959223 How can I set up a 'local' domain so that everyone on my local network can view a locally hosted site?] the '''Avahi daemon''' to be the easiest way to do this.
* [[Raspberry#Assign_.local_domain_to_Raspberry_Pi|Raspberry Pi -> Assign .local domain to Raspberry Pi]]
* Port 5353 is used by [https://wiki.debian.org/Avahi Avahi daemon]


== Minimal Debian install ==
== Minimal Debian install ==
Line 57: Line 75:
* https://www.reddit.com/r/debian/comments/q9bz1l/minimal_install_with_some_sort_of_gui/
* https://www.reddit.com/r/debian/comments/q9bz1l/minimal_install_with_some_sort_of_gui/
* https://superuser.com/a/507254
* https://superuser.com/a/507254
== Network ==
<ul>
<li>https://wiki.debian.org/SystemdNetworkd
<li>The /etc/network/interfaces file can still be used in Debian 11 Bullseye for network configuration. However, it’s important to note that the use of this file has been somewhat deprecated in favor of newer methods like '''systemd-networkd'''.
<li>To configure DNS with `systemd-networkd` on your Debian 11 server, you need to create a network configuration file in the `/etc/systemd/network/` directory. Here's a step-by-step guide (Remember to replace the IP addresses and interface name with those of your own network configuration.):
<ol>
<li> '''Create a network configuration file''': You can name it based on your network interface. For example, if your network interface is `enp8s0`, you can create a file named '''enp8s0.network'''.
<li> '''Edit the configuration file''': Open the file with a text editor and add the following content (PS. 'Match' is a keyword):
<pre>
[Match]
Name=enp8s0
[Network]
Address=192.168.1.20/24
Gateway=192.168.1.1
DNS=192.168.1.1
</pre>
<li> '''Enable systemd-networkd''': After saving and closing the file, enable `systemd-networkd` with the following command:
<pre>
sudo systemctl enable systemd-networkd
</pre>
<li> '''Reboot your system''': Finally, reboot your system to apply the changes¹.
</ol>
<li>Recent versions of Ubuntu, specifically 17.10 and above, ado use '''systemd-netword''' as their default network configuration software. However, Ubuntu also uses a utility called NetworkManager. You can check which network service daemons are running with these commands:
<pre>
sudo service systemd-networkd status
sudo service network-manager status # before Ubuntu V21.10
sudo service NetworkManager status # after Ubuntu V21.10!
</pre>
'''systemd-networkd''' will only manage network addresses and routes for any link for which it finds a .network file with an appropriate [Match] section.
</ul>


= Post installation =
= Post installation =
* [https://averagelinuxuser.com/10-things-to-do-after-installing-debian/ 10 things to do AFTER Installing DEBIAN 9]
<ul>
* [https://www.linuxtechi.com/things-to-do-after-installing-debian-11/ Top 12 Things To Do After Installing Debian 11 (Bullseye)]
<li>[https://averagelinuxuser.com/10-things-to-do-after-installing-debian/ 10 things to do AFTER Installing DEBIAN 9]
 
<li>[https://www.how2shout.com/linux/2-ways-to-add-users-to-sudoers-group-in-debian-11/ 2 Ways to add users to sudoers group in Debian 11]
<pre>
su root
nano /etc/sudoers
# Add the following line
# NEWUSER ALL=(ALL:ALL) ALL
</pre>
<li>[https://www.linuxtechi.com/things-to-do-after-installing-debian-11/ Top 12 Things To Do After Installing Debian 11 (Bullseye)]
<pre>
<pre>
$ su - root
$ su - root
Line 68: Line 128:
# su - NEWUSER
# su - NEWUSER
$ sudo apt update
$ sudo apt update
</pre>
<li>[https://ostechnix.com/debian-server-post-installation-steps/ Debian 12 Server Setup: Essential Post-Installation Steps]
* Configure Software Repositories
* Upgrade Existing Packages
* Install sudo
* Create a New User and Add to sudo Group
* Set Up SSH Keys (Optional)
* Secure SSH
* Install Essential Packages - vim htop net-tools curl wget git
* Configure Time Synchronization
* Set Up a Firewall
* Enable Automatic Security Updates
* Set Up Fail2Ban (Optional)
* Additional Configuration
</ul>
== wifi driver ==
<ul>
<li>On my NUC8i5BEH, the wifi driver was not installed automatically. The wifi is [https://ark.intel.com/content/www/us/en/ark/products/126148/intel-nuc-kit-nuc8i5beh.html intel AC9560]. See [https://www.intel.com/content/www/us/en/support/articles/000005511/wireless.html Linux* Support for Intel® Wireless Adapters].
<li>https://wiki.debian.org/iwlwifi
<li>Instruction
* Modify /etc/apt/sources.list. On my Debian 11 (bullseye), I need to modify the first 2 lines to include "contrib non-free". This depends on the Debian version.
:<syntaxhighlight lang='bash'>
deb http://deb.debian.org/debian/ bullseye main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye main contrib non-free
</syntaxhighlight>
* Run the following lines
:<syntaxhighlight lang='bash'>
apt update; apt install firmware-iwlwifi'
modprobe -r iwlwifi ; modprobe iwlwifi
</syntaxhighlight>
* Now go to the GNOME settings. We should be able to see wifi non-connected.
</ul>
== Wireless hotspot ==
* [https://help.gnome.org/users/gnome-help/stable/net-wireless-adhoc.html.en Create a wireless hotspot] GNOME Help. Go to Settings -> Wi-Fi -> three dots -> Turn On Wi-Fi Hotspot.
* [https://computingforgeeks.com/create-wi-fi-hotspot-on-linux/ Create Wi-Fi Hotspot on Ubuntu / Debian / Fedora / CentOS / Arch]. '''nmcli''' utility was used.
== Auto suspend ==
[https://www.makeuseof.com/disable-auto-suspend-in-linux/ How to Disable Auto-Suspend in Linux]
== No poweroff, shutdown, reboot commands ==
* shutdown is just a symbolic link to systemctl, which "knows" that when it's invoked as shutdown should trigger the same actions as '''systemctl poweroff'''. Same for reboot/systemctl reboot. See [https://unix.stackexchange.com/a/682997 How to enable 'reboot' and 'shutdown' on a fresh debian install].
* The trick on how to fix this inconvenience is to explicitly tell the su to set environment variable as if the user logs in directly. This is can be done by "su -". See [https://superuser.com/a/1464976 Unable to shutdown / reboot my Debian 10 server]. On Debian 11, the poweroff command is under '''/usr/sbin''' directory.
== Backports and testing repositories ==
[https://ostechnix.com/enable-backports-and-testing-repositories-in-debian-linux/ How To Enable Backports And Testing Repositories In Debian 12]
= Install Desktop Environment =
[https://bytexd.com/how-to-install-gnome-desktop-environment-on-debian/ How to Install GNOME Desktop Environment on Debian 11]
<pre>
sudo tasksel
</pre>
</pre>


Line 78: Line 191:


Note that even we installed 'sudo', we can not use 'sudo' from the default user. It will complain '''xxx is not in the sudoers file. This incident will be reported.'''.
Note that even we installed 'sudo', we can not use 'sudo' from the default user. It will complain '''xxx is not in the sudoers file. This incident will be reported.'''.
= Change hostname =
This works on Debian 11/12, Ubuntu 22.04/24.04.
<ul>
<li>Check the current hostname
<pre>
hostnamectl  # show OS and Kernel too
</pre>
<li>Change the hostname. For example, to change the hostname to '''new-hostname''', run:
<pre>
sudo hostnamectl set-hostname new-hostname
</pre>
<li>Edit the '''/etc/hosts''' file. Find the line that looks like this:
<pre>
127.0.1.1    old-hostname
</pre>
Replace '''old-hostname''' with '''new-hostname''', then save and close the file.
<li>Reboot your system. '''sudo reboot'''
</ul>


= Debian root user from remote access =
= Debian root user from remote access =
Line 103: Line 235:
sudo bash ./VBoxLinuxAdditions.run
sudo bash ./VBoxLinuxAdditions.run
</pre>
</pre>
= System monitoring =
[https://www.rosehosting.com/blog/how-to-install-netdata-monitoring-tool-on-debian-12/ How to Install Netdata Monitoring Tool on Debian 12]


= Browse source code =
= Browse source code =
Line 112: Line 247:
= Proxy =
= Proxy =
[[File:Debianproxy.png|150px]]
[[File:Debianproxy.png|150px]]
= GlusterFS =
[https://www.howtoforge.com/how-to-install-glusterfs-on-debian-12/ How to Install a Three Node GlusterFS Cluster on Debian 12]
= Prometheus and Node Exporter =
[https://www.howtoforge.com/how-to-install-prometheus-and-node-exporter-on-debian-12/ How to Install Prometheus and Node Exporter on Debian 12]

Latest revision as of 08:09, 21 September 2024

Debian vs Ubuntu

Debian vs. Ubuntu Linux: Which Distro Should You Choose?

Download Debian

The beginner's handbook: a simplified manual to install and take-over the Debian system.

Debian: Enjoy One Of The Most Stable And Trusted Linux Distributions. . If you would rather download all necessary basic packages before starting the installation, you may need to look at downloading the “CD1” for your architecture instead.

Go to http://www.debian.org/distrib/ and download "Small CDs or USB sticks", for example debian-8.1.0-amd64-netinst.iso (Jessie, released June 2015). It is about 280 MB.

Screenshots of step-by-step installation can be found in here.

At the end of installation, it will offer a collection of software to install. Below 'Debian desktop environment', it has a selection of GNOME, Xface, KDE, Cinnamon, MATE and LXDE (new in Jessie/8.0). Note that the cd images download page only provides a selection of kde, lxde and xfce desktop. The default is 'GNOME' in Jessie.

DebianInstall.png

After installation, you got a desktop environment of Debian based on GNOME 3 (Virtual machine will use recovery mode, but still works. Some people suggest to install the guest additions (in the guest) and make sure that you enable the 3D acceleration in the guest settings.). Also 'free -m' command shows it uses 202 MB memory and the whole system takes up 3.3 GB. I am testing on a Chinese desktop environment.

When Debian is in recovery mode, the desktop interface is like old fashion. Application and Place on top of the screen. When GNOME 3 is working (in my test of Debian 7.1.0, I cannot run VBoxLinux.run, but it still works after I did other steps), the interface is sort of Ubuntu with application launched from the left hand side. It differs from Ubuntu because the side bar appears by clicking a 'preview' button on top left corner.

The default browser in Debian is Iceweasel with AdBlock Plus preinstalled.

I don't know why the default user does not have root privilege.

When I installed the Chinese version, the keyboard switch icon (SCIM) is automatically available. However once the desktop is in regular GNOME 3, the switch icon disappeared. Fortunately, we can use Ctrl + Space to switch languages. Thanks to the hint there.

Debian 10

What's new in Debian 10

Debian-edu

Debian-mac

Kali linux

Tails linux

The system is designed to be booted as a live DVD or live USB, and will leave no digital footprint on the machine unless explicitly told to do so.

It is hard to use: you don't have the 'sudo' password unless you pay attention to create one at the beginning of the first screen. You can't save file from the browser. It is slow to boot...

How hard it is to install Debian

Tested on Lenovo thinkpad t420s. When it is about to detect network hardware, it popped up a message:

Some of your hardware needs non-free firmware files to operate. The firmware can be loaded from removable media, such as a USB stick or floppy.

The missing firmware files are: iwlwifi-6000g2a-6.ucode iwlwifi-6000g2a-5.ucode.

See

Step-by-step installation

How To Install Debian 11 Bullseye [A Step By Step Guide], especially the Software Selection part.

Domain name and .local

Minimal Debian install

Network

  • https://wiki.debian.org/SystemdNetworkd
  • The /etc/network/interfaces file can still be used in Debian 11 Bullseye for network configuration. However, it’s important to note that the use of this file has been somewhat deprecated in favor of newer methods like systemd-networkd.
  • To configure DNS with `systemd-networkd` on your Debian 11 server, you need to create a network configuration file in the `/etc/systemd/network/` directory. Here's a step-by-step guide (Remember to replace the IP addresses and interface name with those of your own network configuration.):
    1. Create a network configuration file: You can name it based on your network interface. For example, if your network interface is `enp8s0`, you can create a file named enp8s0.network.
    2. Edit the configuration file: Open the file with a text editor and add the following content (PS. 'Match' is a keyword):
      [Match]
      Name=enp8s0
      
      [Network]
      Address=192.168.1.20/24
      Gateway=192.168.1.1
      DNS=192.168.1.1
      
    3. Enable systemd-networkd: After saving and closing the file, enable `systemd-networkd` with the following command:
      sudo systemctl enable systemd-networkd
      
    4. Reboot your system: Finally, reboot your system to apply the changes¹.
  • Recent versions of Ubuntu, specifically 17.10 and above, ado use systemd-netword as their default network configuration software. However, Ubuntu also uses a utility called NetworkManager. You can check which network service daemons are running with these commands:
    sudo service systemd-networkd status
    sudo service network-manager status # before Ubuntu V21.10
    sudo service NetworkManager status # after Ubuntu V21.10!
    

    systemd-networkd will only manage network addresses and routes for any link for which it finds a .network file with an appropriate [Match] section.

Post installation

wifi driver

  • On my NUC8i5BEH, the wifi driver was not installed automatically. The wifi is intel AC9560. See Linux* Support for Intel® Wireless Adapters.
  • https://wiki.debian.org/iwlwifi
  • Instruction
    • Modify /etc/apt/sources.list. On my Debian 11 (bullseye), I need to modify the first 2 lines to include "contrib non-free". This depends on the Debian version.
    deb http://deb.debian.org/debian/ bullseye main contrib non-free
    deb-src http://deb.debian.org/debian/ bullseye main contrib non-free
    • Run the following lines
    apt update; apt install firmware-iwlwifi'
    modprobe -r iwlwifi ; modprobe iwlwifi
    • Now go to the GNOME settings. We should be able to see wifi non-connected.

Wireless hotspot

Auto suspend

How to Disable Auto-Suspend in Linux

No poweroff, shutdown, reboot commands

Backports and testing repositories

How To Enable Backports And Testing Repositories In Debian 12

Install Desktop Environment

How to Install GNOME Desktop Environment on Debian 11

sudo tasksel

Server version

There is no a server version of iso to download. At the end of installation, it will ask what software to install: Debian desktop environment, Web server, SSH server, Laptop, SQL database, ... We can uncheck 'Debian desktop environment' item.

Compared to Desktop version, the server version takes 1.3GB space and 33MB memory.

The server version does not have 'sudo' command. Use 'su' to switch to 'root' user.

Note that even we installed 'sudo', we can not use 'sudo' from the default user. It will complain xxx is not in the sudoers file. This incident will be reported..

Change hostname

This works on Debian 11/12, Ubuntu 22.04/24.04.

  • Check the current hostname
    hostnamectl  # show OS and Kernel too
    
  • Change the hostname. For example, to change the hostname to new-hostname, run:
    sudo hostnamectl set-hostname new-hostname
    
  • Edit the /etc/hosts file. Find the line that looks like this:
    127.0.1.1    old-hostname
    

    Replace old-hostname with new-hostname, then save and close the file.

  • Reboot your system. sudo reboot

Debian root user from remote access

When you login by SSH, then use the username you have chosen when you installed Debian as the root user is disabled for remote logins. Then run the command "su" to become root user. See howtoforget.com.

Virtualbox guest addition installation

See Virtualbox -> Debian.

Browse iso files

Note that if we want to download the iso image, we should consider using the torrent method. The can see a variety of download options from

http://www.debian.org/CD/ > Downloading Debian CD/DVD images via HTTP/FTP

Permission denied

http://roger.steneteg.org/blog/virtualbox-guest-additions-on-debian/

The script uses /bin/sh as shell and on Debian Wheezy/Jessie /bin/sh is symlinked to /bin/dash. Dash is a more light-weight replacement for Bash, and it turns out that the VirtualBox script does not work as it should when run with "dash".

An easy workaround is to explicitly run the script with "bash" with the following command:

sudo bash ./VBoxLinuxAdditions.run

System monitoring

How to Install Netdata Monitoring Tool on Debian 12

Browse source code

Proxy

Debianproxy.png

GlusterFS

How to Install a Three Node GlusterFS Cluster on Debian 12

Prometheus and Node Exporter

How to Install Prometheus and Node Exporter on Debian 12