×


Category: Cloudflare


Install and Configure Apache Web Server with Virtual Host on Debian 10 - Do it now ?

This article covers how to perform installation and configuration of Apache web server on Debian 10.

Also, you will learn how to create virtual hosts on an Apache server and troubleshoot errors. These steps are almost the same for Ubuntu and LinuxMint distributions.

Apache HTTP Server is a free and open-source web server that delivers web content through the internet. It is commonly referred to as Apache and after development, it quickly became the most popular HTTP client on the web.


On most systems if you installed Apache with a package manager, or it came preinstalled, the Apache configuration file is located in one of these locations: /etc/apache2/httpd. conf. /etc/apache2/apache2.


Debian/Ubuntu Linux Specific Commands to Start/Stop/Restart Apache:

1. Restart Apache 2 web server, enter: # /etc/init.d/apache2 restart. $ sudo /etc/init.d/apache2 restart.

2. To stop Apache 2 web server, enter: # /etc/init.d/apache2 stop.

3. To start Apache 2 web server, enter: # /etc/init.d/apache2 start.


To check running status of LAMP stack:

1. For Ubuntu: # service apache2 status.

2. For CentOS: # /etc/init.d/httpd status.

3. For Ubuntu: # service apache2 restart.

4. For CentOS: # /etc/init.d/httpd restart.

5. You can use mysqladmin command to find out whether mysql is running or not.


Find Files in Debian 10 - How to perform this ?

This article covers the different methods of finding files in Debian 10. 


To find a file in Debian:

Use the Locate command

1. Debian and Ubuntu sudo apt-get install locate.

2. CentOS yum install locate.

3. Prepare locate command for first use. To update the mlocate.db database before first use, run: sudo updatedb. 

To use locate, open a terminal and type locate followed by the file name you are looking for.


To locate a file in Linux:

1. find . - name thisfile.txt. If you need to know how to find a file in Linux called thisfile.

2. find /home -name *.jpg. Look for all . jpg files in the /home and directories below it.

3. find . - type f -empty. Look for an empty file inside the current directory.

4. find /home -user randomperson-mtime 6 -iname ".db".


To find packages in Debian:

You can also search for a package using the aptitude Ncurses user interface. 

1. Type 'aptitude' in the terminal and the following interface will be displayed in the window. 

2. To search for a package, press '/' and then type the package name into the search bar.


How to use grep to find a file?

The grep command searches through the file, looking for matches to the pattern specified. 

To use it type grep , then the pattern we're searching for and finally the name of the file (or files) we're searching in. 

The output is the three lines in the file that contain the letters 'not'.


To list files in Linux:

The easiest way to list files by name is simply to list them using the ls command. Listing files by name (alphanumeric order) is, after all, the default. 

You can choose the ls (no details) or ls -l (lots of details) to determine your view.


Which command have more searching options to search a file in file system in Linux?

Grep is a Linux / Unix command-line tool used to search for a string of characters in a specified file. The text search pattern is called a regular expression. 

When it finds a match, it prints the line with the result. 

The grep command is handy when searching through large log files.


grep is a command-line utility for searching plain-text data sets for lines that match a regular expression. 

Its name comes from the ed command g/re/p (globally search for a regular expression and print matching lines), which has the same effect.


To grep recursively in a directory:

To recursively search for a pattern, invoke grep with the -r option (or --recursive ). When this option is used grep will search through all files in the specified directory, skipping the symlinks that are encountered recursively.


Block or Unblock Ping Request on Debian 10 - How to perform this task ?

This article covers how you can block/unblock ping requests to your Debian system. You will learn different ways for blocking/unblocking ping requests either temporarily or permanently.


The --query-icmp-block=<type> option can be used to determine if a type is confgured to allow or deny. 

The --add-icmp-block=<type> option can be used to block a certain type. 

The --remove-icmp-block=<type> option can be used to not block a certain type. 

After adding or removing a block, reload the firewall.


To block ping requests in Linux:

1. Edit /etc/sysctl.conf. Add the following line to your /etc/sysctl.conf : net.ipv4.icmp_echo_ignore_all=1. Then: sysctl -p.

2. Using iptables: iptables -I INPUT -p icmp --icmp-type echo-request -j DROP.

3. With cron. Run crontab -e as root, then add the following line: @reboot echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all.


To block ping in iptables:

1. Add a rule that tells the iptables firewall to block ping in and out of a server by controlling the ICMP requests.

2. Remove the rule that tells the iptables firewall to allow ping in and out of a server by controlling the ICMP requests.


To enable ping on Linux server?

# iptables -D INPUT -p icmp --icmp-type echo-request -j REJECT D : 

This command switch is used to delete the rule. Once the ping enabled, the server should now respond to ping requests


Modify Date, Time, and Timezone in Debian 10 - How to do it ?

This article covers how you can easily change the date, time, and timezone in your Debian system. To change your Debian system's timezone, run the sudo timedatectl set-timezone command followed by the long name of the time zone you want to set

Based on your convenience, you can either choose the command line or the GUI method. If you are using Ubuntu OS, you can visit our post on How to Change the Date, Time, and Timezone in Ubuntu 20.04 LTS .


Using the correct timezone is essential for many systems related tasks and processes. 

For example, the cron daemon uses the system's timezone for executing cron jobs, and the timestamps in the log files are based on the same system's timezone.

On Debian, the system's timezone is set during the install, but it can be easily changed at a later time.


To check the Current Timezone:

timedatectl is a command-line utility that allows you to view and change the system's time and date. It is available on all modern systemd-based Linux systems:

$ timedatectl


To modify Change Time Zone in Debian 10 / Debian 9:

1. Using /etc/localtime File. In this method, we will use /etc/localtime (link to the original time zone file) file to set the timezone for your system.

2. Using timedatectl command. In this method, we will use the timedatectl command to change the time zone in Debian.


Assign Multiple IP Addresses to Single NIC in Debian 10 - How to do it ?

This article covers how to assign and remove multiple IP addresses to and from a single NIC. Based on your preferences, you can either assign the multiple IP addresses temporarily or permanently.

There's no simple command that you can run to determine whether the IP address on a Linux system is assigned by DHCP or static. 

If it changes when the system restarts, it's clearly dynamically assigned, but even a dynamic address has some resistance to change. 

The best way is to look at the configuration file.


To add a static route in Linux:

1. Use the route command with the –p option to add a persistent route: # route -p add default ip-address.

2. Use the route command with the –name option to add a persistent route by specifying a name rather than destination and gateway: # route -p add destination-address gateway-address -name name.


What is ip route command in Linux?

ip route is used to manipulate entries in the kernel routing tables. 

Route types: 

1. unicast - the route entry describes real paths to the destinations covered by the route prefix. 

2. unreachable - these destinations are unreachable. 

Packets are discarded and the ICMP message host unreachable is generated.


Create and Run a Shell Script in Debian 10 -Step by step process to do it ?

This article covers how to easily create a shell script and automate repetitive jobs in #Linux. Shell scripts are just a series of commands that you add in a file and run them together.  


To write and execute a #script:

1. Open the #terminal. Go to the directory where you want to create your script.

2. Create a file with . sh extension.

3. Write the script in the file using an editor.

4. Make the script executable with command chmod +x <fileName>.

5. Run the script using ./<fileName>.


#Shell is a #UNIX term for an interface between a user and an operating system service. 

Shell provides users with an interface and accepts human-readable commands into the system and executes those commands which can run automatically and give the program's output in a shell script.