Click here for "Error Codes for Commercial Air Conditioners".

Debian10 ; vim ・Network ・Time synchronization settings

Now that the installation of Debian 10 buster is finished, we are ready to start building the server. This site requires a lot of settings such as remote connection from Windows via SSH, antivirus, encryption of information with SSl certificate, database installation, and so on.

This time, we will use the package manager apt to install the software.
In this page, we will do the following to prepare for the server configuration.

  • Install and configure the vim editor.
  • Configure the network settings, change the hostname and set the fixed lokal IP address.
  • Set up time synchronization for the server

1. Installing and configuring the vim editor

The default editor for Debian is "nano", but since nano is somewhat difficult to use and there are few environments where it is used, we will show you how to change the editor to "vim".

1.1 Check the vim package.

Debian comes with vim installed by default, but it comes in a package called "vim-tiny", which is a less functional version. To check which vim packages are installed, use the "dpkg" command. In Debian, the "dpkg" command is used to check the packages, and the "-l" option displays the package list.

If you run the "dpkg" command as it is, all the packages installed on your system will be displayed, so you can use the "grep" command to extract only the packages that contain the string "vim". To do this, execute the following command.

You can see that only the "vim-tiny" package has been installed as shown above.

1.2 Install the vim package

The "-y" option of the apt install command is an option to automatically confirm the installation.

If no error is displayed, the vim package is installed. After installation, check the vim package again with the dpkg command.

Vim has been installed as shown above.

1.3 Change the editor to be used by default

Change the default editor to "vim", which you installed from nano. To change the default editor, run the command "update-alternatives --set editor".

If the output looks like the above, the editor has been changed.

1.4 Change vim settings

If you want to allow all users, create a ".vimrc" file in "/root/".
If you want to set up a vim environment for each user, you can create a ".vimrc" file in the user's home directory.
In this case, we will create a ".vimrc" file in the root user's home directory "/root/".

Comment out anything in the above that is unnecessary.

1.5 Activate the vim configuration changes.

Please log out of the system to make the settings effective. When you log in to the system again, the above settings will take effect.

2. Network Settings

2.1 Setting the host name

This section describes how to change the hostname, which is set during the installation of Debian.
To set the hostname, use the command "hostnamectl set-hostname". You can do this as follows. In this example, we will set the hostname to "debian-user".

You can check the result of the configuration by referring to the "/etc/hostname" file.
Use the "cat" command to browse the "/etc/hostname" file, and if you see "debian-user" in the configuration value as shown below, the hostname confirmation is complete.

2.2 Configure IP addresses for network interfaces.

To set the IP address, change the file "/etc/network/interfaces" and reboot the network interface (eno1 in this case). To set the IP address, change the "/etc/network/interfaces" file, and then reboot the network interface (eno1 in this case).
The name of the network interface will vary depending on the environment you have set up, so check the interface name first.
The command to check the network information is "ip addr". This will display the network interface name and IP address information.

The next item displayed after the sequential number is the "Network Interface Name". In this case, "eno1" is the network interface name. In the above case, "eno1" is the network interface name.

2.3 Setting up a static IP address

Now that we know the name of the network interface, we will configure the network settings. We will proceed assuming that the information required for the network configuration and the parameters to be configured are as follows.

・IP address       192.168.11.82
・subnet mask          255.255.255.0(24bits)
・Default gateway           192.168.11.1
・DNS server        192.168.11.1

To set the IP address, change the "/etc/network/interfaces" file, open the interfaces file with the vi command.

2.4 Enabling a static IP address

3. Configure server time synchronization

We will configure "timesyncd", a service that automatically sets the server time.

3.1 Configuring the timesyncd service

The configuration of the timesyncd service is done in the file "/etc/systemd/timesyncd.conf". Before changing the file, copy the original file as a backup.

We will edit the configuration file using the vi command.

3.2 Reflection of timesyncd service settings

If no error is printed, the service is restarted. Check the time synchronization. To check the time synchronization, use the "timedatectl status" command. Do the following。

If the message "System clock synchronized: yes" is displayed, time synchronization has been performed.

タイトルとURLをコピーしました