Saturday, 19 December 2015

How to redirect domain in apache server


Add following code to your .htaccess or httpd.conf (directory directive) file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.yourdomain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
If you added directives to httpd.conf, restart Apache:

# service httpd restart
#chkconfig httpd on

How to increase upload file limit from 2MB to 10MB under Apache 2 UNIX / Linux web server?

php installation putting limits on upload file size. The default will restrict you to a max 2 MB upload file size. You need to set the following two configuration options:



Method # 1: Edit php.ini
Edit your php.ini file (usually stored in /etc/php.ini or /etc/php.d/cgi/php.ini or /usr/local/etc/php.ini):

# vi /etc/php.ini
Sample outputs:
memory_limit = 32M
upload_max_filesize = 10M
post_max_size = 20M

Save and close the file. Restart apache or httpd web server:
# service httpd restart
#chkconfig httpd on

Method #2: Edit .htaccess
Edit .htaccess file in your root directory. This is useful when you do not have access to php.ini file. In this example, /home/httpd/html is considered as root directory (you can also create .htaccess file locally and than upload it using ftp / sftp / scp client):

# vi /home/httpd/html/.htaccess
Append / modify setting as follows:
php_value upload_max_filesize 10M
php_value post_max_size 20M
php_value memory_limit 32M


Save and close the file.

Monday, 30 November 2015

How to create nic channel bonding in redhat/centos/fedora linux.

Step 1: Creating Bonding Channel


As a root, create a new file name bonding.conf in the /etc/modprobe.d/ directory.
#cd  /etc/modprobe.d/
#vim bonding.conf

alias bond0 bonding
options bond0 mode=1 miimon=100

Save & exit

For each configured channel bonding interface, there must be a corresponding entry in your new /etc/modprobe.d/bonding.conf file.

Step 2: Creating Channle Bonding Interface
# vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.1.8
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no

Step 3: Configuring Channel Bonding Interface
For eth0

# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

For eth1

# vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none


Step 4: Restarting Network Service

Restart the network service and see the output of ifconfig.

# service network restart
[root@amir network-scripts]# ifconfig

bond0     Link encap:Ethernet  HWaddr 00:0C:21:60:30:C4
          inet addr:192.168.1.8  Bcast:172.16.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe69:31c4/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1                                RX packets:19676 errors:0 dropped:0 overruns:0 frame:0
          TX packets:342 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1623240 (1.5 MiB)  TX bytes:42250 (41.2 KiB)

eth0      Link encap:Ethernet  HWaddr 00:0C:21:60:30:C4
          UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
          RX packets:10057 errors:0 dropped:0 overruns:0 frame:0
          TX packets:171 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:832257 (812.7 KiB)  TX bytes:22751 (22.2 KiB)
          Interrupt:19 Base address:0x2000

eth1      Link encap:Ethernet  HWaddr 00:0C:21:60:30:C4
          UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
          RX packets:9620 errors:0 dropped:0 overruns:0 frame:0
          TX packets:173 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:791043 (772.5 KiB)  TX bytes:20207 (19.7 KiB)
          Interrupt:19 Base address:0x2080

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0

          RX bytes:104 (104.0 b)  TX bytes:104 (104.0 b)

Saturday, 7 November 2015

How to install orangehrm on centos 6 an open human resource management solution

Orangehrm is an awesome Open Source HR Management System that is freely available at http://sourceforge.net/projects/orangehrm/.  or you can download from from Orangehrm official website You can follow the step by step installation and deployment for your companies used. I will show you how to install Orangehrm  CentOS.

At first we have to configure  apache, php, mysql support web server, we can follow this link

Web Server configuration on Centos 6.5
Copy the BEST Traders and Make Money : http://bit.ly/fxzulu
install Apache2, PHP5 And MySQL Suppo

Copy the BEST Traders and Make Money : http://bit.ly/fxzulu
install Apache2, PHP5 And MySQL Suppor

Copy the BEST Traders and Make Money : http://bit.ly/fxzulu

Make sure your webserver, mysql are working properly.
Now go to orangehrm download directory

#cp /root/Download/orangehrm-3.3.2.zip /var/www/html
#mkdir orangehrm
#unzip orangehrm-3.3.2.zip -d orangehrm
#chown -R apache:apache orangehrm 
#chmod -R 755 /var/www/html/orangehrm/lib/confs/

open your web brower type on your address bar http://your_ip/orangehrm






Click on Next
 
Click on I accept
Configure your database
In step 3 you will face two problem, those one is .htaccess allow another is mysql event scheduler
let's solve this problem

Click on this url ,htaccess allow access

Another is Mysql Event scheduler enable

In the [mysqld] section of the my.cnf, add this:

#vim /etc/my.cnf
event_scheduler=ON

and now click on recheck, now you can see all component status are ok, then click on next

 

Set your admin password and click next
Check details and click install, wait for a moment than....


Installation finish... Enjoy....


Sunday, 1 November 2015

How to configure osTicket, An Open Source Support Ticket System


Configuring MySQL for osTicket
At first we have to configure  apache, php, mysql support web server, we can follow this link
 Web Server configuration on Centos 6.5

Now, log in to the MySQL console and create a database for the osTicket.
#mysql -u root -p
This will prompt you for a password, so enter your MySQL root password and hit Enter. Then, Create the database for osTicket and assign proper permission.
mysql> create database osticketdb;
Query OK, 1 row affected (0.01 sec)
mysql> CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec);
mysql> grant all on osticketdb.* TO 'osticketuser'@'localhost';
Query OK, 0 rows affected (0.00 sec)
Mysql> grant all on osticket.* to username@localhost identified by 'password'    #for existing user
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye

Downloading osTicket installation script
Go to the Apache root directory:
#cd /var/www/html
Download osTicket latest version from the official download page.

#wget http://osticket.com/sites/default/files/download/osTicket-v1.9.8.1.zip
Create a directory called ‘osticket’ and extract the zip in it.
#mkdir osticket
#unzip osTicket-v1.9.8.1.zip -d osticket
Change html/osticket  folder permissions:
Finally, restart the Apache service.
#service httpd restart
#chkconfig httpd restart
Step 6. Accessing osTicket.. And See the Installation wizard has been started.. Open your favorite browser and navigate to
http://yourdomain.com/osticket/upload or http://server-ip/osticket/upload.

On this page click on continue
#cd /var/www/html/osticket
#cd upload/include
#cp ost-sampleconfig.php ost-config.php

Now change permission:
As I mentioned above, configuration file is not writable. So change the file permission from 0644 to 0666 then hit Done, Continue button.

#chmod 0664 include/ost-config.php


How to configure osTicket mail setting.

 In this case we have osTicket installed, and we would like to configure the software to automatically send/recieve email using a designated mailbox, in this case

 First things first, enable the email configuration, go to Admin Panel > Settings > Emails 


set the email configuration to be enabled for osTicket

Save setting, 

Now configure email id, password and other setting. 
from here browse to  Admin Panel > emails

select/add the email address you would like to associate with osTicket.


Done...! Enjoy open source...






Tuesday, 20 October 2015

IT And Asset Management System With GLPI On Centos6/ RHEL 6

GLPI is the Information Resource-Manager with an additional Administration Interface. You can use it to build up a database with an inventory for your company. It has enhanced functions to make the daily life for the administrators easier, like a job-tracking-system with mail-notification and methods to build a database with basic information about your network-topology.

Install GLPI on Centos 6 or RHEL6

Let us setup GLPI Asset management system using GLPI on our centos 6.6. GLPI is web based deployment software, we have to setup a LAMP server in our centos 6.6. Follow the below link to setup LAMP server on centos 6


Now we have to create a database for GLPI. To do so, log in to your MySQL server using command:

# mysql -u root -p
Now create a database called ‘glpidb’ and database user called ‘glpiuser’ with password ‘redhat’ as described below.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 190
Server version: 5.5.31-0+wheezy1
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database glpidb;
Query OK, 1 row affected (0.02 sec)
mysql> grant all on glpidb.* to glpiuser@localhost identified by 'redhat';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit

Bye

Getting GLPI

Download the latest GLPI package here. Or you can directly download it from your terminal using command:

# wget https://forge.indepnet.net/attachments/download/1615/glpi-0.84.3.tar.gz
Extract the tarball using command:
# tar -zxvf glpi-0.84.3.tar.gz
Move the extracted files to your webserver root document folder.
# mv glpi/ /var/www/html
Set Read/Write permissions of the following directories.
# chmod -R 777 /var/www/html/glpi/files/
# chmod -R 777 /var/www/html/glpi/config/
Begin Installation
The rest of the installation is web based and pretty easy. Point your web browser with URL http://ip-address/glpi or http://domain-name/glpi and follow the onscreen instructions.

You should see the following screen. Select your language and click Ok.


Accept the License agreement and click Ok.

If it is a new installation click Install button, else click Upgrade button to upgrade from old version to most recent new version. I want to install a fresh version of GLPI, hence i clicked Install button
.


If all seems well, you should see the following screen. If there are any errors, check for the file permissions and start over the installation again.

Enter the MySQL credentials such as hostname, user and password and click Continue.

If you have already created a MySQL database it should have listed in the next screen as shown below, else you have to create a new one by clicking on the link Create new database. I have already created a database called ‘glpidb’, hence i selected it.



Click Continue.


Congratulations! We have installed GLPI on our server successfully.

The default user accounts and their passwords will be shown in the above window. However i have listed them below for the sake of clarity.

– glpi/glpi for the administrator account
– tech/tech for the technician account
– normal/normal for the normal account
– post-only/postonly for the postonly account

Please note them. You can change them later.


Click Use GLPI to proceed. Let us log in to GLPI administrative Dashboard. The administrative user name is glpi and password is also glpi. Enter them and click Post.


This is how my Administrative dashboard looks.

At the first log in it will show some precautions that be made before using GLPI further.


First you above to change the default users passwords for security reasons. To do that. Go to Administration -> Users -> glpi and input your new password in the password column.

And also you have to remove the install/install.php file for security reasons.

# rm -fr /var/www/glpi/install/install.php
If you made any mistakes or just forgot the password for the administrative account, you can re-run the above setup by deleting the following config/config.php file.

After completing your installation change the permission of the config/config_db.php file to avoid any misconfiguration by users.

# chmod 400 /var/www/glpi/config/config_db.php
Now start using GLPI asset management system by navigating to http://ip-address/glpi.

Usage of GLPI is not that difficult. Just go-through every menus and explore things. If you still want a help documentation, i suggest you to read the Official wiki page.

References: GLPI Project

Saturday, 12 September 2015

How to copy file in linux platform...



Copy one single local file to a remote destination
scp /path/to/source-file user@host:/path/to/destination-folder/
  
Copy one single file from a remote server to your current local server
scp user@host:/path/to/source-file /path/to/destination-folder  

Copy one single file from a remote server to another remote server
scp user1@server1:/path/to/file user2@server2:/path/to/folder/

Copy one single file from a remote host to the same remote host in another location
scp jane@host.example.com:/home/jane/table.csv pete@host.example.com:/home/pete/

Copy multiple files with one command
scp file1.txt file2.txt file3.txt pete@host.example.com:/home/pete/

Copy all files of a specific type
scp /path/to/folder/*.ext user@server:/path/to/folder/

Copy all files in a folder to a remote server
scp /path/to/folder/* user@server:/path/to/folder/

Copy all files in a folder recursively to a remote server
scp -r /home/user/html/* jane@host.example.com:/home/jane/backup/

Copy a folder and all its contents to a remote server
scp -r /path/to/source-folder user@server:/path/to/destination-folder/

Specify a port
scp -P [port] [user]@[server]:[path/to/]file [/path/to/]file

Tuesday, 7 July 2015

How to Set SSH Login Email Alerts in CentOS/Redhat Enterprise Linux/Ubuntu/ Debian/Linux Mint /Fedora

On Debian/Ubuntu/Linux Mint
# apt-get install mailx

On RHEL/CentOS/Fedora
# yum install mailx

Set SSH Root Login Email Alerts
# cd /root
# vi .bashrc

Add the following whole line at the bottom of the file. Make sure to replace “ServerName” with a hostname of your Server and change “your@yourdomain.com” with a your email address.

echo 'ALERT - Root Shell Access (ServerName) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" your@yourdomain.com

Save and close the file and logout and log back in. Once you login via SSH, a .bashrc file by default executed and sends you an email address of the root login alert.

Set SSH Normal User Login Email Alerts
Login as normal user (amir) and go to user’s home directory by typing cd /home/amir/ command.

# cd /home/amir

Next, open .bashrc file and add the following line at end of the file. Make sure to replace values as shown above.

#vim .bashrc

echo 'ALERT - Root Shell Access (ServerName) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" your@yourdomain.com

Save and close the file and logout and login again. Once you login back again, a .bashrc file executed and sends you an email address of the user login alert.



Sunday, 5 July 2015

How to configure vncserver CentOs 6/RHEL 6


Install Desktop Environment

For GNOME:
# yum groupinstall  "General Purpose Desktop" "Desktop Platform"

For KDE:
# yum groupinstall  "KDE Desktop"

Install VNC server
# yum -y install vnc-server

Install   Tigervnc-Server
# yum install tigervnc-server

Make vnc password for user (Ex. amir). Login to the user and run the following command:
#vncpasswd amir
Password:
Verify:
Configure VNC configuration for new user

Edit /etc/sysconfig/vncservers file and add the user name:

#vim /etc/sysconfig/vncservers
VNCSERVERS="2:amir"
VNCSERVERARGS[2]="-geometry 1280x1024"
Save and exit

#service vncserver restart
#chkconfig vncserver on

Done…

Thursday, 2 July 2015

How to use .htaccess file on Apache server



You need to have AllowOverride AuthConfig directive in httpd.conf file in order for these directives to have any effect. Look for DocumentRoot Directory entry. In this example, our DocumentRoot directory is set to /var/www. Therefore, my entry in httpd.conf looks like as follows:

<Directory /var/www/html>
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Save the file and restart Apache
 
If you are using Red Hat /Fedora Linux:
# service httpd restart


If you are using Debian Linux:
# /etc/init.d/apache-perl restart