How to Install CentOS on Server

Step 1:

ins1

Step 2:

ins2

Step 3:

ins3

Step 4:

ins4

Step 5:

ins5

Step 6:

ins6

Step 7:

ins7

Step 8:

ins8

Step 9:

ins9

Step 10:

ins10

Step 11:

ins11

Step 12:

ins12

Mircosoft Window 10 Requirements

Here’s what Microsoft says you need to run Windows 10:

  • Processor: 1 gigahertz (GHz) or faster.
  • RAM: 1 gigabyte (GB) (32-bit) or 2 GB (64-bit)
  • Free hard disk space: 16 GB.
  • Graphics card: Microsoft DirectX 9 graphics device with WDDM driver.
  • A Microsoft account and Internet access.

How to Create Alias in Linux

The alias command can be used if you want to create a ‘shortcut’ to a shell command.

Syntax

# alias name='command'

Configuration

There are some frequently used commands, so in order to create the shortcuts we create the aliases for them in ~/.bashrc or /etc/bash.bashrc file.

# vi ~/.bashrc

alias search='grep'
alias v='vdir'
alias vdir='/bin/ls $LS_OPTIONS --format=long'
alias which='type -path'
alias wtf='watch -n 1 w -hs'
alias wth='ps -uxa | more'
alias cd..='cd ..'
alias cp='cp -i'
alias d='ls'
alias df='df -h -x supermount'
alias du='du -h'
alias egrep='egrep --color'
alias fgrep='fgrep --color'
alias grep='grep --color'
alias ls='ls -F --color=auto'
alias l='ls'
alias la='ls -a'
alias ll='ls -l'
alias lsd='ls -d */'
alias md='mkdir'
alias mv='mv -i'
alias p='cd -'
alias rd='rmdir'
alias rm='rm -i'

Save the file and enjoy shortcuts 🙂

Happy System Administrator Day

System Administrator Appreciation Day, also known as Sysadmin Day, SysAdminDay, SAD or SAAD, is an annual event created by system administrator Ted Kekatos. The event exists to show appreciation for the work of sysadmins and other IT workers. It is celebrated on the last Friday in July.

The first System Administrator Appreciation Day was celebrated on July 28, 2000. Kekatos was inspired to create the special day by a Hewlett-Packard magazine advertisement in which a system administrator is presented with flowers and fruit-baskets by grateful co-workers as thanks for installing new printers. Kekatos had just installed several of the same model printer at his workplace.

The official SysAdmin Day website includes many suggestions for the proper observation of the holiday. Most common is cake and ice cream.

How To Install OwnCloud on Ubuntu

Step 1: Prerequisites

To install the OwnCloud on Ubuntu, firstly you have to install and configure following prerequisites.

Step 2: Create Database

Create a new MySQL database for OwnCloud using the following commands.

# mysql -u root -p
Enter password:

mysql> CREATE USER 'ownclouduser'@'localhost' IDENTIFIED BY 'YOURPASSWORD';
mysql> CREATE DATABASE ownclouddb;
mysql> GRANT ALL ON ownclouddb.* TO 'ownclouduser'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> exit

Step 3: Installation

First we will need to download the latest stable release of OwnCloud on your server.

# wget https://download.owncloud.org/community/owncloud-8.0.0.tar.bz2
# tar -xvf owncloud-8.0.0.tar.bz2 -C /var/www/html/
# chown www-data:www-data -R /var/www/html/owncloud/

Step 4: Configuration

# vi /etc/apache2/sites-available/owncloud.conf

Alias /owncloud /var/www/html/owncloud


Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
allow from all

Step 5: Restart Apache Service

# service apache2 restart

Step 6: Open OwnCloud on Browser

Open your favorite browser and hit the URL http://YOUR-IP-ADDRESS/owncloud

owncloud2

Click on storage & database

owncloud3

Enter the username and password along with database name, then press Finish Setup button

owncloud4

How to Configure Firewall in Linux

A Firewall is a network security system that controls the incoming and outgoing network traffic based on an applied rule set. A firewall controls access to the resources of a network through a positive control model.

Accept – Allow the connection.

Drop – Drop the connection, act like it never happened. This is best if you don’t want the source to realize your system exists.

Reject – Don’t allow the connection, but send back an error. This is best if you don’t want a particular source to connect to your system, but you want them to know that your firewall blocked them.

View Firewall

To view the current firewall configuration use the command.

# iptables -L

Firewall Configuration

Edit the iptables configuration file:

# vi /etc/sysconfig/iptables

-A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -p tcp --dport 443 -j ACCEPT

OR
Execute the command on shell.

Firewall Rules:

Rule 1: Block all IP address

To block all connections from the specific IP address, define the rule

# iptables -A INPUT -s 192.168.0.100 -j DROP

Rule 2: Block network range of IP addresses

To block all of the IP addresses in specific network range then use the rule

# iptables -A INPUT -s 192.168.0.0/24 -j DROP

Rule 3: Enable Specific Ports

In order to check the well known port chart, use the link

# iptables -A input -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
# iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
# iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
# iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 25 -j ACCEPT
# iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 110 -j ACCEPT
# iptables -A INPUT -s 192.168.1.0/24 -p tcp -m tcp --dport 22 -j ACCEPT

Save Firewall Service

Save the iptable rules.

# /sbin/service iptables save

TCP/UDP Ports

Fatal error YUM: Thread died in Berkeley DB library

I got an error while upgrading my CentOS server

# yum update
rpmdb: Thread/process 29212/3077682880 failed: Thread died in Berkeley DB library
error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 -  (-30974)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed

Step 1: Delete Databases

Remove database files from location /var/lib/rpm/

# rm /var/lib/rpm/__db*
rm: remove regular file `/var/lib/rpm/__db.001'? y
rm: remove regular file `/var/lib/rpm/__db.002'? y
rm: remove regular file `/var/lib/rpm/__db.003'? y
rm: remove regular file `/var/lib/rpm/__db.004'? y

Step 2: Run updates

Now execute the yum update command.

# yum update
Loaded plugins: fastestmirror, security
Setting up Update Process
Loading mirror speeds from cached hostfile
 * base: mirror.fysik.dtu.dk
 * epel: ftp.crc.dk
 * extras: mirror.fysik.dtu.dk
 * updates: mirror.fysik.dtu.dk
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
--> Running transaction check
---> Package bind.i686 32:9.8.2-0.30.rc1.el6_6.1 will be updated
---> Package bind.i686 32:9.8.2-0.30.rc1.el6_6.3 will be an update
---> Package bind-chroot.i686 32:9.8.2-0.30.rc1.el6_6.1 will be updated
---> Package bind-chroot.i686 32:9.8.2-0.30.rc1.el6_6.3 will be an update
---> Package bind-devel.i686 32:9.8.2-0.30.rc1.el6_6.1 will be updated
---> Package bind-devel.i686 32:9.8.2-0.30.rc1.el6_6.3 will be an update
---> Package bind-libs.i686 32:9.8.2-0.30.rc1.el6_6.1 will be updated
---> Package bind-libs.i686 32:9.8.2-0.30.rc1.el6_6.3 will be an update
---> Package bind-sdb.i686 32:9.8.2-0.30.rc1.el6_6.1 will be updated
---> Package bind-sdb.i686 32:9.8.2-0.30.rc1.el6_6.3 will be an update
---> Package bind-utils.i686 32:9.8.2-0.30.rc1.el6_6.1 will be updated
---> Package bind-utils.i686 32:9.8.2-0.30.rc1.el6_6.3 will be an update
---> Package busybox.i686 1:1.15.1-20.el6 will be updated
---> Package busybox.i686 1:1.15.1-21.el6_6 will be an update

Mark Zuckerberg announced facebook fifth data center

Mark Zuckerberg just announced that facebook fifth data center will be built in Fort Worth, Texas.

Facebook data centers power Facebook and will help connect billions of people around the world in the coming years.

Fort Worth will be one of the most advanced and energy efficient data centers in the world. It will use 100% renewable energy and it will actually add 200 megawatts of new wind energy to the Texas power grid. It will be built using hardware designed and developed through the Open Compute Project.

This is just one example of new technologies we’re building to create internet services at planetary scale. We’re grateful to the Fort Worth community for helping to make the world more open and connected, and we’re glad to be a part of that community.

How to Verify & Block DDOS Attack in Linux

Introduction

A denial-of-service (DoS) attack is an attempt to make a machine or network resource unavailable to its intended users. They target a wide variety of important resources, from banks to news websites, and present a major challenge to making sure people can publish and access important information. A distributed denial-of-service (DDoS) is where incoming traffic comes from more than one – and often thousands – of unique IP’s, either from botnets or via various types of reflection attack.

Verify DDOS Attack

Show only active Internet connections to the server on port 80, this is the http port and so it’s useful if you have a web server, and sort the results. Useful in detecting a single flood by allowing you to recognize many connections coming from one IP.

# netstat -an | grep :80 | sort

List all the unique IP addresses of the node that are sending SYN_REC connection status.

# netstat -n -p | grep SYN_REC | awk '{print $5}' | awk -F: '{print $1}'

Use netstat command to calculate and count the number of connections each IP address makes to the server.

# netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

A lot of outbound bruteforces lately have been running as “/usr/bin/host”
If you run a “ps faux” look for any processes by that name, or any suspicious PHP processes (or other suspect processes forked off of httpd or php).

# ps faux

If you find them, “lsof -p $PID” will help you hunt it down.

# lsof -p $PID

Block an IP address using IPTABLES

In order to block an IP on your Linux server you need to use iptables tools and netfilter firewall. To block IP address you need to type iptables command as follows:

Step 1: Add IP Address in Firewall

# iptables -A INPUT -s xxx.xxx.xxx.xxx -j DROP

Step 2: Kill the apache sessions

# netstat -ant | awk '{print $6}' | sort | uniq -c | sort -n
# killall -KILL httpd

Step 3: Restart apache service

After killing the apache sessions restart the apache server.

For CentOS/RedHat/Fedora

# service httpd start

For Ubuntu/Debian/OpenSUSE

# /etc/init/d/apache2 restart