Change Hostname on Debian 9 - Do it Now ?
This article covers how to change the hostname on Debian 9 system using different methods. Basically, the hostname is a label that is assigned during the initial server setup and it is used to identify and easily distinguish one server from another.
To check your current hostname:
$ hostname
And to check your Fully Qualified Domain name (FQDN) you can run the following command instead:
$ hostname -f
How to Change your Debian hostname ?
1. To change your hostname, we can simply run the following command:
$ hostname new.hostname.com
2. So in order to change our hostname permanently, you will need to update this file. You can open it with your favorite text editor, for example:
$ nano /etc/hostname
3. Change the hostname, save the file and exit the text editor.
Configure SSH Keys on Debian 9 System - How to do it ?
This article covers how to create a new SSH key pair and set up an SSH key-based authentication. You can set up same key to multiple remote hosts. Also, you will learn how to disable SSH password authentication. SSH stands for Secure Shell and works as a method to establish remote connections between computers. SSH is usually used to log in and manage a remote server.
SSH key pairs can be used to authenticate a client to a server. The client creates a key pair and then uploads the public key to any remote server it wishes to access. This is placed in a file called authorized_keys within the ~/. ssh directory in the user account's home directory on the remote server.
To Disable Password Authentication:
Disabling password authentication is a security precaution. It prevents brute-force attacks against attempting to log in to the server.
1. Start by logging into the remote server:
$ ssh user@hostname
2. Next, edit the sshd_config file in a text editor of your choice (we are using nano):
$ sudo nano /etc/ssh/sshd_config
3. Find and modify the following lines to look as follows:
PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM no
4. Write the changes, then exit the editor. Restart the SSH service by entering the following:
$ sudo systemctl restart ssh
Install Git on Debian 9 System - Step by Step Process ?
This article covers how to install Git on your Debian server and how to Setting up Git. With versioning tools such as Git, you can track changes, revert to previous stages, and branch to create alternate versions of files and directories.
How to Install Git with Default Packages on Debian?
1. First, use the apt package management tools to update your local package index.
After updating the system, you can download and install Git:
$ sudo apt update
$ sudo apt install git
2. You can confirm that you have installed Git correctly by running the following command:
git --version
Install MySQL on Debian 9 Stretch - Step by Step Process ?
This article covers how to install mysql 8.0 and Secure MySQL on Debian 9 server. MySQL, the world's most popular open-source relational database management system is not available in the default Debian's repositories. MariaDB is the default database system in Debian 10.
The MySQL APT repository provides a simple and convenient way to install and update MySQL products with the latest software packages using Apt. The MySQL APT repository provides MySQL packages for the following Linux distros: Debian.
How to Uninstall MySQL from Debian?
To remove MySQL, Run the following commands:
$ sudo apt-get remove --purge mysql-server mysql-client mysql-common -y
$ sudo apt-get autoremove -y
$ sudo apt-get autoclean
rm -rf /etc/mysql
sudo find / -iname 'mysql*' -exec rm -rf {} \;
How to secure MySQL ?
MySQL comes with a command we can use to perform a few security-related updates on our new install. Let's run it now:
$ mysql_secure_installation
This will ask you for the MySQL root password that you set during installation. Type it in and press ENTER. Then answer a series of yes or no prompts.
Secure Nginx with Let's Encrypt on Debian 9 - How to do it ?
This article covers how to install certbot client, obtain Let's Encrypt SSL certificate and configured to Nginx to use the certificates. Also you will learn how to set up a cronjob for automatic certificate renewal.
To install the Certbot software on Debian:
1. Update your package list.
$ sudo apt update
2. Next, install the dependencies for the python3-certbot-nginx package, which include the python3-acme, python3-certbot, python3-mock, python3-openssl, python3-pkg-resources, python3-pyparsing, and python3-zope.interface packages.
$ sudo apt install python3-acme python3-certbot python3-mock python3-openssl python3-pkg-resources python3-pyparsing python3-zope.interface
3. Finally, install the python3-certbot-nginx package:
$ sudo apt install python3-certbot-nginx
Configure Nginx Server Blocks on Debian 9 - How to do it ?
This article covers how to create an Nginx server blocks to host multiple website on a single Debian machine. Nginx is a very popular high-performance web server that combines the power of reverse proxying, load balancing, caching and so much more. Depending on how it is configured, it can act as a reverse proxy as well as a load balancer for HTTP/HTTPS servers.
To install Nginx on Debian:
1. Update the Debian 10 Package Repository.
$ sudo apt update -y
2. Install Nginx on Debian 10.
$ sudo apt install nginx -y
3. To check the status of Nginx, execute:
$ systemctl status nginx