Tag: Linux Tutorials

  • Tutorial Configure ModSecurity for Apache on Ubuntu

    Tutorial Configure ModSecurity for Apache on Ubuntu

    Apache Web Server is a modular web server that can have flexibility, power, and high performance on all different platforms and environments. The modularity of this web server means that most of the key features in it are designed in the form of modules that can be enabled or unenabled during compilation or even during execution, and using this allows a webmaster to configure the Apache webserver. ModSecurity is one of the Apache Web Server modules. After reading this article, you will fully understand how to Configure ModSecurity for Apache on Ubuntu.

    What is ModSecurity?

    ModSecurity is an open-source web-based firewall software that can work as a reverse proxy and is supporting by Apache, Nginx, and IIS web servers. Web application firewalls are using to create an external security layer that increases the level of protection, detecting and preventing attacks before they reach web applications.

    ModSecurity is also one of the Apache web server modules that prevent the execution of dangerous web scripts and also adds intrusion detection and prevention features to the web server. It is basically similar to IDS used to analyze network traffic. Contains a set of core rules that include various rules for website scripting, malicious user agents, SQL injection, Trojans, sessions, and other exploits.

    modsecurity.

    ModSecurity features against attacks

    – HTTP Protection: Violation of HTTP protocol and locally defined usage policy detection

    – Protection against common web attacks: Identify common attacks against web applications

    – Automatic detection: bots, crawlers, scanners, and other malicious activities

    – Trojan protection: detection of Trojan access

    – Hide Error Messages: Hide error messages sent by the server

    Introducing Apache Web Server

    Apache is free and open-source software that runs on 67% of all web servers in the world. This software has high speed, reliability, and high security and can customize using plugins and modules to meet the needs of all users in all environments. WordPress hosts use Apache as web server software. Apache web server was originally developed for Linux and Unix operating systems, which was later adapted to work with other systems including Windows and Mac. The difference in using Apache in different operating systems is the type of directory path and installation steps.

    Prerequisites

    – A Linux VPS plan that runs the Ubuntu OS

    – A non-root user who can perform sudo tasks

    How to Configure ModSecurity for Apache on Ubuntu

    First, you should update the Ubuntu package by entering the following command:

    sudo apt-get update

    Now you can install Apache by executing the following command:

    sudo apt-get install Apache2

    Next, you have to press Y and then Enter. Also, the ModSecurity module for Apache is available in the default Ubuntu repository. You should just execute the following command to install it:

    sudo apt install libapache2-mod-security2

    Enter the following command to enable ModSecurity:

    sudo a2enmod security2

    To make the changes take effect, just restart Apache with the following command:

    sudo systemctl restart apache2

    Now you should find the following line in the /etc/apache2/mods-enabled/security2.conf configuration file:

    IncludeOptional /etc/modsecurity/*.conf

    Apache includes all *.conf files in the folder written in the following command. To do this, you need to rename the Modsecurity.conf file:

    sudo mv /etc/modsecurity/modsecurity.conf-recommended /etc/modsecurity/modsecurity.conf

    Then in this step, you should edit the above file with your desired command-line text editor:

    sudo nano /etc/modsecurity/modsecurity.conf

    Now you need to find the following line:

    SecRuleEngine DetectionOnly

    Configuration allows ModSecurity to log HTTP transactions but takes no action when the attack is detecting. ModSecurity detects and blocks web attacks by entering the following command:

    SecRuleEngine On

    The following line tells ModSecurity what information should be included in the audit report. You should find it:

    SecAuditLogParts ABDEFHIJZ

    The default settings should changed as follows:

    SecAuditLogParts ABCEFHJKZ

    Finally, save and close the file. You should restart Apache to apply the changes by entering the following command:

    sudo systemctl restart apache2

    ModSecurity can protect your web applications by setting rules to detect and block malicious agents. Also, install existing rule sets and get start quickly. There are several free rules for ModSecurity. The OWASP Core Rule Set (CRS) is a standard set of rules using with ModSecurity.

    The OWASP Core Rule Set is free, community-maintained, and the most widely used rule set that provides the default configuration sold for ModSecurity. It can be integrated with the Honeypot project and contains rules that help stop command attack vectors, including SQL injection (SQLi), cross-site scripting (XSS), and many others that can be used to detect bots and Identification of scanners used. Adjusted through wide exposure to have very few false positives.

    By installing ModSecurity from the default Ubuntu repository, the modsecurity-crs package is also installing, which includes the OWASP core rule set version 3.x. You can download the latest CRS OWASP from GitHub, and execute the following command:

    wget https://github.com/coreruleset/coreruleset/archive/v3.3.0.tar.gz

    Then you should extract the file with the following command:

    tar xvf v3.3.0.tar.gz

    Now you need to create a directory to store CRS files. To do this, enter the following command:

    sudo mkdir /etc/apache2/modsecurity-crs/

    Then you need to move the extracted directory to the desired folder in the following command:

    sudo mv coreruleset-3.3.0/ /etc/apache2/modsecurity-crs/

    Navigate to that directory by entering the following command:

    cd/etc/apache2/modsecurity-crs/coreruleset-3.3.0/

    Then Remember to rename the crs-setup.conf.example file:

    sudo mv crs-setup.conf.example crs-setup.conf

    Now you need to edit the desired file with the following command:

    sudo nano /etc/apache2/mods-enabled/security2.conf

    The following line loads the default CRS files. You should find it:

    IncludeOptional /usr/share/modsecurity-crs/*.load

    Now change the above line as shown below:

    IncludeOptional /etc/apache2/modsecurity-crs/coreruleset-3.3.0/crs-setup.conf
    IncludeOptional /etc/apache2/modsecurity-crs/coreruleset-3.3.0/rules/*.conf

    Remember to save the file and close it. Then test the Apache configuration by executing the following command:

    sudo apache2ctl -t

    Finally, restart Apache with the following command:

    sudo systemctl restart apache2

    How To Test the ModSecurity Configuration on Ubuntu

    In the last step, you should test that ModSecurity can detect and block suspicious HTTP traffic. To do this you need to edit the default virtual host file with the following command:

    sudo nano /etc/apache2/sites-available/000-default.conf

    Now In this step, create a blocking rule that blocks access to a specific URL when accessing a web browser. You should append these lines at the end before closing the ‘Virtualhost’ tag. To do this, enter the following command:

    SecRuleEngine On
    SecRule ARGS:testparam "@contains test" "id:254,deny,status:403,msg:'Test Successful'"

    Now you need to set the “id” and “msg” tags to any desired value. Then you should restart the Apache webserver to apply the changes to the host configuration file by executing the following command:

    sudo systemctl restart apache2

    You need to visit the URL shown ?testparam=test at the end:

    http://server-ip/?testparam=test

    If you get a “403 Forbidden error“, it indicates that access to the resource is blocked. In this step, you should check the error logs by entering the following command. This will confirm that the client is blocked:

    cat /var/log/apache2/error.log | grep "Test successful"

    Conclusion

    ModSecurity is using to detect and block unwanted traffic. In this article, you learned how to configure ModSecurity for Apache on Ubuntu. By following our step-by-step tutorial, you can easily install and configure it on your Ubuntu system. We hope this educational article was useful for you. Share your comments with us through the form below.

    FAQ

    What is the role of Modsecurity?

    Mode security is a vital piece of PCI DSS compliance and helps to shield your site against external threats.

    How we can check if Modesecurity is Enabled?

    If you installed Modesecurity, you can find it under your plugins.

  • How to Configure DNS Server on Debian 11

    How to Configure DNS Server on Debian 11

    Did you know that you can have your own DNS server to manage name resolution for domain names instead of using your domain registration’s DNS server? So you should definitely setup an authoritative server. This authoritative server can be used to store DNS records by the owners of the domain. After reading this article, you will learn how to configure DNS Server on Debian 11 completely.

    What Is DNS Server?

    DNS is a type of internet service and its function is in a way that it can be used to assign a domain name to an IP address and vice versa. DNS translates the domain name to a specific IP so that the initiating client can download the requested internet resources. this system actually works like a phone book.

    what is dns server

    Here we’re going to use Bind as a flexible, open-source, and full-featured DNS software that works as a valid DNS server and is responsible convert domain names to IP addresses.

    Configure DNS Server on Debian 11

    First, we recommend you choose and purchase a plan from the Linux VPS server plans provided on the NeuronVM website to configure DNS Server on Debian 11. Then install the Debian 11 operating system on it.

    Before you start the configuration part, you should install a DNS server which here is Bind, and follow the steps below:

    1. Installing Bind DNS Server

    The first step before starting the installation process is to update the Debian 11 system. You can run the following command to update your system:

    sudo apt update -y

    Now, you are ready to install the DNS server. Here we use the name bind9 for our DNS server and you can find it in the default base repository. To install this server use the APT command:

    sudo apt-get install -y bind9 bind9utils bind9-doc dnsutils

    2. Configuring Bind Master DNS Server

    /etc/bind/ is the configuration directory for Bind9. This directory is holding both configuration files and Zone lookup files. On the other hand, /etc/bind/named.conf is a global configuration that is not used for local DNS configuration. You can use /etc/bind/named.conf.local instead.

    Creating Zone

    In this section, you can use /etc/bind/named.conf.local file and create zones by editing the content of this file. For this reason, you can choose your favorite editor like Vim. Use the following command to install Vim:

    sudo vim /etc/bind/named.conf.local

    To create forward and reverse zone. You can create an entry for your forward zone for neuronvm.local domain. Then replace it with your set domain name:

    zone "neuronvm.local" IN { // Domain name
    type master; // Primary DNS
    
     file "/etc/bind/forward.neuronvm.local.db"; // Forward lookup file
    
     allow-update { none; }; // Since this is the primary DNS, it should be none.
    };

    As you can see, in this file forward.neuronvm.local.db is the name of forward lookup zone.

    Here, to create a forward zone for neuronvm.local.db follow the instructions below. In the exciting file, add the lines you see below instead of your parameters such as the front area:

    zone "1.168.192.in-addr.arpa" IN { //Reverse lookup name, should match your network in reverse order
    type master; // Primary DNS
    
     file "/etc/bind/reverse.neuronvm.local.db"; //Reverse lookup file
    allow-update { none; }; //Since this is the primary DNS, it should be none.
    };

    The name of the reverse DNS in the file above is 1.168.192.in-addr.arpa. Also, reverse.neuronvm.local.db is the reverse DNS lookup zone.

    3. Configuring Bind DNS Lookup Files

    If you want to keep DNS records for both forward and reverse zone, use lookup zones.

    The first step here is to create the front area lookup file, which we copy the sample zone lookup file as below:

    sudo cp /etc/bind/db.local /etc/bind/forward.neuronvm.local.db

    We have syntax here and all domain names end with a dot (.)

    Here are some acronyms that you should understand:

    _ MX: To show mail for exchange

    _ A: To show A record

    _ CN: To show the canonical name

    _ SOA: To show starting of authority

    _ AS: To show the name server

    Here, you can see how to edit the zone file:

    sudo vim /etc/bind/forward.neuronvm.local.db

    You should change it as per your set domain name:

    $TTL 604800
    @ IN SOA ns1.neuronvm.local. root.ns1.neuronvm.local. (
    3 ; Serial
    604800 ; Refresh
    86400 ; Retry
    2419200 ; Expire
    604800 ) ; Negative Cache TTL
    ;
    ;@ IN NS localhost.
    ;@ IN A 127.0.0.1
    ;@ IN AAAA ::
    ;Name Server Information
    @ IN NS ns1.neuronvm.local.
    ;IP address of Name Server
    ns1 IN A 192.168.1.12
    ;Mail Exchanger
    neuronvm.local. IN MX 10 mail.neuronvm.local.
    ;A – Record HostName To Ip Address
    www IN A 192.168.1.13
    mail IN A 192.168.1.14
    ;CNAME record
    ftp IN CNAME www.neuronvm.local.

    Here, also we have some acronyms:

    _ PTR: To show the pointer

    _ SOA: To show starting of authority

    Use the /etc/bind directory to copy your sample reverse zone file called reverse.neuronvm.local.db:

    sudo cp /etc/bind/db.127 /etc/bind/reverse.neuronvm.local.db

    Then, edit the content of your file:

    sudo vim /etc/bind/reverse.neuronvm.local.db

    Now, in the file, replace your IP and domain name in the proper way:

    ; BIND reverse data file for local loopback interface
    ;
    $TTL 604800
    @ IN SOA neuronvm.local. root.neuronvm.local. (
    3 ; Serial
    604800 ; Refresh
    86400 ; Retry
    2419200 ; Expire
    604800 ) ; Negative Cache TTL
    ;
    ;Name Server Information
    @ IN NS ns1.neuronvm.local.
    ns1 IN A 192.168.1.12
    ;Reverse lookup for Name Server
    12 IN PTR ns1.neuronvm.local.
    ;PTR Record IP address to HostName
    13 IN PTR www.neuronvm.local.
    14 IN PTR mail.neuronvm.local.

    4. Checking Bind DNS Syntax

    Use the instructions below to check the syntax of created config files. We will use named-checkconf to check syntax and if you encounter no error, the command will return to shell:

    By doing the following steps, you can check the syntax of forward and reverse zone files:

    – For forwarding zone files use:

    sudo named-checkzone neuronvm.local /etc/bind/forward.neuronvm.local.db

    – For reverse zone files, use:

    sudo named-checkzone 1.168.192.in-addr.arpa /etc/bind/reverse.neuronvm.local.db

    You should note that the serial output from both checks should be the same. If not, edit the configuration part.

    By using the following command, you can restart and enable the Bind DNS server:

    sudo systemctl restart bind9
    sudo systemctl enable bind9

    For checking the status of your service, go through this command:

    systemctl status bind9

    5. Testing Bind DNS Server

    For testing your DNS you can go to a client machine and add a new DNS IP address in /etc/resolv.conf file:

    sudo vim /etc/resolv.conf

    Now you can add the DNS IP address:

    nameserver ***.***.*.**

    Save changes and Exit. Then go on as shown here.

    We have two options to use in this section:

    nslookup and dig command

    dig www.neuronvm.local

    Use the command below to confirm your reverse lookup:

    you -x ***.***.*.**

    Conclusion

    In this article, we tried to show how to configure DNS server on Debian 11. After a successful installation, now you know how to configure the DNS server yourself. A DNS server is very useful for admins who have applications to communicate over domain names. We hope you enjoy this tutorial.

    FAQ

    Is DNS the same as address IP?

    It is the resolution of a domain name to an IP address through a DNS server.

    Do we have a DNS for every IP address?

    Every domain has DNS and this DNS is pointing to servers that redirect different domains.

  • Tutorial Install DirectAdmin on Rocky Linux

    Tutorial Install DirectAdmin on Rocky Linux

    DirectAdmin helps you manage your web server and website easily. Also, this control panel manages files and provides web server hosting, DNS, backup, and a database. Although DirectAdmin does not include many features of Cpanel, it is still cheaper. After reading this article, you will learn how to install DirectAdmin on Rocky Linux step by step.

    What Is DirectAdmin?

    As we explained before, DirectAdmin is a control panel for hosting websites and allows you to manage all aspects of your site. The technology which is used on this control panel is based on the solid LAMP stack. DirectAdmin is available to install and use on almost all popular Linux operating systems like FreeBSD.

    Prerequisites 

    – Having root access

    – A Linux VPS Server with the Rocky Linux operating system

    – Minimum of 2 GB free space

    – Minimum of 4 GB RAM 

    – 500 GHz CPU 

    Installing DirectAdmin on Rocky Linux

    Here are step-by-step instructions to install DirectAdmin. So follow this guide carefully to have this useful tool on your system.

    In DirectAdmin Installation, first of all, you must obtain the IP license of the server you intend to install. In this regard, you can go to the DirectAdmin website and create an account. Here, you will get a username and password. Now, create a trial license from the created user account and add the IP address of the server where you want this control panel to be installed.  

    Use the command below to find the server IP:

    ip a

    After creating the license, you should return to your Rocky Linux server and run the system update using the following command. This way, you can be sure all the system default packages are up to date. Also, the repo is flushed:

    dnf update

    Now, to install DirectAdmin, you should log in as a root user and run the following script. So, there is no need to go through many commands to do this task cause everything is preconfigured in this script:

    bash <(curl -Ss https://www.directadmin.com/setup.sh || wget -O - https://www.directadmin.com/setup.sh) auto

    When you have finished the installation part successfully, it’s time to set by entering the admin username and password along with the login URL, which is your server IP and 2222 port:

    install directadmin on rocky linux

    In case, you don’t have your password or forget it, then there is a command which will help you to recover it.

    So login to the server as root user and run one of the commands below:

    grep adminpass /usr/local/directadmin/scripts/setup.txt

    or

    cat /usr/local/directadmin/scripts/setup.txt

    How to use DirectAdmin

    You can use any system browser to access your server IP address along with the 2222 port:

    http://your-server-ip-address:2222

    Tip: Open the 2222 port in the system or cloud firewall if you can’t access the web interface:

    start direct admin

    As the final step, you can see the interface to create user, manager domains, reseller, and all other settings:

    direct admin dashboard

    Conclusion

    In this article, you learned how to install DirectAdmin on Rocky Linux. Now, you are familiar with this useful control panel, and you can manage your website easily. We hope you enjoy it. For any question or idea, just leave a comment.

    FAQ

    How can we Uninstall DirectAdmin?

    It is not possible to uninstall DirectAdmin completely. So you have to reinstall your server if you need another web control hosting panel.

  • How to Install Linux Mint on VirtualBox

    How to Install Linux Mint on VirtualBox

    If we want to recommend a suitable distribution for beginners, Linux Mint is definitely one of the best. This distribution is based on the Ubuntu operating system and is very stable. You can use this distribution as the main system for testing on a virtual machine. After reading this article step by step, you will learn how to Install Linux Mint on VirtualBox.

    Install Linux Mint on VirtualBox

    The first step here is to install a VirtaulBox on your system. If you use Windows, go to the official download page to download the exe file and install it from the page. But if your operating system is Linux, use the commands below to install it on your system.

    If your system is Ubuntu or based on Ubuntu, use the following command:

     sudo apt install VirtualBox

    If your system is Arch Linux, use the following command:

    sudo pacman -S VirtualBox

    And on the Fedora workstation:

    sudo dnf install VirtualBox

    As you have installed the software, it’s time to create a virtual machine.

    Enabling the Virtualization and Download the ISO File

    The Virtualizor may not be enabled by default on your system, in which case you need to enable it yourself. Of course, most systems have activated it. But if you encounter a problem at this stage, Follow the steps below:

    Now, you need to reboot your system. You should also check the boot menu to make sure that virtualization is enabled.

    Tip: You can also access the boot menu through the F2, F10, and F12 and delete keys, as you see the manufacturer information on the screen.

    Then, it’s time to download Linux Mint ISO from the official page.

    Enabling the Virtualization

    Creating the Virtual Machine

    After the downloading process, open your application and click on the new button. Here you should fill in the details of the given parts on the virtual machine (Linux Mint) and go to the next part:

    Creating the Virtual Machine

    Determine how much memory to use on your virtual machine and click the next button: (we recommend allocating 50% or less)

    Creating the Virtual Machine

    Now, you will see the hard disk setting. do not change the default setting and select create:

    Creating the Virtual Machine

    You will go to the next menu. Again don’t change the default option. Then in the next section, stay on the Dynamically allocated option and click the next button:

    Creating the Virtual Machine

    In this section, you must select the size of the disk you need. If it is only for testing a new distribution, 30 GB will be enough. But if you intend to install software, 30 to 100 GB is recommended. After selecting the value, click the Create option:

    Creating the Virtual Machine

    Your machine is created, but you still have some work to do. Press the setting button to configure more options.

    Here you will see the dialog menu. Go to the General -> Advanced part and choose Bidirectional for both, shared clipboard, and drag and drop.

    Creating the Virtual Machine

    You can enable disk encryption, but it is optional:

    Install Linux Mint on VirtualBox

    You need to allocate at least 2 GB RAM and 2 CPU cores to the virtual machine:

    Creating the Virtual Machine - Install Linux Mint on VirtualBox

    This part is important. Go through this direction:

    Storage -> empty -> Live CD/DVD checkbox -> CD icon

    Then navigate to the download folder, select the Linux mint ISO, and press OK.

    Creating the Virtual Machine - Install Linux Mint on VirtualBox

    Installing Linux Mint on Virtual Machine

    Now you have your virtual machine, and you can install the Linux Mint operating system on it. So follow the instructions below:

    _ You can see the start button on top. Click on it to open the related window and make it full-screen.

    _ You will see two options: open-source and proprietary drivers. Then select open-source and press the enter key.

    _ As the Linux Mint Live CD booted up, start the installer and do the installation steps like selecting your language, allocating the disk space, choosing your locale and time zone, adding your hostname and password etc.

    _ At the final step, as the installation ends, restart your virtual machine:

    Install Linux Mint on VirtualBox

    You should separate the installation media from the Setting -> Storage part. Then to set the resolution of the VM, adjust it to the custom with the help of xrandr command:

    xrandr -s

    Conclusion

    In this tutorial, we tried to show how you can install Linux Mint on VirtualBox. This distribution is one of the best operating systems for beginners. You can follow the steps and images here to have a successful installation process. If you have any ideas or questions, just leave a comment.

    FAQ

    Does VirtualBox use RAM?

    VirtualBox uses the computer’s physical RAM for virtual RAM.

    Is using a VirtualBox safe for Linux?

    Yes, it is safe to use on every platform.

  • How to Install Docker on Ubuntu 22.04

    How to Install Docker on Ubuntu 22.04

    What you will read in this article will be familiarization with Docker and then how to install Docker on Ubuntu 22.04. The following content will help you to install Docker successfully and to find out how to work with images and containers. Also, you can add an image to a Docker repository.

    What is Docker?

    Dockers is actually a platform that helps users to package and run applications in containers. These containers are like virtual machines and are isolated. They are also portable and compatible with resources. The isolation factor allows multiple containers to run simultaneously on a single host. Docker has a client-server structure and relies on the Docker daemon to manage containers:

    Install Docker on Ubuntu 22.04

    Prerequisites

    Before you start the installation part, you need to prepare some requirements:

    – A Linux VPS server with Ubuntu 22.04

    – A non-root user with sudo privileges and a firewall

    – A docker Hub account

    Installing Docker on Ubuntu 22.04

    When we want to start, the installation package in the repository may not be the latest version, So we install Docker from the official Docker repository. First, add a new package source and then install the package. Let’s update the list of packages:

    sudo apt update

    Now, you should install the required package that allows apt use packages over HTTPS:

    sudo apt install apt-transport-https ca-certificates curl software-properties-common

    After that, you have to add the GPG key to your system for the official Docker repository:

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

    Using this command, it is time for adding the Docker repository to apt sources:

    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null  

    To be recognized, in addition, you should update the exciting list of packages:

    sudo apt update

    You have to be sure to install your package from the Docker repo instead of the default Ubuntu repo:

    apt-cache policy docker-ce

    TIP: As you got the output, you will see that docker-ce is not installed, but it is the candidate for installation from the Docker repository for Ubuntu 22.04 (that is jammy)

    Now, you can install Docker:

    sudo apt install docker-ce

    After all these steps, Docker can be installed, the daemon started and the process enabled until it starts again after booting the system:

    sudo systemctl status docker

    As you installed this platform, you will have the Docker service available and both the Docker command line tool and the Docker client.

    Run the Docker Command Without Sudo (optional)

    By default, the Docker command is executed only by the main user or the user in the Docker group. But if you don’t want to log in as the sudo user, you should go through the following instructions.

    To run the Docker command without sudo, add your user name to the Docker group:

    sudo usermod -aG docker ${USER}

    Then, to apply for the membership, exit the server and turn back in or type the following command:

    su - ${USER}

    Now, you should enter the user’s password to continue:

    groups

    Then to add a user to the Docker group that you are not logged in as notify the username explicitly using:

    sudo usermod -aG docker username

    When you finished all these sections, you will have the Docker platform on your system.

    Conclusion

    Here, we tried to show how to install Docker on the Ubuntu operating system. Docker is a useful assistant for you. We hope you enjoy this article. If you have any ideas or questions, just leave a comment.

    FAQ

    Is Docker free on Linux?

    Yes, Docker is free to use as part of the Docker personal subscription.

    Does Docker use more RAM?

    Docker doesn’t apply memory limitations to containers by default. It is possible for a Docker container to consume the entire host’s memory.

  • Top Way to Install Docker on AlmaLinux

    Top Way to Install Docker on AlmaLinux

    Docker is a free and open-source containerization tool that allows developers to package their applications in containers. The installation of these software packages can be done in the same way as the usual installation by the package manager of your operating system to download a program. The only difference is that Docker does everything automatically. After reading this post you will earn a top way to install Docker on AlmaLinux.

    Installing Docker on AlmaLinux

    After a little explanation about Docker, now we have a step-by-step guide for you, so you can install this useful tool easily.

    Prerequisites

    – A Linux VPS Server with the AlmaLinux operating system

    – Minimal 10 Gb free disk space

    – Sudo privileges with admin rights

    – Have a good internet connection

    – 2 GB RAM and 2 CPU/vCPU

    Step1. Uninstalling Podman and Buildah

    In order not to get confused and have an easy installation process, you should remove Podman and Buildah from your AlmaLinux system before installing Docker. You can use the following command:

    sudo dnf remove -y podman buidah

    Tip: If you don’t have them on your system as a default, skip this part.

    Step 2. Enabling Docker Repository

    You should use the following command to enable Docker official repository because the Docker package is not available in the default AlmaLinux:

    sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

    Step 3. Installing Docker with dnf Command

    You can run the command below to install the latest Docker from the official repository:

    sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

    Step 4. Starting and Enabling Docker Service on ALmaLinux

    Now that you have installed Docker and its dependencies on your AlmaLinux system, you can start this tool and enable it using the following command:

    sudo systemctl start docker
    sudo systemctl enable docker

    Use this command to verify the Docker service:

    sudo systemctl status docker
    Docker-Service-Status-AlmaLinux

    You should use the Docker command without sudo for adding your local user to the Docker group:

    sudo usermod -aG docker $USER
    newgrp docker

    Use the following command to see the Dockers version:

    docker --version
    Docker version 20.10.18, build b40c2f6

    In addition, we have another easy and quick way to see how many Docker containers are running. Also you can see some of docker’s configured options:

    sudo docker info 

    Step 5. Testing Docker Installation

    If you want to test your Docker installation, use the following command:

    docker run hello-world

    If you see the below message from the Docker container, you can be sure that the Docker is working perfectly and the installation process is successful:

    Hello-World-Docker-Container-AlmaLinux9

    How to Remove Docker from AlmaLinux

    At last, if you decide to remove Docker from your system, you should run the command below:

    sudo dnf remove -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
    sudo rm -rf /var/lib/docker
    sudo rm -rf /var/lib/containerd

    Conclusion

    FAQ

    Here, we tried to show a simple installation guide for install Docker on AlmaLinux. Now, you can use Docker to install software packages. We hope this guide was useful to you. If you have any ideas or questions please share them with a comment.

    How we can install the Docker plugin on Linux?

    You should use the Docker plugin install command which pulls the plugin from Docker Hub or your private registry and prompts you to grant permissions if necessary.

    Is Docker only for Linux?

    You can run this tool on both Linux and Windows programs and executable in Docker containers.

  • Tutorial Configure Parse Server on CentOS 8

    Tutorial Configure Parse Server on CentOS 8

    In this article, we are going to teach you How to Configure Parse Server on CentOS 8. Modern applications store data and interact with other services on the Internet. User accounts shared content, documents, and purchases need to be linked and stored elsewhere. All of these programs require complementary server-side applications to communicate with. Before Parse, these items had to be made separately, which requires knowledge in many disciplines. Few people can do this alone. The rest were grouped together and worked with others to complete the whole picture.

    What is a Parse Server?

    Parse Server is an open-source and self-hosted backend. Parse server can be deployed on any infrastructure that can run Node.js. You can deploy and run the Parse Server on your infrastructure. One of the biggest successes of Parse Server is that you can develop and test your application locally.

    The analytics server can be hosted anywhere, and you can even run multiple instances in different regions to serve a global audience. Parse uses MongoDB and PostgreSQL to store information and create new features. Also, Parse has stored all the files in its Amazon S3 bin. Using Parse Server, adapters are written that allow developers to control the database platform and file storage system they want to use. You can develop and test your application using Node.

    Prerequisites to Install Parse Server on CentOS 8

    1. CentOS Linux VPS

    2. A privileged Sudo account

    3. Login via SSH as the root account

    How to Install Parse Server on CentOS 8

    First, you should install Node.js from the official Yum repository. You can configure the Yum repository using the following command:

    dnf install -y gcc-c++ make
    curl -sL https://rpm.nodesource.com/setup_12.x | sudo -E bash -

    Now to install Node.js on your server, run the following command:

    sudo dnf install -y nodejs

    In this step, you must install Yarn. You can install Yarn with the NPM repository or using the DNF package manager tool. By entering the following command, the Yarn repository will be added to your system:

    sudo rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg
    curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo

    Now you can install Yarn by entering the following command:

    sudo dnf  install yarn --disablerepo=AppStream

    Next, you should install MongoDB according to the required version and architecture of your system. To do this, add the following content to the Yum repository configuration file:

    sudo vi /etc/yum.repos.d/mongodb.repo
    [MongoDB]
    name=MongoDB Repository
    baseurl=http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/$basearch/ 
    gpgcheck=1
    enabled=1
    gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc

    Remember to save your file and close it.

    Then run the following command to install the MongoDB server:

    sudo dnf install mongodb-org

    After installing the required packages, you can install Parse Server. The Parse Server package is available in the global repository and can be installed using the Yarn packaging manager. To install Parse Server, run the following command:

    yarn global add parse-server

    How to Configure Parse Server on CentOS 8

    Now you should create a configuration file for your Parse Server. In the configuration file, you can define parse server attributes. Create a configuration file by entering the following command and editing it in your desired text editor:

    nano config.json

    Remember to add the following content to the file:

    {
    "appName": "My Parse Server",
    "databaseURI": "mongodb://localhost:27017/dev",
    "appId": "KSDJFKDJ9DKFDJDKF",
    "masterkey": "KJDF89DFJ3H37JHFJDF8DFJDF",
    "serverURL": "https://localhost:1337/parse",
    "publicServerURL": "https://0.0.0.0:1337/parse",
    "port": 1337
    }

    The configuration details are as follows:

    appName – Set a name for your Parse Server

    databaseURI – Connection string to the MongoDB database

    appID – Set a random string as appID, which is used to connect to the server

    masterKey – Set a random string for the master key

    serverURL – Set a URL for your parse server

    publicServerURL – This allows you to access the parse server from the public network

    port – Enter a port to run on the parse server. The default port is 1337

    After saving the file, run the parse server by entering the following command. Also, run it as a background process.

    nohup parse-server config.json &

    How to Install Parse Dashboard on CentOS 

    In this step, you are going to install a web interface to access the Parse Server called the Parse Dashboard, which is also available as a node module. You can install Parse Dashboard by entering the following command:

    yarn global add parse-dashboard

    Now you should create a configuration file for the Parse Dashboard using the following command and edit it in your desired text editor:

    nano parse-dashboard-config.json

    Then add the following content:

    {
      "apps": [
        {
          "serverURL": "http://your_server_ip:1337/parse",
          "appId": "KSDJFKDJ9DKFDJDKF",
          "masterKey": "KJDF89DFJ3H37JHFJDF8DFJDF",
          "allowInsecureHTTP": "true",
          "appName": "MyApp1"
        }
      ],
     "users": [
        {
          "user":"admin",
          "pass":"password"
        }
      ],
      "iconsFolder": "icons"
    }

    Multiple Parse Servers can be added to your Parse Dashboard. Add your Parse Server with the server URL and use the same appID and master key you defined for your Parse Server.

    After saving the file, start the Parse Dashboard by running the following command:

    nohup parse-dashboard --dev --config parse-dashboard-config.json &

    Finally, the Parse Server is set up on port 4040.

    Next, you should set the FirewallD Rules. Because systems have a firewall enabled, they must allow access to the ports running the Parse Server. Use port 1337 for the parse server and 4040 for the dashboard. By running the following commands, Parse server access will be possible for public users. Run the following commands to open the port type:

    sudo firewall-cmd --permanent --zone=public --add-port=1337/tcp
    sudo firewall-cmd --permanent --zone=public --add-port=4040/tcp

    By running the following command, the above changes will be applied:

    firewall-cmd --reload

    How to Access Parse Dashboard on CentOS 

    By accessing your server on port 4040, you access the web interface of your Parse dashboard. You must log in with the username and password of the dashboard as defined in the parse configuration file (parse-dashboard-config.json).

    How to Access Parse Dashboard on CentOS Linux

    Now you can see the dashboard:

    How to Access Parse Dashboard on CentOS Linux

    Conclusion

    In this article, you learned how to configure Parse Server on CentOS 8. Also, you were taught how to install the Parse Dashboard and how to access it. Note that using Parse, developers will have the opportunity to provide a scalable and powerful back end for an application filled with facilities, android, javascript, windows, and so on.