Search This Blog

Lets go..

Thursday

How to install Git in linux machine and link with NetBeans IDE

[root@db-tom ~]#  yum install git
[root@db-tom ~]#  mkdir -p /home/netizen/git/project
[root@db-tom ~]#  cd /home/netizen/git/project
[root@db-tom ~]#  git config --global user.name "root"
[root@db-tom ~]#  git config --global user.email mahfuj@xxxs.com
[root@db-tom ~]#  git --bare init  [Inside /home/netizen/git/project directory, run this command]

root@ip:/home/netizen/git/project  [Netbeans repo path and password is server password]

Now play with Git & NetBeans

How to establish MySQL remote connection

Bind your ip address ::
[root@db-tom ~]# vim /etc/my.cnf
Add bind-address = 10.12.21.11 (your machine ip address) in my.cnf file

Note : your network must have static private ip (not DHCP) in case of private network or public ip

mysql -uroot -p
password:*******
use mysql;
mysql> GRANT ALL PRIVILEGES ON *.* TO  'USERNAME'@'%'  IDENTIFIED  BY  'PASSWORD';
mysql>FLUSH PRIVILEGES;
mysql>exit

[root@db-tom ~]# /etc/init.d/iptables start
[root@db-tom ~]# chkconfig iptables off

How to install MySQL in CentOS 6

Just run these commands ::
[root@db-tom ~]# yum install wget
[root@db-tom ~]# wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
[root@db-tom ~]# yum localinstall mysql57-community-release-el6-7.noarch.rpm
[root@db-tom ~]# yum repolist enabled | grep "mysql.*-community.*"
[root@db-tom ~]# yum install mysql-community-server
[root@db-tom ~]# service mysqld start
[root@db-tom ~]# grep 'temporary password' /var/log/mysqld.log
[root@db-tom ~]# mysql_secure_installation

Note : New password must have one capital letter+one special character+one number+one small letter

MySQL start/stop ::
[root@db-tom ~]# /etc/init.d/mysqld stop
[root@db-tom ~]# /etc/init.d/mysqld start
[root@db-tom ~]# /etc/init.d/mysqld restart
[root@db-tom ~]# /etc/init.d/mysqld status

How to install latest Apache Tomcat

Ubuntu ::
Download latest apache tomcat server apache-tomcat.tar.gz file from here:: https://tomcat.apache.org
Give permission to /opt/tomcat :: chmod 777 /opt/tomcat
Move this apache-tomcat.tar.gz to /opt/tomcat directory :: mv apache-tomcat.tar.gz /opt/tomcat
Unpack apache-tomcat.tar.gz :: tar xvzf apache-tomcat-8.0.28.tar.gz
Give proper permission ::
chmod 777 /opt/tomcat/apache-tomcat-8.0.28
chmod 777 /opt/tomcat/apache-tomcat-8.0.28/*
chmod 777 /opt/tomcat/apache-tomcat-8.0.28/conf/*
chmod 777 /opt/tomcat/apache-tomcat-8.0.28/logs/*

vim ~/.bashrc
Add  below two lines end of the file in ~/.bashrc
Press i to edit ~/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export CATALINA_HOME=/opt/tomcat/apache-tomcat-8.0.28
After adding above two line
Press Esc button then write :wq and press Enter button

Increase tomcat heap memory
Add JAVA_OPTS="-Xms128m -Xmx128m"
in apache-tomcat/bin/catalina.sh at 5th line

Test tomcat server has been installed successfully ::
How to start or stop tomcat server
$CATALINA_HOME/bin/startup.sh
$CATALINA_HOME/bin/shutdown.sh
Open a browser and type localhost:8080 in address bar and you will get a tomcat server page.


CentOS 6.7 ::

Download latest apache tomcat server apache-tomcat.tar.gz file from here https://tomcat.apache.org
Execute these commands ::
[root@db-tom]# mv apache-tomcat-8.0.28.tar.gz  /usr/share
[root@db-tom]# cd /usr/share
[root@db-tom share]# tar -xzf apache-tomcat-8.0.28.tar.gz
This will create the directory /usr/share/apache-tomcat-8.0.28
[root@db-tom share]# cd /etc/init.d
[root@db-tom init.d]# vim tomcat

Press i and copy and paste below script

#!/bin/bash
JAVA_HOME=/usr/java/jdk1.8.0_72
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/share/apache-tomcat-8.0.28
case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)   
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
;;
esac    
exit 0

Press Esc and type :wq and again press Enter button
[root@db-tom init.d]# chmod 755 tomcat



Increase tomcat heap memory ::
Add JAVA_OPTS="-Xms128m -Xmx128m"
in apache-tomcat/bin/catalina.sh
at 5th line

Tomcat Service manipulation ::
[root@db-tom]# service tomcat start
[root@db-tom]# service tomcat stop
[root@db-tom]# service tomcat restart

Open a browser and type localhost:8080 in address bar and you will get a tomcat server page

How to install JDK latest version in your machine and install java environment properly

Ubuntu ::
Just run these commands ::
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer
$ sudo apt-get install oracle-java8-set-default
Test JDK has been installed successfully :: javac

CentOS 6 ::
Downoad latest JDK from here:: http://bc.vc/byid4w
Download JDK .tar.gz file according to your OS bit 32 or 64

Just run these commands ::
[root@db-tom ~]# mkdir /usr/java
[root@db-tom ~]# mv jdk-8u73-linux-x64.tar.gz   /usr/java
[root@db-tom ~]# cd /usr/java
[root@db-tom ~]# tar -xzf jdk-8u73-linux-x64.tar.gz
[root@db-tom ~]# vim ~/.bash_profile
Add  below two lines in ~/.bash_profile
Press i to edit ~/.bash_profile
JAVA_HOME=/usr/java/jdk1.8.0_73
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
After adding above lines
Press Esc button then write :wq and press Enter button

Test java has been successfully installed ::
[root@db-tom ~]# echo $JAVA_HOME
[root@db-tom ~]# /usr/java/jdk1.8.0_73