Posts

Showing posts from 2012

How to Backup a MySQL Database

Image
Backup a Single and All the MysQl Databases.

Single database:
mysqldump -u root -pmypasswd vishalvyas > /opt/vishalvyas.sql

Restore:
mysql -uroot -pmypasswd vishalvyas < /opt/vishalvyas.sql


To back up all databases on a particular server, use the mysqldump command:

Backup all the databases:
mysqldump -u root -pmypasswd --all-databases > /opt/alldatabase.sql

Restore:
mysql -uroot -pmypasswd < /opt/alldatabases.sql


















Thanks,
Vishal Vyas

Redmine on centos6

Image
How To Install Redmine On CentOs 6 
Redmine is a free and open source, web-based project management and issue tracking tool. It allows users to manage multiple projects and associated subprojects

Install Packages :- yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel Download and Install Ruby :- # FTP to where you will download ruby from. # When asked to login use user/password of anonymous/anonymous ftp ftp.ruby-lang.org Name (ftp.ruby-lang.org:root): anonymous Password: anonymous ftp> cd /pub/ruby ftp> get ruby-1.8.7-pXXX.tar.gz ftp> quit # You have now downloaded ruby and need to untar it tar zxvf ruby-1.8.7-pXXX.tar.gz # Compile ruby cd ruby-1.8.7-pXXX ./configure make make install # Verify ruby installation ruby -v which ruby # Change back into your downloads directory cd ..
Download and Install Gems 1.4.2wget http://production.cf.rubygems.org/rubygems/rubygems-1.4.2.tgz tar zxvf rubygems-1.4.2.tgz cd rubygems-1.4.2 ruby…

How to install NFS on Redhat Or Fedora

Image
Server Ip : 10.10.10.1
Client  Ip : 10.10.10.2

An NFS server on linux requires 3 services to be running in order to share files:
1.portmap
2.nfslock
3.nfs

Server Settings [10.10.10.1]:

Install nfs package using yum :
# yum install nfs-utils nfs-utils-lib portmap system-config-nfs

# chkconfig portmap on
# chkconfig nfslock on
# chkconfig nfs on



Set up your /etc/exports file with details of the directory you want to share, who is allowed to share it, and permissions.
# vim /etc/exports
/home/vishal 10.10.10.2 or 10.10.10.0/255.255.255.0(rw,no_root_squash,sync)

# service nfs restart

Client Settings [10.10.10.2]:-
Install NFS packages:
# yum install nfs-utils nfs-utils-lib portmap system-config-nfs

# mkdir /home/vishal
# chmod 777 /home/vishal

Mount command:
# mount -t nfs 10.10.10.1:/home/vishal /home/vishal

Add an entry to fstab:
Paste an entry at the bottom of the file that looks something like this.

10.10.10.1:/home/vishal         /home/vishal    nfs     noauto,rw,user 0 0

Make sure you can se…

Install Postfix and Dovecot on Redhat

Image
Download and Install:

Check if both Postfix and Dovecot is not yet installed in your system.

# rpm –q postfix
# rpm –q dovecot


# yum install postfix
# yum install dovecot


Check if it is installed

# rpm –q system-switch-mail

If not installed, install it

# yum install system-switch-mail

And run system-switch-mail

# system-switch-mail

And select Postfix as your default MTA.


# rpm –e --nodeps sendmail

Setting up Postfix
Enough for the intro; let’s do now Postfix setup.

1. Go to /etc/postfix directory

# cd /etc/postfix

2. Copy the original main.cf to another file

# cp main.cf main.cf-bak-orig



3. Clear the existing main.cf file

# cat /dev/null > main.cf

This command will quickly clear the content of you main.cf file.

4. Edit and add the following lines to main.cf

myhostname = mail.example.com
mydomain = example.com
myorigin = $mydomain
mydestination = $myhostname localhost.$mydomain localhost $mydomain
relay_domains =
home_mailbox = Maildir/



5. Check Postfix

# postfix check

6. Reload Postfix

# postfix relo…

mysql replication

Create Replication User


REPLICATION SLAVE privilege:  #mysql -uroot -p
#CREATE USER 'user_vishal'@'localhost' IDENTIFIED BY 'pass_123';
#GRANT REPLICATION SLAVE ON *.* TO 'user_vishal'@'Slave Ip Addd' IDENTIFIED BY 'pass_123';
#mysql>FLUSH PRIVILEGES;
#show master status\G;

In master server:- vim /etc/my.cnf
log-bin=mysql-bin
server-id=1
innodb_flush_log_at_trx_commit=1
sync_binlog=1

Restart MySQl


On Slave Server:-
vim /etc/my.cnf server-id=2
master_host=(master ip)
master_user=vyas
master_password=123

Restart MySQl
#mysql -uroot -p
CHANGE MASTER TO MASTER_HOST='Master Host',
MASTER_HOST=’X.X.X.X’,
MASTER_USER=’user’,
MASTER_PASSWORD=’password’,
MASTER_PORT=3306,
MASTER_LOG_FILE=’mysql-bin.000001?,
MASTER_LOG_POS=98,
MASTER_CONNECT_RETRY=10;

START SLAVE; SHOW SLAVE STATUS\G;

Thanks, Vishal Vyas

Install Subversion [SVN] on Linux Server

how to install SVN (Subversion) server on Fedora , Red Hat (RHEL).





Install Packages:- # yum install mod_dav_svn subversion Modify Subversion config file /etc/httpd/conf.d/subversion.conf Add following config to/etc/httpd/conf.d/subversion.conffile:- LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so <Location /svn> DAV svn SVNParentPath /var/www/svn AuthType Basic AuthName "Subversion repositories" AuthUserFile /etc/svn-auth-users Require valid-user </Location> How to Add SVN  users:- Use  command: ## Create user vishal ## htpasswd -cm /etc/svn-auth-users vishal New password: Re-type new password: Adding password for user vishal ## Create testuser2 ## htpasswd -m /etc/svn-auth-users vyas New password: Re-type new password: Adding password for user vyas How to Create and configure SVN repository:-mkdir /var/www/svn cd /var/www/svn svnadmin create reponame chown -R apache.apache reponame…

Jive Apps Ubuntu Linux Installation Instructions

Installation Steps:

1. Sign up for theJive Apps Developer Community.




2. Install Git & Ruby   


$ sudo apt-get -y install build-essential git-core ruby1.8-dev rubygems1.8 ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby

3. Configure Git
Configure the following options in Git using the Terminal:

$ git config --global user.name "FirstName LastName"
$ git config --global user.email "your_email@youremail.com"

4. Generate SSH Keys

$ ssh-keygen -t rsa -C "your_email@youremail.com"


5. Update your PATH
Ubuntu Linux does not automatically add the Ruby binaries to the PATH. Add this line to your ~/.bash_profile or ~/.bashrc file.

export PATH=/var/lib/gems/1.8/bin:$PATH


6. Install the Jive Apps Command Line Tools Gem



$ sudo gem install jiveapps

 Now you are ready to start creating apps.

Thanks,
Vishal Vyas

htop process monitor

Image
htop is just like top, but on steroids.

Once you are used to htop, you’ll never go back to top again.

htop is a ncurses-based process viewer.....

Install Htop :-
# apt-get install htop / # yum install htop
        or  
Source download Htop
tar xvfz htop-0.9.tar.gz
cd htop-0.9
./configure
make
make install

#htop


















Thanks, Vishal Vyas

Increase the Swap space in Linux

Add a Swap Partition:



you have created a partition say /dev/sda7 having size 1GB.






[root@den ]# mkswap /dev/sda7 Setting up swapspace version 1, size = 1057092 KiB no label, UUID=5ad400b1-3a7f-449c-9605-c257e56ba381  

[root@den ]# free
total used free shared buffers cached
Mem: 3040320 467800 2572520 0 28032 255368
-/+ buffers/cache: 184400 2855920
Swap: 4289312 0 4289312


The free command above shows around 4GB of swap space. Now lets activate the swap partition.


[root@den ]# swapon /dev/sda7 

[root@den ]# free
total used free shared buffers cached
Mem: 3040320 659016 2381304 0 29296 328196
-/+ buffers/cache: 301524 2738796
Swap: 5346400 0 5346400


Notice that the free memory space rose to around 5GB

To make the changes permanent you can put an entry in the /etc/fstab file as



/dev/sda7 swap swap defaults 0 0


Add a Swap File: 

[root@den ]# dd if=/dev/zero of=/swap_file bs=1024 count=524288
524288+0 records in
524288+0 records out
536870912 bytes (537 MB) copied, 3.79122 s, 142 MB/s
[root@den ]# mkswap /swap_fi…

How to install Php,Mysql and Lighttpd on Ubuntu

Install ntop on RedHat Or CentOs 5

Image
Install rpmforge repository: http://wiki.centos.org/AdditionalResources/Repositories/RPMForge  



Or





·         i386 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm

·         x86_64 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm






Install DAG's GPG key



rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt



Verify the package you have downloaded



rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm








Install the package



rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm


Installing Ntop :

There is an ntop rpm in the rpmforge repository:

yum install ntop



There is a bug in the /etc/init.d/ntop startscript we need to fix. Open the file in your favorite editor for example vim:

vim /etc/init.d/ntop



change the line at start function from:

daemon $prog -d -L @/etc/ntop.conf
to:

daemon $prog @/etc/ntop.conf -d -L



first time you start ntop you need to set the admin password:

ntop @/etc/ntop.conf



you should now be able to start ntop deamon via:

service ntop start



if you want …

How to access NTFS partition in Rhel/Centos 5/6

$ cd Download
$ wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
# rpm -ivh epel-release-6-5.noarch.rpm


You must be logged in as Root for the below command to work :


# yum install ntfs-3g
Checking the Name of an NTFS Partition


Entering the below commands would help you determine the name of an NTFS partition :
# fdisk -l /dev/sda
# fdisk -l /dev/sdb
Steps to Mount /dev/sda1 NTFS Partition at /mnt/ntfs


It is essential to load the fuse driver. The below command should help you do that :
# modprobe fuse


Now using the below command you must build a mount point:
# mkdir /mnt/ntfs


The following command would help you with mounting the ntfs partition :
# mount -t ntfs-3g /dev/sda1 /mnt/ntfs


Command for Unmounting the NTFS Partition


# umount /mnt/ntfs

How to configure ACL in Linux

Image
ACLs can be configured:

 1.Per user
2. Per group
3.Via the effective rights mask
4.For users not in the user group for the file

Enable ACL support on the partition.
Edit /etc/fstab file and change the default parameter to rw,acl
If we want to enable acl for /mnt







Now, you will need to remount the /mnt partition with the "acl" option. The easiest way to do this is with the "remount" option, since it will work even while the partition is in use:

[root@vishal /]# mount -v -o remount /mnt/
/dev/sda5 on /mnt type ext3 (rw,acl)

Create a user and group:-
 [root@vishal /]# useradd vishal
[root@vishal /]# groupadd linux
[root@vishal /]# usermod -a -G linux vishal

Now, we can actually start using ACLs. The basic commands that we are interested in are:
getfacl
setfacl


[root@vishal /]#  setfacl -m u:vishal:rw- /mnt/
[root@vishal /]#  getfacl /mnt/
getfacl: Removing leading '/' from absolute path names
# file: mnt
# owner: root
# group: root
user::rwx
user:vishal:rw-
gro…

Configure SSL Apache on Ubuntu...

Image
Generate a Self-Signed Certificate:-










$a2enmod ssl
$mkdir /etc/apache2/ssl
$openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/ssl.pem -keyout /etc/apache2/ssl/ssl.key

You will be asked for several configuration values. Enter values appropriate for your organization and server, as shown here.

Generating a 1024 bit RSA private key
.++++++
..............................++++++
writing new private key to '/etc/apache2/ssl/ssl.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:IN
State or Province Name (full name) [Some-State]:Gujarat
Locality Name (eg, city) []:Ahmedabad
Organization Name (eg, company) [Internet Widgits Pty Ltd]:VishalVyas Ltd
Organizatio…

Apache Tomcat in ubuntu

Image
Ddownload Tomcat  http://tomcat.apache.org/




Unzip it with tar -zxvf  Tomcatxxx.tar
tar -zxvf apache-tomcat-7.0.25.tar.gz

No make or configuration required, just change to tomcat bin folder to start or stop Tomcat



For Staring Tomcat:
sudo /opt/tomcat7/bin/startup.sh

To Shutdown Tomcat:
sudo /opt/tomcat7/bin/shutdown.sh

Done .... !!!!!

Thanks,
Vishal