CentOS 6 - Desktop Environment - Connect to Windows' remore desktop function by rdesktop


Install rdesktop and connect to Windows. It's necessary to enable remote desktop function on Windows.

[1]
Install rdesktop

[root@dlp ~]# yum -y install rdesktop

[2]
Start X server and input command like follows.

--------------------------------------------------------------------------------------------------------
[root@dlp ~]# rdesktop -u servermadkour -k ja -g 800x600 10.0.0.150
# -u [user name]
# -k [keyboard]
# -g [screen resolution]
# -f [full screen mode]
# -T [screen title]


Just Connected


Setup Local Yum Repository On CentOS / RHEL / Scientific Linux 6.4

We have already shown you how to create a local repository on Ubuntu systems. Today we are going to learn about setting up local yum repository on CentOS 6.4 and other RPM based distributions.
As I noted in my previous tutorial about local repository, if you have to installed software, security updates and fixes often in multiple systems in your local network, then having a local repository is an efficient way. Because all required packages are downloaded over the fast LAN connection from your local server, so that it will save your Internet bandwidth and reduces your annual cost of Internet.
In this tutorial I use two systems as described below:
Yum Server OS         : CentOS 6.4(Minimal Install)
Yum Server IP Address : 192.168.1.200
Client OS             : CentOS 6.3(Minimal Install)
Client IP Address     : 192.168.1.201
Prerequisites
First mount your CentOS 6.4 installation DVD(s). You will probably have two DVD’s for CentOS:
[root@server ~]# mount /dev/cdrom /mnt/
Now the CentOS installation DVD is mounted under /mnt directory. Next install vsftpd package and make the packages available over FTP to your local clients.
To do that change to /mnt/Packages directory:
[root@server ~]# cd /mnt/Packages/
Now install vsftpd package:
[root@server Packages]# rpm -ivh vsftpd-2.2.2-11.el6_3.1.i686.rpm 
warning: vsftpd-2.2.2-11.el6_3.1.i686.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
      1:vsftpd              ########################################### [100%]
Start FTP service and let the service to be started automatically on every reboot:
[root@server Packages]# /etc/init.d/vsftpd start
Starting vsftpd for vsftpd:                                [  OK  ]
[root@server Packages]# chkconfig vsftpd on
We need a package called “createrepo”  to create our local repository. So let us install it too. If you did a minimal CentOS installation, then you might need to install the following dependencies first:
[root@server Packages]# rpm -ivh libxml2-python-2.7.6-8.el6_3.4.i686.rpm warning: 
[root@server Packages]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.i686.rpm 
[root@server Packages]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm
Now install “createrepo” package:
[root@server Packages]# rpm -ivh createrepo-0.9.9-17.el6.noarch.rpm
Build Local Repository
It’s time to build our local repository. Create a storage directory to store all packages from CentOS DVD’s.
As I noted above, we are going to use a FTP server to serve all packages to client systems. So let us create a storage location in our FTP server pub directory.
[root@server ~]# mkdir /var/ftp/pub/localrepo
Now copy all the files from CentOS DVD(s) i.e for /mnt/Packages directory to the “localrepo” directory:
[root@server ~]# cp -ar /mnt/Packages/*.* /var/ftp/pub/localrepo/
Again, mount the CentOS installation DVD 2 and copy all the files to /var/ftp/pub/localrepo directory.
Once you copied all the files, create a repository file called “localrepo.repo” under /etc/yum.repos.d/ directory and add the following lines into the file. You can name this file as your liking:
[root@server ~]# vi /etc/yum.repos.d/localrepo.repo
[localrepo]
name=Unixmen Repository
baseurl=file:///var/ftp/pub/localrepo
gpgcheck=0
enabled=1
Note: Use three slashes in the baseurl.
Now begin building local repository:
[root@server ~]# createrepo -v /var/ftp/pub/localrepo/
Now the repository building process will start. The output will be as shown below:
root@server:~_003
root@server:~_004
After creating repository, disable or rename the existing repositories.
Now update the repository files:
[root@server ~]# yum clean all
[root@server ~]# yum update
Client Side Configuration
Now go to your client systems. Create a new repository file as shown above under /etc/yum.repos.d/ directory and add the following contents:
[root@client ~]# vi /etc/yum.repos.d/localrepo
[localrepo]
name=Unixmen Repository
baseurl:ftp://192.168.1.200/pub/localrepo
gpgcheck=0
enabled=1
Note: Use double slashes in the baseurl and 192.168.1.200 is yum server IP Address.
Now disable or rename the existing repositories and update the local repository files:
[root@client ~]# yum clean all
[root@client ~]# yum update
Probably you will get an error like shown below:
ftp://192.168.1.200/pub/localrepo/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
  Trying other mirror.
This is because your firewall and SELinux might be preventing your client to access the local repository server. So run the following commands in the server side. Allow the default firewall port 21 through your Firewall/Router:
[root@server ~]# vi /etc/sysconfig/iptables
[...]
-A INPUT -p udp -m state --state NEW --dport 21 -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 21 -j ACCEPT
[...]
And update the SELinux booleans for FTP service:
[root@server ~]# setsebool -P ftp_home_dir on
Now try again by updating repository:
[root@client ~]# yum update
root@client:~_005
As you seen in the above output, now your client will get the updates from our server “localrepo” repository, not from any other external repositories.
Let us try install any package. For instance I do httpd package installation:
[root@client ~]# yum install httpd
root@client:~_006

setup-online-e-commerce-shopping-store-with-cs-cart

12
CS-Cart is an open source e-commerce shopping cart solution that can be used to setup your free online shopping store such as eBay, Snapdeal and Flipkart etc. CS-Cart is the best shopping cart solution for building an ecommerce website from a small web store to a virtual shopping mall. A ready storefront, support for many payment and shipping options, full inventory control, unlimited products, promotional tools, and other features out of the box.
CS-Cart comes with three editions: Ultimate(Free)Ultimate (Paid)Multi-vendor(Paid). Please visit this page to view the comparison of these three editions. In this tutorial let us build a free online e-store using CS-Cart software.
We already have shown you how to setup online store using Prestashop in our previous tutorial. In this how-to let us build a online store using using CS-Cart. This how-to was tested on CentOS 6.4, although it will work on other RPM based distro’s. My test box hostname and IP address are server.madkour.com and 192.168.1.200/24. Replace the values with your own where it appropriate.
Prerequisites
First you have to install and configure LAMP server.

Now install the following prerequisites too.
# yum install php-mcrypt php-pdo php-cli php-mysql php-gd php-xml libtool-ltdl mhash mcrypt -y
Create Database and User for CS-Cart
For instance, here i am going to create a database called “cscartdb” and database user called “cscartuser” for CS-Cart.
# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.31-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database cscartdb;
Query OK, 1 row affected (0.02 sec)

MariaDB [(none)]> GRANT ALL ON cscartdb.* TO cscartuser@localhost IDENTIFIED BY 'centos';
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye
Firewall and SELinux Settings
Allow the apache default port “80″ through iptables/Router. Edit file /etc/sysconfig/iptables,
# vi /etc/sysconfig/iptables
Add the following lines.
-A INPUT -p udp -m state --state NEW --dport 80 -j ACCEPT 
-A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT
Now restart the iptables service.
# /etc/init.d/iptables restart
I don’t want to mess up with SELinux, so here i disabled it.
Edit file /etc/selinux/config,
# vi /etc/selinux/config
Set the SELINUX value as “disabled”.
SELINUX=disabled
Restart the system to take effect the saved changes.
Getting CS-Cart Software
Download the latest version from here. I downloaded it my current directory.
Note: Here you can host your e-store in two methods.
1. Directly from the web root folder, so that you can access your website by navigating to http://domain-name/.
2. Alternatively create a sub directory in web root folder and host website from the sub-directory i.e you can access your website using URL http://domain-name/sub-directory-name.
Here, for testing purpose,  i create a sub-directory directory called “cscart” under apache root folder and copy the cs-cart zip file to the cscart folder.
# mkdir /var/www/html/cscart
# cp cscart_v4.0.1-ultimate.tgz /var/www/html/cscart/
Now go to the cscart directory and extract the cs-cart zip file.
# cd /var/www/html/cscart/
# tar -zxvf cscart_v4.0.1-ultimate.tgz
Adjust the following files/folders permissions as shown below.
Run the following commands one by one in your terminal.
# chmod 666 config.local.php 
# chmod -R 777 design/ images/ var/
# find design -type f -print0 | xargs -0 chmod 666
# find images -type f -print0 | xargs -0 chmod 666
# find var -type f -print0 | xargs -0 chmod 666
Begin CS-Cart Installation
Now navigate to “http://domain-name/cscart/install” or “http://ip-address/cscart/install” from your web browser. The following screen should appear.
Accept the license agreement and click Next.
Installing CS-Cart - Mozilla Firefox_002Enter the database name, database user, password, administration email and password etc. Click Next to continue.
Installing CS-Cart - Mozilla Firefox_003Now select your CS-Cart edition. For testing purpose i select the free edition.
Administration panel - Mozilla Firefox_005After the installation is done, you will see the Installation Successfully Finished wizard. Click Go to the Settings wizard to make store setup. Click Close to go straight to the dashboard. You will be able to make settings later in the administration panel.
Administration panel - Mozilla Firefox_006This is how your Administration panel looks.
Administration panel - Mozilla Firefox_007If you want to further customize your store as per your liking, go to the Administration section by clicking on the Administration link on the top right corner. In the Administration link you can do the following:
- View orders, sales reports, shipment details etc.
- create new products, categories etc.
- Administer and create users and groups etc.
- Add contents to your website etc.
Also you can import/export the data’s and upgrade it to Paid version.
Access Your Store
You can access your online store by navigating to “http://domain-name/cscart” or “http://ip-address/cscart”. The default site is look like below.
Shopping Cart Software & Ecommerce Software Solutions by CS-Cart - Mozilla Firefox_011Also you can access it with URL “http://domain-name/cscart/acme” or “http://ip-address/cscart/acme”.
Shopping Cart Software & Ecommerce Software Solutions by CS-Cart - Mozilla Firefox_013Post Installation
After CS-Cart installation, remove the install/ directory.
# rm -fr install/
Change the following folders/files permissions to secure your e-store as shown below.
# chmod 644 config.local.php 
# chmod 644 design/ .htaccess images/.htaccess 
# chmod 664 var/.htaccess var/themes_repository/.htaccess 
# chmod 644 design/index.php images/index.php 
# chmod 664 var/index.php var/themes_repository/index.php

How to use iSCSI Targets on Windows Computers


Overview
This article will guide the administrator into mounting an iSCSI Target from the Synology DiskStation onto a Windows-based computer. Please make sure that an iSCSI Target has been created on the DiskStation and is ready for use.

Mounting iSCSI Targets on Windows

Note: Modern Windows computers may come with an iSCSI Initiator software already integrated with the operating system, if it is not available, the iSCSI Initiator software from Microsoft is availablehere.

Step 1:
Open the Microsoft iSCSI Initiator Software from Control Panel

Step 2:
Click on Discovery


Step 3:
Click on Add Portal...


Step 4:
Enter the IP Address or the DNS Name of the Synology DiskStation, which is hosting the iSCSI Target
Click Ok


Step 5:
After the iSCSI Portal is detected, click on Targets


Step 6:
Select the Target to be used, and click Log On


Step 7:
Click on Advanced if CHAP or any of the Advanced settings are enabled on the iSCSI Target on the Synology DiskStation
Enter the CHAP Credentials if needed
Close the Advanced Settings Window
Suggestion: enable the Automatically restore this connection when the computer starts or equivalent function, so when the computer boots, it will automatically mount the iSCSI Target.
Close the Log On to Target when finished.


Step 8:
The iSCSI Target is now mounted




Configuring iSCSI target on RHEL 6


Introduction:
iSCSI is Internet SCSI (Small Computer System Interface), an Internet Protocol (IP)-based storage networking standard for linking data storage facilities by carrying SCSI commands over IP networks. iSCSI is used to facilitate data transfers over intranets and to manage storage over long distances. iSCSI makes block devices available via the network. We can mount block devices (disks) across an IP network to local system and then use them like any other block device. iSCSI is a client-server protocol. The server-side is referred to as the 'target,' while the client-side is referred to as the 'initiator.' Both the target and initiator are uniquely identified by a string called the iSCSI Qualified Name (iQN). Initiators come in two varieties: software and hardware. A software initiator is just a driver that handles all requests and pairs the network interfaces driver and the SCSI drivers together to make it work. Using a software initiator any system with an Ethernet card can act as an iSCSI initiator. A hardware initiator is an iSCSI HBA, which is basically just an ethernet card with a SCSI ASIC onboard. Here we are configuring software initiator in RHEL 6.

OS installation:
Install RHEL 6 on the server with basic server installation and configure yum server on the machine.

Network setup:
Configure network with ipaddress and make sure that clients are reachable to the server. By default iSCSI will listen to the port 3260, we have to add necessary rules in iptables to allow iSCSI. Ignore this step if firewall is disabled.

# iptables -I INPUT -p tcp -m tcp --dport 3260 -j ACCEPT
# service iptables save
# service iptables restart

Install and enable the iSCSI target service:
Install and enable the iSCSI target service with the following commands
# yum install scsi-target-utils
# chkconfig tgtd on
# service tgtd start

Allocate storage for the LUNs:
The iSCSI target service is not dependent on a particular type of exported LUN. The LUNs can be plain files, LVM volumes, or block devices. There is however a performance overhead if using the LVM and/or file system layers as compared to block devices. This example demonstrates the creation of a local partition /dec/sdc1 as iSCSI storage LUN

# fdisk -l /dev/sdc
Disk /dev/sdc: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc9a1606e

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         391     3140676   83  Linux

Create the targets:
Targets can be created by adding an XML entry to the /etc/tgt/targets.conf file, using text editor.  Following entries to be added.
#vi /etc/tgt/targets.conf
default-driver iscsi
    backing-store /dev/sdc1
    write-cache off
Note:
The target attribute requires an iSCSI Qualified Name (IQN),following is the general format:
iqn.yyyy-mm.reversed.domain.name:OptionalIdentifierText

yyyy-mm represents the 4-digit year and 2-digit month the device was started (for example: 2011-07)
reversed.domain.name is the hosts domain name in reverse. For example, server1.example.com, in an IQN, becomes com.example.server1;
OptionalIdentifierText is any text string, without spaces, that helps the administrator identifies which device.

Restart  tgtd service:
Need to restart tgtd service after configuring iscsi target
# service tgtd restart
Stopping SCSI target daemon:                             [  OK  ]
Starting SCSI target daemon:                             [  OK  ]

Checking configuration:
To confirm the successful operation , query the iSCSI target setup using following command
# tgt-admin --show
Target 1: iqn.2008-09.com.example:server.target1
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00010000
            SCSI SN: beaf10
            Size: 0 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: None
        LUN: 1
            Type: disk
            SCSI ID: IET     00010001
            SCSI SN: beaf11
            Size: 3216 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: /dev/sdc1
    Account information:
    ACL information:
        ALL

Client side configuration:
1 ) Install  iscsi-initiator-utils package on the client using yum
# yum install iscsi-initiator-utils
2 )Discover the target LUN’s exported by server using following command. It will provide iqn name with of LUN associated with given ip address

# iscsiadm -m discovery -t sendtargets -p 10.30.32.206
Starting iscsid:                                         [  OK  ]
10.30.32.206:3260,1 iqn.2008-09.com.example:server.target1t
Note :
-p : it is indicates the address of target server.

3)  To connect iSCSI target we can use following command , we need to mention server ip and iqn name.
# iscsiadm -m node -T iqn.2008-09.com.example:server.target1 –p 10.30.32.206 –login
Note :
-p : it is indicates the address of target server.
-T : This option specifies iqn of target server
Now iSCSI target is connected from ip 10.30.32.206.To find out the device associated with the iSCSI LUN. We have to check /var/log/message

# tail /var/log/messages
Dec 26 14:22:50 localhost kernel: scsi 3:0:0:0: Attached scsi generic sg4 type 12
Dec 26 14:22:50 localhost kernel: scsi 3:0:0:1: Direct-Access     IET      VIRTUAL-DISK     0001 PQ: 0 ANSI: 5
Dec 26 14:22:50 localhost kernel: sd 3:0:0:1: Attached scsi generic sg5 type 0
Dec 26 14:22:50 localhost kernel: sd 3:0:0:1: [sdd] 6281352 512-byte logical blocks: (3.21 GB/2.99 GiB)
Dec 26 14:22:50 localhost kernel: sd 3:0:0:1: [sdd] Write Protect is off
Dec 26 14:22:50 localhost kernel: sd 3:0:0:1: [sdd] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
Dec 26 14:22:50 localhost kernel: sdd: sdd1
Dec 26 14:22:50 localhost kernel: sd 3:0:0:1: [sdd] Attached SCSI disk
Dec 26 14:22:50 localhost libvirtd: 14:22:50.833: error : udevGetSCSIType:747 : Failed to find SCSI device type 12
Dec 26 14:22:50 localhost iscsid: Connection1:0 to [target: iqn.2008-09.com.example:server.target1, portal: 10.30.32.206,3260] through [iface: default] is operational now

In this demo, iSCSI LUN is linked as /ded/sdd1

Creating file system:
 we can create file system on /ded/sdd1 and use locally.
# mkfs.ext3 /dev/sdd1
# mkdir iSCSI
# mount /dev/sdd1 /iSCSI/

Adding entry in /etc/fstab:
Find out UUID of device using following command
# blkid /dev/sdd1
/dev/sdd1: UUID="9674832d-c995-4ac8-b6da-0d25efa088d0" TYPE="ext3"

Add the following entry in /etc/fstab using vi editor.
“UUID=9674832d-c995-4ac8-b6da-0d25efa088d0 /iSCSI ext3   _netdev        0 0”

[root@dhcpserver /]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Jun  2 00:41:38 2011
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VolGroup-lv_root /                       ext4    defaults        1 1
UUID=9c732237-b39f-4024-a631-3c264e637179 /boot                   ext4    defaults        1 2
/dev/mapper/VolGroup-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
UUID=9674832d-c995-4ac8-b6da-0d25efa088d0 /iSCSI ext3   _netdev        0 0

The added entry is highlighted in the above output.

Note:
We must use _netdev parameter while adding entry in /etc/fstab,Which is used to prevent the system from attempting to mount the file systems until the network has been enabled on the system.