How to manage csf via command line in linux server

    Posted in Linux Servers on Jan 02, 2019

    We can install the csf firewall to secure the Linux servers. We can manage the firewall via command line easily. Please read our the following article and command structure.

    Start the firewall rules
    Csf -s

    Example: #csf -s

    Flush/Stop firewall rules (note: lfd may restart csf)
    csf -f

    Example: #csf -f

    Restart the firewall rules
    csf -r

    Example: #csf -r

    Deny an IP and add to /etc/csf/csf.deny
    csf -d 

    Example: #csf -d 103.129.97.14

    Flush all IPs from the temporary IP entries
    csf -tf

    Example: #csf -tf

    Remove an IP from the temporary IP ban or allow list
    csf -tr

    Example: #csf -tr 103.129.97.14

    All...[Read more...]

    Wishing you and your family a Merry Christmas

    Posted in Linux Servers on Dec 24, 2018

    We would like to make the better use of this opportunity and congratulate our partners, who are benefited from our work. Hope for a better performing season in the new year.

    christmas.jpg

    [Read more...]

    How to export import a MySQL database via SSH

    Posted in Linux Servers on Nov 16, 2018

    In this article, we will cover exporting and importing a database via SSH. Make sure that you replace the following variables in the commands below:

    USERNAME - the MySQL user assigned to your database.

    DATABASE - the name of your MySQL database.

    Exporting a MySQL database

    To export a MySQL database, you need to use the mysqldump command. Here is the full command for exporting your database:

    mysqldump -uUSERNAME -p DATABASE > backup.sql

    You will be prompted for a password - this is your MySQL user's password.

    The MySQL database will be exported to a file named "backup.sql" in your current direc...

    [Read more...]

    How to Schedule a Backup of All MySQL Databases on Ubuntu

    Posted in Linux Servers on Nov 16, 2018

    Step 1: Create the Backup Script

    Create a folder to store your backup script in. I suggest /scripts for this example: sudo mkdir /scripts

    Create a file called mysql-backup.sh inside the scripts folder:

    sudo vim /scripts/mysql-backup.sh

    Add the following code to the file and save it:

    #!/bin/bash
    #----------------------------------------
    # OPTIONS
    #----------------------------------------
    USER='root'       # MySQL User
    PASSWORD='webdev' # MySQL Password
    DAYS_TO_KEEP=0    # 0 to keep forever
    GZIP=1            # 1 = Compress
    BACKUP_PATH='/backups/mysql'
    #----------------------------------------
    
    #...
    [Read more...]

    How to Schedule a Backup of All Websites Hosted on Ubuntu

    Posted in Linux Servers on Nov 15, 2018

    Step 1: Create the Backup Script

    The first thing we need to do is create a simple backup script that will backup websites located in /var/www. The script will change into the directory and then loop through archiving each folder into /backups/www. It will also be able to cleanup backups older than X days.

    Create a folder to store your backup script in. I suggest /scripts for this example:

    sudo mkdir /scripts

    Create a file called www-backup.sh inside the scripts folder:

    sudo vim /scripts/www-backup.sh

    Add the following code to the file and save it:

    #!/bin/bash
    #---------------------------------...
    [Read more...]

    CentOS Web Panel Installation

    Posted in Linux Servers on Nov 14, 2018

    First, we prepare the server or VPS for CentOS Web Panel
    yum -y install wget
    
    yum -y update
    
    reboot

    Set Hostname

    After the reboot is finished you would need a hostname for the server you are installing CWP on.

    To do that log into your server and type in the following:

    hostname srv.cloudtechtiq.com

    Downlaod & installation steps for CentOS 7 server

    cd /usr/local/src
    wget http://centos-webpanel.com/cwp-el7-latest
    sh cwp-el7-latest
    
    After the screen has stopped moving which takes around 30-40 minutes you need to reboot your server to complete the installation:
    
    reboot

    That is it now you have CentO...

    [Read more...]

    How to Set or Change Hostname in CentOS 7

    Posted in Linux Servers on Oct 31, 2018

    to change or set a CentOS 7 machine hostname, use the hostnamectl

    hostnamectl set-hostname your-new-hostname

    hostname command you can also use hostnamectl command to display a Linux machine hostname

    hostnamectl

    New hostname, a system reboot is required, issue one of the below commands in order to reboot a CentOS 7 machine

    init 6
    systemctl reboot
    shutdown -r
    [Read more...]

    How to extend the volume size on ec2 instance aws

    Posted in EC2-Hosting, Linux Servers on Oct 30, 2018

    1. Confirm the kernel.

      # uname -r

    2.6.32-431.29.2.el6.x86_64

    1. Confirm the initial allocated size

      # df -h

      Filesystem Size Used Avail Use% Mounted on

      /dev/xvda1 7.9G 797M 6.7G 11% /

      tmpfs 498M 0 498M 0% /dev/shm

      # lsblk

      NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 15G 0 disk └─xvda1 202:1 0 8G 0 part /

    2. Install EPEL6 Repo

      # wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
      # rpm -ivh epel-release-6-8.noarch.rpm
    3. Install the dracut & cloud-utils growpart modules-growroot

      # yum install -y dracut-modules-growroot cloud-utils-growpart
    4. The initrd needs...

    [Read more...]

    Check Apache concurrent Connections using Netstat command

    Posted in Linux Servers on Oct 12, 2018

    When your server is hitting high & overload, you might want to check, how many active connections are there and which IP take maximum of hit/connection from apache.

    To Count Apache concurrent connection’s, use any of the below commands.

    netstat -nt | grep :80 | wc -l
    
    netstat -plan|grep :80 | wc -l
    
    netstat -an | grep 'EST' | wc -l
    
    netstat -ant | grep ESTABLISHED | grep :80 | wc -l
    
    ps -A | grep httpd | wc -l
    
    ps -ef | grep http | wc -l
    
    ps aux | grep httpd | wc -l
    
    ps aux | grep http | grep -v "\(root\|grep\)" | wc -l

    To print the active Internet connections to the server at port 80 and sort...[Read more...]

    How to sync the data from one server to another server via ssh

    Posted in Linux Servers on Oct 11, 2018

    Sync the data from one server to another server using rsync on linux server.

    Rsync is one of common ways to copy files and folders between two servers, whether the servers are local or remote.

    Login to the server via ssh OR putty Gen windows application.

    ssh root@oldserverIP 
    
    rsync -ravP /home/user/file_name root@xx.xx.xx.xx:/home/user/d

    Here first refers the source path from where you are syncing the file

    and xx.xx.xx.xx refers destination server IP and the destination path where you would like to save the data.

    Please check the following usefull rsync variables :

    -v : Verbose
    
    -a : archive...
    [Read more...]