Installing Debian 10 (Buster) Minimum Server (page 2)

botond published 2019/11/05, k - 16:30 time

Content

  1. page: Download and install Debian 10 (Buster)
  2. page: Finish the installation and make the necessary settings

 

2. page content

 

Continuation

Az on the first page we have launched the Debian 10 (Buster) installer and done most of the installation, and on this page we complete the remaining steps and make the necessary command line settings so that our minimal server is ready for further server installations.

 

 

Finish installation

In this chapter, we'll walk you through the remaining steps of the setup program.

Configure Popularity-contest

The installer will ask you if you would like to participate in anonymous statistics into which the package information is used:

Install Debian 10 (Buster) Minimum Server - Configure Popularity-contest

Here we choose at our discretion.

Software choice

Here's where you decide which software and services you want to install on your system by default:

Installing Debian 10 (Buster) Minimum Server - Software Selection

Here we leave only the bottom two checked and later install the required packages manually.

The installer then loads the packages of the selected components ...

Installing Debian 10 (Buster) Minimum Server - Software Selection and Installation

Installing a Grub Boot Loader

You can choose which partition to put in GRUB:

Installing Debian 10 (Buster) Minimum Server - Installing Grub Bootloader

If the installation was done on a completely empty machine and there is no other operating system on it, GRUB must be installed in the master boot record. However, if you installed this Debian server with another operating system, you will have to decide which boot loader you want to use as a boot loader. In this case, of course, you still need to configure the boot loader you want to use, which is not part of this description.

So here you normally select Yes.

In the next window, select the appropriate partition (if there are more) in which you want to install GRUB in your MBR:

Installing Debian 10 (Buster) Minimum Server - The Grub boot loader installation location

Finish installation

We've finished the installation:

Installing Debian 10 (Buster) Minimum Server - Complete Installation

Remove the installation tool (bootable flash drive, installation DVD, virtual DVD, etc.) to stop the machine from starting.

The installer will then reboot the machine.

 

 

Boot System

The standard GRUB menu appears when you start:

Install Debian 10 (Buster) Minimum Server - Boot System

Select your newly installed system here.

After the startup, the login section comes in, so let's log in as root here, because we need to do the following:

Installing Debian 10 (Buster) Minimum Server - Root Login

 

Install and configure basic programs

Remote access for more convenient use

A VirtualBox using the console window is quite inconvenient even for using the command line (e.g. lack of clipboard, mouse actions, etc., for example in VirtualBox until the guest integration services are installed), so I move to the terminal window of my desktop environment and enter the virtual machine from there SSHthrough. This way I can easily use my machine's clipboard to copy or extract the necessary stuff from the terminal.

If we are similar to this, we must first find out about the virtual machine IP addresseswhat the router DHCP was handed out by his server. To do this, run the VirtualBox console ip command:

ip a

vagy

ip address

The command gives a similar output as ifconfig, for example, I would see:

Debian 10 (Buster) Minimum Server Configuration - Find IP Address

On the one hand, we can read the name of our network device, which is the case here enp0s3with an IP address 192.168.1.104. This is my first free IP address on the home network, so that's why I got it. Of course, this can be different in every network.

Accordingly, we can log in from any machine on the network to this virtual machine at this IP address because at the end of the installation we have configured to request the SSH server as well. If you had accidentally skipped the installation of the SSH server, you can still do so with the following command:

apt-get install openssh-server

You can then log in from any desktop terminal emulator, or in Windows putty program.

By default, you can only log on remotely with the regular user, and then you can obtain root access with the following command:

su -

You will be prompted for the root password.

So you can continue to configure it from the terminal as root.

Expanding libraries and updating packages

Let's expand it first APT repositories so that the packages that are the default are available for later server installations from trunks are not available. To do this, open the /etc/apt/sources.list file for editing:

nano /etc/apt/sources.list

By default, based on our installation, this content contains:

# 

# deb cdrom:[Debian GNU/Linux 10.1.0 _Buster_ - Official amd64 NETINST 20190908-01:07]/ buster main

#deb cdrom:[Debian GNU/Linux 10.1.0 _Buster_ - Official amd64 NETINST 20190908-01:07]/ buster main

deb http://deb.debian.org/debian/ buster main
deb-src http://deb.debian.org/debian/ buster main

deb http://security.debian.org/debian-security buster/updates main
deb-src http://security.debian.org/debian-security buster/updates main

# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ buster-updates main
deb-src http://deb.debian.org/debian/ buster-updates main

# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.

Let's expand this on contrib and the non-free allowing containers to look like this file:

# 

# deb cdrom:[Debian GNU/Linux 10.1.0 _Buster_ - Official amd64 NETINST 20190908-01:07]/ buster main

#deb cdrom:[Debian GNU/Linux 10.1.0 _Buster_ - Official amd64 NETINST 20190908-01:07]/ buster main

deb http://deb.debian.org/debian/ buster main contrib non-free
deb-src http://deb.debian.org/debian/ buster main contrib non-free

deb http://security.debian.org/debian-security buster/updates main contrib non-free
deb-src http://security.debian.org/debian-security buster/updates main contrib non-free

# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ buster-updates main contrib contrib non-free
deb-src http://deb.debian.org/debian/ buster-updates main contrib contrib non-free

# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.

Save and then update the luggage database and then the packages:

apt-get update
apt-get upgrade

 

 

Set Sudo

During normal use, we use our regular user to perform normal activities, and from time to time we may need root privileges, but only for the duration of that command. Suitable for this is the sudo command. This is not installed on the system by default, so install it with the following command:

apt-get install sudo

The sudo command can only be used by users who are in the / Etc / sudoers file or system sudo . There are two ways to add users to sudo users:

1) A sudo by entering the group usermod command:

usermod -aG sudo <felhasználónév>

2) A / Etc / sudoers by direct input to a file. However, this file is not edited directly, but there is a separate command for this, the visudo, which is available after installing the above package. So if you want to add a plain user like this, run the command, which opens the / etc / sudoers temporary file for us with your default editor:

visudo

Then insert the line of the desired user in this file according to the pattern highlighted in green: 

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL
felhasznalo    ALL=(ALL:ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

If you want to use the sudo command without a password, you can find out more here.

Set a fixed IP address

As mentioned above, by default, the installer configures the system for DHCP address allocation, which is optimal for desktop use, but requires a static IP address as a server to always access the server's services at the same address.

To do this, we edit the / etc / network / interfaces file:

nano /etc/network/interfaces

This basically contains something like this (our network interface name may be different):

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp0s3
iface enp0s3 inet dhcp

Let's change this to look like this:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hotplug enp0s3
#iface enp0s3 inet dhcp
auto enp0s3 
iface enp0s3 inet static
	address 192.168.1.130
	netmask 255.255.255.0
	network 192.168.1.0
	broadcast 192.168.1.255
	gateway 192.168.1.1

By the way, the parts highlighted in red should be commented out, and the part highlighted in green should be inserted. Also, the bold IP address will be our static IP address, so set this accordingly. If you are using a live server, enter the IP address you received from your hosting or network provider, and in your home network, select an appropriate address from your own domain. In this case, ensure in the router (with the bind address function) that only this machine can obtain this IP address so that no collision can occur. Also, if you are installing behind a router on your home network, set the gateway address to the router's access address, which is the above value in most cases, but some router types may have different addresses.

I will give this Debian 10 (Buster) server series the 192.168.1.130 IP address so we will continue to use this on these machines.

Also pay attention to the ID of the network device. For me, it's just "enp0s3" But if it's not exactly the same elsewhere, we use the one in the original file! This name is assigned by Debian 10 based on the PCI hardware detected in VirtualBox, so it may be different depending on the individual configuration of the network cards.

Then edit the / Etc / hosts file:

nano /etc/hosts

Its "factory" content is:

127.0.0.1       localhost
127.0.1.1       debian10.linuxportal.vm debian10

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Then, in the second line, change the IP address (127.0.1.1) to the fixed IP address set above.

Then restart network management:

service networking restart

If you connected from an external terminal and did everything right, the connection will be lost, as the machine will continue to operate with the new IP address. So if we go back to the console now and issue the IP command there:

ip a

You will then see that the newly configured static IP address is valid:

Debian 10 (Buster) Minimum Server Configuration - Fixed IP Address

This way we can reconnect to the server from the external terminal:

Debian 10 (Buster) Minimum Server Configuration - Remote login after configuration

First you ask the new fingerprint server whether you want to connect. After logging in, you can still see how the sudo command works.

 

 

Check hostname

In the future, a well-configured hostname will be important in many places, so check the hostname command:

hostname
hostname -f

After issuing the commands, you should get similar outputs based on the installation-dependent configuration:

Debian 10 (Buster) Minimum Server Configuration - Verify Host Name

If you did not enter the hostname correctly during installation, you can use the hostnamectl command to change it later:

hostnamectl set-hostname <új_hosztnevünk>

Nano setup (optional)

A dwarf is an excellent editor, the 3.2 version of which is already standard in Debian 10, which allows us to efficiently edit, for example, the necessary configuration files. However, some adjustments need to be made to make it even more useful.

The nano configuration file is unique to each user's home directory .nanorc As. However, if you want to resolve the settings globally, it is better to place this file in a central location, and in the user libraries only one symbolic link to place. So you only need to change it in one place if needed. Accordingly, create a configuration file in the / etc directory:

nano /etc/.nanorc

Here are some of these settings:

set tabsize 4
set smooth
set mouse
set constantshow

Where settings mean:

  • set tabsize 4: Tab size 4 characters. By default, the nano 8 character length is a tab.
  • set smooth: Fine (line by line) scrolling. Larger files are easier to see with this setting.
  • set mouse: Enables mouse operations. For example, positioning the cursor with the mouse, scrolling, etc.
  • set constantshow: (in earlier nano versions set constknown as): Display row, column, character position information. This is also useful if, for example, the x in a given config file. a setting must be made in a row. This makes it easy to navigate to the right line.

There are others are also settings for nano, so you can expand the settings as needed.

Save and link to the user's home directory:

ln -s /etc/.nanorc ~/.nanorc

This can then be done by any user.

After restarting nano, the new settings will take effect.

Enable Bash Programmable Command Line Addition (Optional)

Bash programmable completion expands the standard command line completion function, which can also supplement many commands' own parameters and switches (more on this in another description). In Debian 10 this is not enabled by default. To enable, install bash completion package with the following command:

apt-get install bash-completion

Configuring Aliases and Colors (Optional)

The earlier Ubuntu 18.04 for minimum server installation similarly, we can set our own aliases and colors here, but here we solve it with so much difference that we create our own, central profile file and place all our own settings in it, and then source this into the .bashrc files of the appropriate users.

So create your own central configuration file:

nano /etc/.my_profile

And let's put our own settings into this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Saját beállítások sima és root felhasználóhoz is.
 
# LS opció beállítások:
# - Színes ls kimenet
# - Könyvtárak előre sorolása
export LS_OPTIONS='--color=auto --group-directories-first'
 
# Grep aliasok: Színes kimenetek minden grep hívásnál
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
 
# Saját ls aliasok
# Fenti LS opciók használata minden további ls hívásnál
alias ls='ls $LS_OPTIONS'
# ls kapcsolók:
# -l: részletes lista
# -A: rejtett fájlok listázása
# -h: "Human-readable", azaz a fájlok méreteinél a byte-ok helyett leosztja Kb-ra, Mb-ra, Gb-ra.
# Sokkal könnyebben olvasható így a fájlok mérete.
alias l='ls -lAh'
 
 
# Bash completion futtatása nem login shell esetén is (pl sudo su, vagy su használatakor is)
if [ -f /etc/bash_completion ]; then
 . /etc/bash_completion
fi
 
 
# Színes prompt
# Ha sima felhasználó, akkor
if [ "$EUID" -ne 0 ]; then
        # sima felhasználó színes prompt-ja
        export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[00;32m\]@\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;36m\]\$\[\033[00m\] '
else
        # root felhasználó színes prompt-ja
        export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[00;32m\]@\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[01;35m\]\$\[\033[00m\] '
fi

I put the comments in the file to make it easier to understand the meaning of the rows. What is also worth mentioning is that I also put the Bash command line add-on to run, because when we start a non-login shell, this service will not start by default. And as discussed in the new Debian 10, su command works differently, as in previous versions of Debian, so one can use it in the old way out of habit, which results in a non-login shell here in Debian 10. So this is also a convenience feature to correct our old habits.

Finally, in one junction, we examine the user's root authority and activate a different color prompt accordingly. This can also come in handy when you frequently switch between regular and root users, so you have less chance of accidentally confusing their command lines.

Save and call this file with the command placed at the end of the appropriate users' .bashrc files:

. /etc/.my_profile

(There must be a space after the dot!)

This makes life much simpler than making more variations of the .bashrc file for multiple users.

And with the new settings, our terminal looks like this:

Debian 10 (Buster) Minimum Server Configuration - Check Common Terminal Configuration

The image also shows the prompt colors with plain and root users, the operation of the ls command "l" alias, color output, directory pre-ordering, and the color output of the grep command.

I have written before about using the color terminal in this description, so there are many options that we can expand on and customize these settings.

 

 

Download

The VirtualBox image of the server you created is available at download page.

 

Conclusion

This completes the installation of the minimal Debian 10 (Buster) server ready for further server installations.

 

What's next ?

This minimum server is the next step worth one LAMP server to expand. The completed LAMP servers can be viewed here:

 

 

Navigation

This description consists of several pages: