Change Hostname on CentOS 7 - How to do it ?
This article covers how to change the hostname on CentOS 7 using different methods. By default, your server is started with the server's given name as the hostname. Some software such as cPanel requires a valid fully qualified domain name (FQDN) for the hostname to be used during their licensing verification system.
To Change a server's hostname:
1. Using a text editor, open the server's /etc/sysconfig/network file. The following example shows how to open this file in the GNU nano text editor:
# sudo nano /etc/sysconfig/network
2. Modify the HOSTNAME= value to match your FQDN hostname, as shown in the following example:
HOSTNAME=myserver.domain.com
3. Open the file at /etc/hosts. To update the information for internal networking, change the host that is associated with the main IP address for your server, as shown in the following example:
127.0.0.1 localhost localhost.localdomain
123.45.67.89 hostname.domain.com hostname
4. Run the hostname command. This command enables you to change the hostname on the server that the command line remembers, but it does not actively update all of the programs that are running under the old hostname. The following code provides an example:
# hostnamectl set-hostname hostname.domain.com
# hostname
hostname.domain.com
#
5. Use the following command to restart networking on your server to ensure that changes persist on restart:
# /etc/init.d/network restart
Change the SSH Port on Ubuntu 20.04 Linux Server
This article covers how to change SSH port on your Linux system. SSH (Secure shell) is a cryptographic network protocol used to connect to a remote server securely and it transfer the data in encrypted form between the host and the client.
The default TCP port for SSH is 22, and by changing this default port to the other, it can prevent automated bots and malicious users from being brutally forced into the server.
Before changing the default SSH port number, can check the current port with the below command:
# netstat -ntlp | grep ssh
To change the SSH port:
1. Open the main SSH daemon configuration file /etc/ssh/sshd_config:
# vi /etc/ssh/sshd_config
2. Now search line begins with Port 22 and add hashtag (#) in front of that line.
3. Then add a new Port line below with the custom port.
Note: Replace the sample port number with the custom port number that needs to be set.
4. Save and exit.
How to Restart the SSH daemon for the changes to take effect ?
Run the below commands to restart the SSH daemon and verify that the port changed:
# systemctl restart sshd
# netstat -ntlp | grep ssh
Top 5 Open-Source Load Balancers 2021
This article reviews the Best Open Source Load Balancers. Load Balancing software assists virtual appliances in monitoring and distributing excess traffic. It helps network administrators and data centers maintain constant loading speed. The load balancing software is used to convey network traffic to specific servers with accurate configurations.
Load Balancing Algorithms Types:
- Round-robin Algorithm – The simplest method involves moving the requests within the same order to available servers.
- Least-time Algorithm – It selects servers supported by the smallest amount of active requests and the fastest processing speed. The algorithm integrates with powerful algorithms to give the server higher memory, capacity, and power.
- Least-connections Algorithm – This algorithm sends requests to servers with the smallest amount of workload. The algorithm sends requests to the smallest amount of busy servers.
- Hash-based Algorithm – It assists a hash key to the client and server IP addresses. The algorithm ensures that user's requests are sent to the identical servers containing data from the previous sessions. This ends up in an efficient network resource delivery.
Secure Apache with Let's Encrypt on Debian 9 - Step by Step Process ?
This article covers how to use certbot client of Let’s Encrypt to obtain SSL certificate for you domain.
To set these up DNS records for your server, you can follow these instructions for adding domains and then these instructions for creating DNS records:
- An A record with your_domain pointing to your server’s public IP address.
- An A record with www.your_domain pointing to your server’s public IP address.
To install Certbot as a snap on Debian,
You must first have snapd installed on your server.
snapd is a daemon required to install, use, and manage snaps.
Installing the snapd package will also install the snap command on your server.
1. To install snapd, update your local package index if you've not done so recently:
$ sudo apt update
2. Then install the snapd package:
$ sudo apt install snapd
After running this command, you'll be prompted to confirm that you want to install snapd and its dependencies.
Do so by pressing Y and then ENTER.
3. Next, use the snap command to install the core snap. This will install some dependencies on your server that are needed for any snap you install, including the Certbot snap:
$ sudo snap install core
4. Then refresh the core snap. Doing so will ensure that you have the latest versions of snapd and its dependencies installed:
$ sudo snap refresh core
Following that, you can install the certbot snap with the following command.
5. Because Certbot must be allowed to edit certain configuration files in order to correctly set up certificates, this command includes the --classic option. This confinement level allows any snaps installed under it the same access to system resources as traditional packages:
$ sudo snap install --classic certbot
6. Create a symbolic link to this file in the /usr/bin/ directory to ensure that you can run the certbot command anywhere on your system:
$ sudo ln -s /snap/bin/certbot /usr/bin/certbot
How to Compress and Extract Files Using the Tar, Zip Command on Ubuntu 20.4 Linux OS ?
This article covers how to archive and compress files using tar and zip commands with a few examples to show you how it works.
The tar command on Linux is often used to create .tar.gz or .tgz archive files, also called "tarballs".
How to Remove Files from a Tar Archive ?
Use the --delete operation to remove files from an archive.
The following example shows how to remove the file file1 from archive.tar:
$ tar --delete -f archive.tar file1
Install WordPress with Nginx on Ubuntu 20.04 LTS - Step by Step Process ?
This article covers how to install WordPress on Ubuntu 20.04 with Nginx HTTP Server and Let's Encrypt wildcard SSL Certificates. WordPress is a free, open-source, and most popular content management system that allows you to create a blog on the Internet.
You can install nginx, MariaDB, PHP and all the required PHP extensions with the following command:
$ apt-get install nginx mariadb-server php php-curl php-mysql php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip php-fpm -y
Once the LEMP server is installed, start the Nginx and MariaDB service with the following command:
$ systemctl start nginx
$ systemctl start mariadb
Nginx's inbuilt features includes:
- Nginx is built to work on low memory usage.
- It can support extremely high concurrency.
- Is Ipv6 enabled.
- Supports reverse proxy with efficient caching.
- Provides an inbuilt load balancer.
- Supports WebSockets.
- Optimized handling of index files, static files and provides auto indexing.
- Is accompanied with FastCGI for efficient caching.