Tuesday, 9 December 2014

How to Install ClamAV and Configure Daily Scanning on Linux





This article will guide you through the installation of ClamAV on Linux based system. Once installed, we will also configure a daily scan on our Linux based server.
ClamAV is an open source (GPL) antivirus engine designed for detecting Trojans, viruses, malware and other malicious threats on Linux. In this article, we will only be configuring ClamAV to run scheduled/on-demand scans; not resident scans.

A. Install ClamAV

1. Install EPEL repo

Before we can do proceed, you must ensure that you have the EPEL yum repository enabled.

2. Install required ClamAV packages

1 yum install clamav clamd

3. Start the clamd service and set it to auto-start

1 /etc/init.d/clamd on
2 chkconfig clamd on
3 /etc/init.d/clamd start

4. Update ClamAV’s signatures

1 /usr/bin/freshclam
Note: ClamAV will update automatically, as part of /etc/cron.daily/freshclam.

B. Configure Daily Scan

In this example, we will configure a cronjob to scan the /home/ directory every day:

1. Create cron file:

1 vim /etc/cron.daily/manual_clamscan
Add the following to the file above. Be sure to change SCAN_DIR to the directory that you want to scan:
1 #!/bin/bash
2 SCAN_DIR="/home"
3 LOG_FILE="/var/log/clamav/manual_clamscan.log"
4 /usr/bin/clamscan -i -r $SCAN_DIR >> $LOG_FILE
Give our cron script executable permissions:
1 chmod +x /etc/cron.daily/manual_clamscan
You can even run the above script to ensure that it works correctly.
And you’re done! That should be the minimum required to
1. install ClamAV and 2. Perform a daily scan of a specific directory.

Sunday, 7 December 2014

Linux: Comparing packages on two servers and installing the difference.




Linux: Comparing packages on two servers and installing the difference.



I know this isn’t Oracle related but if you have a position in a small company like myself, chances are you are performing more than DBA duties.   We just recently hired a linux admin but he’s on vacation this week and there’s a new server to stage for a Portal environment.

In the past I have just run system-install-packages on an existing server and the new one and compare the packages.   Time consuming, error prone, etc.  Also, any patches not installed from the base system packages won’t be captured.

Given those reasons I decided to use the command line.   If you have done something similar in the past and have a better way of doing it feel free to leave a comment.

Step 1:  Get a list of RPM packages from both servers:


rpm -qa --qf "%{NAME}\n” | sort > rpms_newserver.txt



Do the same on the second server.    Since the packages may not have been installed in the same order, 
I pipe it to sort, otherwise I believe it would cause problems with the next step.



The rpms_newserver.txt document will have a listing of files, ex:

a2ps
acl
acpid
alacarte
.
.
.

zsh


Step 2: Put both package lists in the same directory on the new server and run the linux command diff to compare the files.

diff rpms_oldserver.txt rpms_newserver.txt | grep "<" > package_list.txt

The diff command compares two files and displays the differences.   To get a list of the lines missing from the rpms_newserver.txt file we grep for the less than arrow “<” and pipe it to a new file. 

Step 3: The package_list.txt document is in the same format as the files in step 1.   Next I used vi to insert the yum command into the file so it can be executed like a script.

Open the package_list.txt file with vi and type:

:1,$s/< /yum install -y /g

Save the document and now it looks like:

yum install -y a2ps
yum install -y alacarte
yum install -y alchemist



Step 4:

Execute the package_list.txt document:

sh package_list.txt

That’s it, once it finishes all the packages should be installed.

DHCP server Configuring in Solaris





A Dynamic Host Configuration Protocol (DHCP) server leases IP address to clients connected to the network and has DHCP client enabled on their network interface.
Before we can setup a start the DHCP server we need to install DHCP configuration packages. Detail information about installing packages in provided in recipe of chapter 1. But to save the time we can use the following command to install the packages.

 # pkg install SUNWdhcs


After installing these packages we can continue with the next step.
How to do it…
First thing to setup the DHCP server is creating the storage and initial settings for the DHCP server. Following command does the trick for us.

 # dhcpconfig -D -r SUNWfiles -p /fpool/dhcp_fs -a 192.168.2.254 -d domain.nme -h files -l 86400


In the above command we used several parameters and options, each one of these options are explained below.
  • The -D specifies that we are setting up a new instance of the DHCP service.
  • The -r SUNWfiles specifies the storage type. Here we are using plain-text storage while SUNWbinfiles and SUNWnisplus are available as well.
  • The -p /fpool/dhcp_fs specifies the absolute path to where the configuration files should be stored.
  • The -a 192.168.2.15 specifies the DNS server to use on the LAN. We can multiple comma separated addresses for DNS servers.
  • The -d domain.nme specifies the network domain name.
  • The -h files specifies where the host information should be stored. Other values are nisplus and dns.
  • The -l 86400 specifies the lease time in seconds.
Now that the initial configuration is created we should proceed to the next step and create a network.

 # dhcpconfig -N 192.168.2.0 -m 255.255.255.0  -t 192.168.2.1


Parameters we used in the above command are explained below.
  • The -N 192.168.2.0 specifies the network address.
  • The -m 255.255.255.0 specifies the network mask to use for the network
  • The -t 192.168.2.1 specifies the default gateway
All configurations that we created are stored in DHCP server configuration files. We can manage the configurations using the dhtadm command. For example to view all of the current DHCP server configuration assemblies we can use the following command.
 # dhtadm -P


This command’s output is similar to the following figure.

Each command we invoked previously is stored as a macro with a unique name in the DHCP configuration storage. Later on we will use these macros in subsequent commands.
Now we need to create a network of addresses to lease. Following command adds the addresses we want to lease.
 # pntadm -C 192.168.2.0


If we need to reserve an address for a specific host or a specific interface in a host we should add the required configuration to the system to ensure that our host or interface receives the designated IP address. For example:

 # pntadm -A 192.168.2.22 -f MANUAL -i 01001BFC92BC10 -m 192.168.2.0 -y 192.168.2.0

In the above command we have:
  • The -A 192.168.2.22 adds the IP address 192.168.2.22.
  • The -f MANUAL sets the flag MANUAL in order to only assign this IP address to the MAC address specified.
  • The -i 01001BFC92BC10 sets the MAC address for the host this entry assigned  to it.
  • The -m 192.168.2.0 specifies that this host is going to use the 192.168.2.0 macro.
  • The –y asks the command to verify that the macro entered actually exists.
  • The 192.168.2.0 Specifies the network the address is assigned to.
Finally we should restart the DHCP server in order for all the changes to take effect. Following command restarts the corresponding service.

  # svcadm restart dhcp-server


When we setup the DHCP service, we store the related configuration in the storage of our choice. When we start the service, it reads the configuration from the storage and wait dormant until it receives a request for leasing an IP address. The service checks the configuration and if an IP was available for lease, it leases the IP to the client.
Prior to leasing the IP, DHCP service checks all leasing conditions like leasing a specific IP address to a client to ensure that it leases the right address to a client, etc.
We can use the DHCP Manager GUI application to configure a DHCP server. The DHCP manager can migrate the DHCP storage from one format to another. To install the DHCP manager package we can use the following command.

 # pkg install SUNWdhcm

Now we can invoke the DHCP manager using the following command which opens the DHCP Manager welcome page shown in the following figure.

 # dhcpmgr





Saturday, 29 November 2014

File Shares In Windows Server 2012



File and Storage Role is installed by default in Windows Server 2012. This means you can create a file share with a very minimal amount of work on a brand new server. To get started, as with many things regarding Server 2012, open Server Manager.
From Server Manager, click on File and Storage Services in the Server Manager sidebar. Then click on Shares. From the Shares screen, click on the Shares drop-down list and then click on New Share.
This will open the New Share Wizard. From here, select a type of share. For the purposes of this article, we’ll create a very basic SMB share, so click on “SMB Share – Quick.” Then click on the Next button.
At the Share Location screen, I like to click on “Type a custom path” and then click on the Browse button.
At the Select Folder screen, browse to the folder you’d like to share out and then click on the Select Folder button. Then click on Next back at the Share Location screen.
At the Share Name screen of the New Share Wizard, enter the name you want users to see when accessing the share in the Share Name field and the description (if any) that users will see in the screen when connecting to the share. You’ll also see the local path used to connect to that share on the server as well as the path that will be used to connect remotely in this screen. Click Next once you’ve entered the information.
At the Other Settings screen, you have 4 options (checkboxes):
  • Enable Access Based Enumeration: If you have Mac clients this is often a bad idea. This feature ends up not showing people objects they don’t have access to. It’s great in a purely Windows environment, thought.
  • Allow Caching of Share: Allows Windows clients to right-click on a share and choose to cache it.
  • Enable Branch Cache on the File Server: Allows a computer in a branch office to act as a Branch Cache server/workgroup server.
  • Encrypt data access: Encrypts traffic to the share.
Most of these options are pretty irrelevant to the Mac and Linux, but can be helpful in purely Windows environments, especially if you need additional security or want your users caching data from the share. Once you’ve chosen the options that best work for you, click Next.
At the Permissions screen, choose who has access to connect to the share. Note that controlling permissions to access objects from inside the share is done separately through the share and this option is just used to configure who can mount/map to the share. Click Next once only the users you want to access the share have the appropriate level of access.
At the Confirmation screen, verify that all the settings for the share are correct and then click on the Create.
Once the share is created, click on Close button.
Then connect to the share and verify that the settings are as appropriate. Once done, create the subdirectories for the root level and configure permissions as appropriate.

Use Public Yum Server for Oracle Linux





There is no yum repository in Oracle Linux after installation,
so it's necessarry to set it in order to update the system with yum command.
Oracle provides public yum server and we can use it for free to set.

⇒ Public Yum Server : http://public-yum.oracle.com/


Download repository like follows. (The example below is for Oracle Linux 6)


[root@dlp ~]# cd /etc/yum.repos.d
[root@dlp ~]# wget http://public-yum.oracle.com/public-yum-ol6.repo

How to enable root user in Ubuntu




The root user in Ubuntu is disabled by default because his password is not set. But if you'd like to use root user by some reason, enable it like follows.

1) Set root password

sysstec@ubuntu:~$ sudo passwd root

Enter new UNIX password: # set root password

Retype new UNIX password: # confirm

passwd: password updated successfully
sysstec@ubuntu:~$ su -

Password: # root password

root@ubuntu:~# # just switched

The examples on this site show as a root user from now. If you use sudo, add "sudo" at the head of commands.


2) If you enable root, limit users to switch to root.

root@ubuntu:~# vi /etc/pam.d/su # line 15: uncomment and add a group that can switch to root

auth   required   pam_wheel.so   group=adm


root@ubuntu:~# usermod -G adm sysstec

Friday, 28 November 2014

Data Mining - Terminologies




Data Mining

Data Mining is defined as extracting the information from the huge set of data. In other words we can say that data mining is mining the knowledge from data. This information can be used for any of the following applications:
  • Market Analysis
  • Fraud Detection
  • Customer Retention
  • Production Control
  • Science Exploration

Data Mining Engine

Data mining engine is very essential to the data mining system.It consists of a set of functional modules. These modules are for following tasks:
  • Characterization
  • Association and Correlation Analysis
  • Classification
  • Prediction
  • Cluster analysis
  • Outlier analysis
  • Evolution analysis

Knowledge Base

This is the domain knowledge. This knowledge is used to guide the search or evaluate the interestingness of resulting patterns.

Knowledge Discovery

Some people treat data mining same as Knowledge discovery while some people view data mining essential step in process of knowledge discovery. Here is the list of steps involved in knowledge discovery process:
  • Data Cleaning
  • Data Integration
  • Data Selection
  • Data Transformation
  • Data Mining
  • Pattern Evaluation
  • Knowledge Presentation

User interface

User interface is the module of data mining system that helps communication between users and the data mining system. User Interface allows the following functionalities:
  • Interact with the system by specifying a data mining query task.
  • Providing information to help focus the search.
  • Mining based on the intermediate data mining results.
  • Browse database and data warehouse schemas or data structures.
  • Evaluate mined patterns.
  • Visualize the patterns in different forms.

Data Integration

Data Integration is data preprocessing technique that merges the data from multiple heterogeneous data sources into a coherent data store. Data integration may involve inconsistent data therefore needs data cleaning.

Data Cleaning

Data cleaning is a technique that is applied to remove the noisy data and correct the inconsistencies in data. Data cleaning involves transformations to correct the wrong data. Data cleaning is performed as data preprocessing step while preparing the data for a data warehouse.

Data Selection

Data Selection is the process where data relevant to the analysis task are retrieved from the database. Sometimes data transformation and consolidation are performed before data selection process.

Clusters

Cluster refers to a group of similar kind of objects. Cluster analysis refers to forming group of objects that are very similar to each other but are highly different from the objects in other clusters.

Data Transformation

In this step data are transformed or consolidated into forms appropriate for mining by performing summary or aggregation operations.

Data Mining Introduction




Introduction

There is huge amount of data available in Information Industry. This data is of no use until converted into useful information. Analysing this huge amount of data and extracting useful information from it is necessary.
The extraction of information is not the only process we need to perform, it also involves other processes such as Data Cleaning, Data Integration, Data Transformation, Data Mining, Pattern Evaluation and Data Presentation. Once all these processes are over, we are now position to use this information in many applications such as Fraud Detection, Market Analysis, Production Control, Science Exploration etc.

What is Data Mining

Data Mining is defined as extracting the information from the huge set of data. In other words we can say that data mining is mining the knowledge from data. This information can be used for any of the following applications:
  • Market Analysis
  • Fraud Detection
  • Customer Retention
  • Production Control
  • Science Exploration

Need of Data Mining

Here are the reasons listed below:
  • In field of Information technology we have huge amount of data available that need to be turned into useful information.
  • This information further can be used for various applications such as market analysis, fraud detection, customer retention, production control, science exploration etc.

Data Mining Applications

Here is the list of applications of Data Mining:
  • Market Analysis and Management
  • Corporate Analysis & Risk Management
  • Fraud Detection
  • Other Applications

Market Analysis and Management

Following are the various fields of market where data mining is used:
  • Customer Profiling - Data Mining helps to determine what kind of people buy what kind of products.
  • Identifying Customer Requirements - Data Mining helps in identifying the best products for different customers. It uses prediction to find the factors that may attract new customers.
  • Cross Market Analysis - Data Mining performs Association/correlations between product sales.
  • Target Marketing - Data Mining helps to find clusters of model customers who share the same characteristics such as interest, spending habits, income etc.
  • Determining Customer purchasing pattern - Data mining helps in determining customer purchasing pattern.
  • Providing Summary Information - Data Mining provide us various multidimensional summary reports

Corporate Analysis & Risk Management

Following are the various fields of Corporate Sector where data mining is used:
  • Finance Planning and Asset Evaluation - It involves cash flow analysis and prediction, contingent claim analysis to evaluate assets.
  • Resource Planning - Resource Planning It involves summarizing and comparing the resources and spending.
  • Competition - It involves monitoring competitors and market directions.

Fraud Detection

Data Mining is also used in fields of credit card services and telecommunication to detect fraud. In fraud telephone call it helps to find destination of call, duration of call, time of day or week. It also analyse the patterns that deviate from an expected norms.

Other Applications

Data Mining also used in other fields such as sports, astrology and Internet Web Surf-Aid.

Wednesday, 26 November 2014

DB2 - Server Installation





DB2 - Server Installation


Introduction

You can download the DB2 Server trial version or purchase the product license from www.ibm.com. There are two separate DB2 servers available for downloading, depending upon the size of operating system, on which it is intended to execute. For example, if you want to download a DB2 server for 32bit Linux or UNIX operating system, then you need to download a 32 bit DB2 server. The same applies for 64bit DB2 server.

Hardware requirements

Processor : Minimum Core 2Duo
Ram : 1GB minimum
Hard disk : 30GB minimum

Software requirements

Before installing the DB2 server, your system needs to get ready with the required software on it. For Linux, you need to install “libstdc++6.0”.

Checking system compatibility

Before installing DB2 Server, you need to verify if your system is compatible with the DB2 server. For confirming the compatibility, you need to call 'db2prereqcheck' command on command console.

Installing DB2 on Linux operating system

Open the Terminal and set the db2 installation image folder path on console using “CD <DB2 installation folder>” command. Then type “./db2prereqcheck” command, which confirms the compatibility of your system with DB2 server.
./db2prereqcheck
Figure-1 shows the compatibility requirements of Linux operating system and hardware system.
Follow the given steps for installing DB2 on your Linux system:
  • Open the terminal.
  • Login as root user.
  • Open DB2 Installation folder.
  • Type “./db2setup” and press Enter.
This process will start execution of DB2 server setup.
DB2 Server Setup
Type “./db2setup” and press Enter on root terminal to start setup process of DB2 Server.
On doing so, the “Set up Launch Pad” screen appears. [Figure-2]
Set up Launch Pad
On Setup Launch pad page, select “Install a Product” option from left side menu. Select option “DB2 Advanced Enterprise Server Edition”. Select “Install New” Button.
A new frame appears with name “DB2 setup wizard”. Click “Next”. [Figure-3]
DB2 setup wizard
The next screen appears with DB2 license agreement. Select “I accept the terms…” Click “Next”. [Figure-4]
DB2 license agreement
Next screen comes up with offer of Installation type, which is set to “Typical” by default.
Keep the same selection. Click “Next”. [Figure-5]
Installation Action
The next screen appears with installation action.
Select “Install DB2 Advanced Enterprise Server Edition…”
Click “Next”. [Figure-6]
Installation Directory
On the next screen, the setup program asks for selection of installation directory.
Keep the default and click “Next”.
Server Info
The next screen comes up with the user authentication. Enter your password for “dasusr1” user.
(Your password can be identical to username so that it is convenient to remember.)
DB2 Instance
On the following screen, the setup asks you for creation of DB2 Server Instance.
Here, it is creating a DB2 instance with name “db2inst1”.
DB2 Instance Name
The next screen asks you the number of partitions you require for your default instance.
You have a choice of “single or Multiple” partitions.
Select “single partition instance”. Click “next”.
DB2 Partition
On the next screen, the setup asks you for authentication for DB2 instance being created.
Here, by default username is created as “db2inst1”. You can enter password same as username.
Click “Next”.
Authentication
On the next screen, the setup asks to enter authentication information for “db2fenc” user.
Here, you can enter password same as username.
Click “Next”.
Authentication Information
On the next screen, you can select “Do not setup your db2 server to send notifications at this time” option.
Click ”Next”.
Notification
The next screen shows you the information about db2 setup.
Click “Finish”.
The DB2 Installation procedure is complete at this stage.

Verifying DB2 installation

You need to verify the installation of DB2 server for its usefulness. On completing the DB2 Server installation, logout from current user mode and login to “db2inst1” user. In “db2inst1” user environment, you can open terminal and execute the following commands to verify if your db2 product is installed properly or not.

db2level

This command shows the current version and service level of the installed DB2 product for current instance.
Syntax:
db2level 
Example:
db2level 
Output:
DB21085I Instance "db2inst2" uses "64" bits       
And DB2 code release "SQL10010" with level     
identifier "0201010E". Informational tokens     
are "DB2 v10.1.0.0", "s120403",     
"LINUXAMD64101", and Fix Pack "0".  
Product is installed at "/home/db2inst2/sqllib".  

db2licm

This command shows all the license related information of our DB2 Product.
Syntax:
db2licm <parameter> 
Example:
db2licm -l 
Output:
Product name:                     "DB2 Advanced Enterprise Server Edition" 
License type:                     "Trial" 
Expiry date:                      "10/02/2014" 
Product identifier:               "db2aese" 
Version information:              "10.1"  
Product name:                     "DB2 Connect Server" 
License type:                     "Trial" 
Expiry date:                      "10/02/2014" 
Product identifier:               "db2consv" 
Version information:              "10.1" 

Command Line Processor (CLP)

The CLP can be started in one of the three modes:
  1. Command mode: In this mode, each command and SQL statement must be prefixed by “db2”. For example, query “db2 activate database sample”.
  2. Interactive input mode: you can launch this mode by using the “db2” command. Here, you can pass SQL statements without prefix. For example, “activate database sample”.
  3. Batch mode: Here, you need to create a script file, which contains all SQL queries of requirements and save the file with “.db2” extension. You can call this in command line using syntax “db2 –tf <filename.db2>”.

DB2 - Introduction





DB2 - Introduction



Overview

DB2 is a database product from IBM. It is a Relational Database Management System (RDBMS). DB2 is designed to store, analyze and retrieve the data efficiently. DB2 product is extended with the support of Object-Oriented features and non-relational structures with XML.

History

Initially, IBM had developed DB2 product for their specific platform. Since year 1990, it decided to develop a Universal Database (UDB) DB2 Server, which can run on any authoritative operating systems such as Linux, UNIX, and Windows.

Versions

For IBM DB2, the UDB current version is 10.5 with the features of BLU Acceleration and its code name as 'Kepler'. All the versions of DB2 till today are listed below:
Version
Code Name
3.4
Cobweb
8.1, 8.2
Stinger
9.1
Viper
9.5
Viper 2
9.7
Cobra
9.8
It added features with Only PureScale
10.1
Galileo
10.5
Kepler

Data server editions and features

Depending upon the requirement of needful features of DB2, the organizations select appropriate DB2 version. The following table shows DB2 server editions and their features:
Editions
Features
Advanced Enterprise Server Edition and Enterprise Server Edition (AESE / ESE)
It is esigned for mid-size to large-size business organizations. Platform - Linux, UNIX, and Windows. Table partitioning High Availability Disaster Recovery (HARD) Materialized Query Table (MQTs) Multidimensional Clustering (MDC) Connection concentrator Pure XML Backup compression Homogeneous Federations
Workgroup Server Edition (WSE)
It is designed for Workgroup or mid-size business organizations. Using this WSE you can work with - High Availability Disaster Recovery (HARD) Online Reorganization Pure XML Web Service Federation support DB2 Homogeneous Federations Homogeneous SQL replication Backup compression
Express -C
It provides all the capabilities of DB2 at zero charge. It can run on any physical or virtual systems with any size of configuration.
Express Edition
It is designed for entry level and mid-size business organizations. It is full featured DB2 data server. It offers only limited services. This Edition comes with - Web Service Federations DB2 homogeneous federations Homogeneous SQL Replications Backup compression
Enterprise Developer Edition
It offers only single application developer. It is useful to design, build and prototype the applications for deployment on any of the IBM server. The software cannot be used for developing applications.

Tuesday, 25 November 2014

What is Operating System ?





It is a program with following features:
  • An operating system is a program that acts as an interface between the software and the computer hardware.
  • It is an integrated set of specialised programs that are used to manage overall resources and operations of the computer.
  • It is specialised software that controls and monitors the execution of all other programs that reside in the computer, including application programs and other system software.

Objectives of Operating System

  • To make a computer system convenient to use in an efficient manner
  • To hide the details of the hardware resources from the users
  • To provide users a convenient interface to use the computer system
  • To act as an intermediary between the hardware and its users and making it easier for the users to access and use other resources
  • To manage the resources of a computer system
  • To keep track of who is using which resource, granting resource requests, according for resource using and mediating conflicting requests from different programs and users
  • To provide efficient and fair sharing of resources among users and programs
Operating System

Characteristics of Operating System

  • Memory Management -- keeps tracks of primary memory i.e. what part of it is in use by whom, what part is not in use etc. and allocates the memory when a process or program requests it.
  • Processor Management -- allocates the processor(CPU) to a process and deallocates processor when it is no longer required.
  • Device Management -- keeps track of all devices. This is also called I/O controller that decides which process gets the device, when, and for how much time.
  • File Management -- allocates and de-allocates the resources and decides who gets the resources.
  • Security -- prevents unauthorized access to programs and data by means of passwords and similar other techniques.
  • Job accounting -- keeps track of time and resources used by various jobs and/or users.
  • Control over system performance -- records delays between request for a service and from the system.
  • Interaction with the operators -- The interaction may take place via the console of the computer in the form of instructions. Operating System acknowledges the same, does the corresponding action and informs the operation by a display screen.
  • Error-detecting aids -- Production of dumps, traces, error messages and other debugging and error-detecting methods.
  • Coordination between other software and users -- Coordination and assignment of compilers, interpreters, assemblers and other software to the various users of the computer systems.