.com/.com/.com/

Sunday, 28 August 2016

How To Take MySQL Database Backup using Shell Script

mysql-shell-scripting-logo


Step: 1. First We need to Create the Following Directory Structure :

# mkdir -p /Backups/DB_backups
# mkdir /Backups/scripts

Step: 2. Create a Read-Only MySQL User Called "backupoperator" :

Note: Don't use "root" user.

-- Make Sure You have given the Right Privileges to "backupoperator" to take Backup.

# mysql -u root -p
Enter the Password:

mysql> grant select on *.* to backupoperator@localhost identified by 'backupoperator_password';
mysql> flush privileges;
mysql> quit

Step: 3. Creating MySQL Database Backup Shell  Script under "scripts" Directory :

Note: Backup Retention is 3 days. 3 days older file will deleted automatically.

# vi /Backups/scripts/mysql_backup_script.sh

-- Paste the Below Codes :

#!/bin/bash
export path1=/Backups/DB_backups
date1=`date +%y%m%d_%H%M%S`
# Set Backup Retention. Here Backup Retention is 3 days.
/usr/bin/find $path1/* -type d -mtime +3 -exec rm -r {} \; 2> /dev/null
cd $path1/
mkdir $date1
USER="backupoperator"
PASSWORD="backupoperator_password"
OUTPUTDIR="$path1/$date1"
MYSQLDUMP="/usr/bin/mysqldump"
MYSQL="/usr/bin/mysql"
databases=`$MYSQL --user=$USER --password=$PASSWORD \
 -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`
echo "` for db in $databases; do
    echo $db
if [ "$db" = "performance_schema" ] ; then
       $MYSQLDUMP --force --opt --single-transaction --lock-tables=false --skip-events  --user=$USER --password=$PASSWORD \
    --databases --routines $db > "$OUTPUTDIR/$db.sql"
         else
$MYSQLDUMP --force --opt --single-transaction --lock-tables=false --events  --user=$USER --password=$PASSWORD \
    --databases --routines $db > "$OUTPUTDIR/$db.sql"
fi
done `" 2> /Backups/Logs/error_$date1.log

-- Save & Quit (:wq)

Step: 4. Now, Give the Executable Permission :

# chmod 755 /Backups/scripts/mysql_backup_script.sh

Step: 5. To Execute the Script :

# cd /Backups/scripts/
# ./mysql_backup_script.sh

Step: 6. Schedule in Crontab :

# crontab -e

30 2 * * * /Backups/scripts/mysql_backup_script.sh > /dev/null

-- Save & Quit (:wq)

Note: It will take backup automatically every day at 2:30 AM.

Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog


Friday, 26 August 2016

Install & Configure Help Desk System Using OTRS On CentOS/RHEL 6x

OTRS


Q. What is OTRS ?

-- OTRS is one of the most flexible web-based ticketing systems used for Customer Service, Help Desk, IT Service Management. With a fast implementation and easy customization to your needs it helps you reducing costs and increasing the efficiency and transparency of your business communication.

Step: 1. Bind Host File :

# vi /etc/hosts

10.100.99.13    ser3.domain.com    ser3

-- Save & Quit (:wq)

Step: 2. Disable Selinux & Stop Firewall :

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

# service iptables stop
# chkconfig iptables off

Note: If Iptables service is on, then Adjust iptables to allow Apache Default Port 80.

# vi /etc/sysconfig/iptables

Add the Following Line in Filter Table :

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

-- Save & Quit (:wq)

# service iptables restart

Step: 3. Reboot the System :

# init 6

Step: 4. Install EPEL Repository :

# yum -y install epel-release

Step: 5. Install MySQL Server :

# yum -y install mysql mysql-server

Step: 6. Start MySQL Service & Set MySQL Root Password :

# service mysqld restart
# chkconfig mysqld on

# mysql_secure_installation

Step: 7. To Change Engine MyISM to InnoDB & Restart MySQL Service :

# vi /etc/my.cnf

-- Add the Following Lines under the [mysqld] Section :

max_allowed_packet=20M
query_cache_size=32M
innodb_log_file_size = 500M
default-storage-engine = InnoDB

-- Save & Quit (:wq)

# service mysqld stop
# mv /var/lib/mysql/ib_logfile0 /var/lib/mysql/ib_logfile0.bak
# mv /var/lib/mysql/ib_logfile1 /var/lib/mysql/ib_logfile1.bak

# service mysqld restart

Step: 8. Create Database For OTRS :

# mysql -u root -p
Enter Password:

mysql> create database otrsdb;
mysql> grant all privileges on otrsdb.* to otrsuser@localhost identified by 'password';
mysql> flush privileges;
mysql> \q

Step: 9. Install Apache Web Server :

# yum -y install httpd httpd-devel wget

Step: 10. Start Apache Service :

# service httpd restart
# chkconfig httpd on

Step: 11. Download & Install OTRS RPM Package :

# cd /mnt
# wget http://ftp.otrs.org/pub/otrs/RPMS/rhel/6/otrs-5.0.10-01.noarch.rpm
# yum -y install otrs-5.0.10-01.noarch.rpm

Step: 12. Restart Apache Service :

# service httpd restart

Step: 13. Install Additional PERL Modules :

# /opt/otrs/bin/otrs.CheckModules.pl

# yum -y install "perl(Crypt::Eksblowfish::Bcrypt)" "perl(DBD::ODBC)" "perl(DBD::Pg)" "perl(Encode::HanExtra)" "perl(GD)" "perl(GD::Text)" "perl(GD::Graph)" "perl(JSON::XS)" "perl(Mail::IMAPClient)" "perl(PDF::API2)" "perl(Text::CSV_XS)" "perl(YAML::XS)"

# /opt/otrs/bin/otrs.CheckModules.pl

Step: 14. Now Install OTRS Through Web Browser :

http://10.100.99.13/otrs/installer.pl

-- Click on "Next".
-- Click on "Accept License & Continue".
-- Database Selection:
     Type: MySQL
     Install Type: Use an existing database for OTRS

-- Click on "Next".
-- Configure MySQL:
     User: otrsuser
     Password: password
     Host: 127.0.0.1
     Database Name: otrsdb
-- Click on "Check Database Settings".
-- Click on "Next".
-- Click on "Next".
-- System Settings:
     AdminEmail: koushik@domain.com
     Organization: Your Organization
-- Click on "Next".
-- Mail Configuration: For Now Skip this Step.

Step: 15. Now Login OTRS Admin Panel :

http://10.100.99.13/otrs/index.pl

User: root@localhost
Password: LvMiOnXJAu2U7Vg6

-- Click on "Login".

Step: 16. To Resolve OTRS Daemon is not running, Do the Following :

# useradd otrs
# chmod -Rf 777 /opt/otrs/Kernel/Config/Files/
# su - otrs
$ /opt/otrs/bin/otrs.Daemon.pl start
$ /opt/otrs/bin/Cron.sh start

Step: 17. To Change Admin Password :

http://10.100.99.13/otrs/index.pl

User: root@localhost
Password: LvMiOnXJAu2U7Vg6

-- Click on "Edit Personal Peferences"
-- Change Password:
     Current password: LvMiOnXJAu2U7Vg6
     New Password: Passw0rd@123
     Verify Password: Passw0rd@123
-- Click on "Update".

Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog


Friday, 19 August 2016

How To Create a Wireless Hosted Network in Windows 10

win-10-featured

-- Hosted Network is a feature that comes included with the Netsh (Network Shell) command-line utility. It's was previously introduced in Windows 7, and it allows you to use the operating system to create a virtual wireless adapter.

This method does not require you to Download any third-party Application. You can easily set up a Wi-Fi hotspot using the built-in tools in Windows.

Step: 1. Open Command Prompt with Administrator Privileges :

1























Step: 2. Check if your Wireless Adapter Supports Hosted Networks in Windows 10 :

Type the below Command :

C:\WINDOWS\system32> netsh wlan show drivers

0
Step: 3. Create a Wireless Hosted Network :

Type the below Command :

C:\WINDOWS\system32> netsh wlan set hostednetwork mode=allow ssid=MySSID key=Passw0rd
C:\WINDOWS\system32> netsh wlan start hostednetwork

2


















Step: 4. Share your Internet Connection with a Hosted Network :

-- Right Click on "Network Adapter"
-- Click on "Open Network and Sharing Center"

3

Note: In Network Connections, you should see a new Microsoft Hosted Virtual Adapter which is labeled Local Area Connection* X.

4

-- Right Click on "Ethernet" 
-- Click on "Properties"

5

-- Click the "Sharing" tab

-- Check "Allow other Network users to Connect through this Computer's Internet 
    Connection" option.

-- Next, from the "Home Networking Connection" drop-down menu select the "Microsoft 
    Hosted Virtual Adapter".

-- Click "OK" to Finish.
 
6
 
Now, You’ll have a brand new Wi-Fi Network that’s connected to your home internet.

7
Step: 5. Now Connect Any Wireless Capable Device to the newly Created Access Point :

8




















Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog

 

Sunday, 14 August 2016

How To Reset MySQL Root Password in CentOS/RHEL & Ubuntu

MySQL-Logo


For CentOS/RHEL User :

Step: 1. Stop MySQL Service :

# service mysqld stop

Step: 2. Start to MySQL Server without Password :

# mysqld_safe --skip-grant-tables &

Step: 3. Connect to MySQL Server using MySQL Client :

# mysql -u root

mysql> use mysql;
mysql> update user set password=PASSWORD("new_password") where User='root';
mysql> flush privileges;
mysql> quit

Step: 4. Stop the MySQL Server Again :

# service mysqld stop

Step: 5. Start MySQL Server Normally & Test it :

# service mysqld restart
# chkconfig mysqld on

# mysql -u root -p
Enter Password:

For Debian/Ubuntu User :

$ sudo dpkg-reconfigure mysql-server-5.5
--  Give New Password.


Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog

Sunday, 7 August 2016

Install & Configure CVS (Concurrent Versions System) on RHEL/CentOS 6x

cvs-source-code-management


Q. What is CVS ?

-- The Concurrent Versions System (CVS), also known as the Concurrent Versioning System. CVS can be used for source or content control in the field of software development.

Step: 1. Install CVS :

# yum -y install cvs*

Step: 2. Verify CVS :

# cvs -v
Concurrent Versions System (CVS) 1.11.23 (client/server)

Step: 3. Initialize the CVS Repository :

# cvs -d /home/cvs/project1 init

Note: Once initialized, you’ll see CVSROOT directory created under the CVS repository.

Step: 4. Make some initial Changes before Starting the CVS Server :

# vi /etc/xinetd.d/cvs

service cvspserver
{
        disable                 = no
        port                       = 2401
        socket_type      = stream
        protocol              = tcp
        wait                       = no
        user                       = root
        passenv               = PATH
        server                   = /usr/bin/cvs
        env                         = HOME=/home/cvs
        server_args       = -f --allow-root=/home/cvs/project1 pserver
        bind                       = 192.168.72.220
}

-- Save & Quit (:wq)

Step: 5. Restart the xinetd Services :

# service xinetd restart
# chkconfig xinetd on

Step: 6. Verify that the Service is Running & Listening :

# netstat -ntlp | grep 2401

tcp     0   0   192.168.72.220:2401      0.0.0.0:*   LISTEN      18337/xinetd

Step: 7. Create CVS User & Groups :

# useradd cvs
# passwd cvs

Step: 8. Create CVS Repository Directory :

# cd /home/cvs
# mkdir project1

# chmod -Rf 775 /home/cvs/project1
# chown -Rf cvs:cvs /home/cvs/project1

Step: 9. Client login into CVS server :

# cvs -d :pserver:cvs@192.168.72.220:/home/cvs/project1 login

Another Way to Login :

# export CVSROOT=:pserver:cvs@192.168.72.220:/home/cvs/project1

# cvs login
Logging in to :pserver:cvs@192.168.72.220:/home/cvs/project1
CVS password:


Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog

 
Page 1 of 81238>
Copyright © 2016 Kousik Chatterjee's Blog