Java

Java is a set of computer software and specifications developed by Sun Microsystems, which was later acquired by the Oracle Corporation, that provides a system for developing application software and deploying it in a cross-platform computing environment. Java is used in a wide variety of computing platforms from embedded devices and mobile phones to enterprise servers and supercomputers.

Spring Logo

Spring Framework

The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications - on any kind of deployment platform. A key element of Spring is infrastructural support at the application level: Spring focuses on the "plumbing" of enterprise applications so that teams can focus on application-level business logic, without unnecessary ties to specific deployment environments.

Hibernate Logo

Hibernate Framework

Hibernate ORM is an object-relational mapping framework for the Java language. It provides a framework for mapping an object-oriented domain model to a relational database.

Showing posts with label Fedora. Show all posts
Showing posts with label Fedora. Show all posts

Sunday, September 15, 2013

How to Install MySQL on Fedora 17/18

Installing MySQL on Fedora 17/18

The following are the steps to install a MySQL in Fedora
  
Step1: Open terminal and change to root user

[ranga@ranga ~]$ su
Password:
[root@ranga ranga]# 

Step2: Install Remi repository by using following command

[root@ranga ranga]# rpm -Uvh http://rpms.famillecollet.com/remi-release-17.rpm
-------------------------------------------------------------------
[root@ranga ranga]#

Step3: List out the all available versions

[root@ranga ranga]# yum --enablerepo=remi list mysql mysql-server
-------------------------------------------------------------------
Installed Packages
-------------------------------------------------------------------
mysql.x86_64                                                           5.5.33-1.fc17.remi                                                     remi   
mysql-server.x86_64                                                    5.5.33-1.fc17.remi                                                     remi   
[root@ranga ranga]# 

Here available version is 5.5.33

Step4: Install or update available mysql version

[root@ranga ranga]# yum --enablerepo=remi install mysql mysql-server
--------------------------------------------------------
Installed:
mysql-server.x86_64 0:5.5.33-1.fc17.remi                                                                                                           
--------------------------------------------------------
Updated:
mysql.x86_64 0:5.5.33-1.fc17.remi                                                                                                                  

Dependency Updated:
mysql-devel.x86_64 0:5.5.33-1.fc17.remi                                    mysql-libs.x86_64 0:5.5.33-1.fc17.remi                                  

Complete!

Step5: Start the MySQL server and autostart MySQL on boot

[root@ranga ranga]# systemctl start mysqld.service
[root@ranga ranga]# systemctl enable mysqld.service
ln -s '/usr/lib/systemd/system/mysqld.service' '/etc/systemd/system/multi-user.target.wants/mysqld.service'
Step6: MySQL Secure Installation
  1. Set (Change) root password(Mandatory)
  2. Remove anonymous users(Optional)
  3. Disallow root login remotely(Optional)
  4. Remove test database and access to it(Optional)
  5. Reload privilege tables(Optional)
 [root@ranga ranga]# /usr/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y  
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] n
 ... skipping.

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
 ... skipping.

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] n
 ... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Step7: Connect to MySQL database

[root@ranga ranga]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.5.33 MySQL Community Server (GPL) by Remi

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.

List out the all databases:
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)
mysql> 

Creating the Database

mysql> CREATE DATABASE ranga;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| ranga              |
| test               |
+--------------------+
5 rows in set (0.00 sec)
mysql> 

Creating the User and Droping the User

mysql> CREATE USER 'ranga' IDENTIFIED BY 'ranga';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL ON ranga.* TO 'ranga';
Query OK, 0 rows affected (0.01 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> drop user 'ranga';
Query OK, 0 rows affected (0.00 sec)

List out the all users, hosts, and passwords

mysql> select user, host, password from mysql.user;
+-------+-----------+-------------------------------------------+
| user  | host      | password                                  |
+-------+-----------+-------------------------------------------+
| root  | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root  | ranga     | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root  | 127.0.0.1 | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root  | ::1       | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
|       | localhost |                                           |
|       | ranga     |                                           |
| ranga | %         | *446F5A1568CCBD4237563DD8AF67580D8CF5AAA9 |
+-------+-----------+-------------------------------------------+
7 rows in set (0.00 sec)

Set the User password
mysql> set password for root@'127.0.0.1'= password('password');
Query OK, 0 rows affected (0.00 sec)

Delete the User by username
mysql> delete from mysql.user where user='ranga';
Query OK, 1 row affected (0.00 sec)

mysql> select user, host, password from mysql.user;
+------+-----------+-------------------------------------------+
| user | host      | password                                  |
+------+-----------+-------------------------------------------+
| root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root | ranga     | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root | 127.0.0.1 | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| root | ::1       | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
|      | localhost |                                           |
|      | ranga     |                                           |
+------+-----------+-------------------------------------------+
6 rows in set (0.00 sec)

Deleting the anonymous users
mysql> delete from mysql.user where user='';
Query OK, 2 rows affected (0.00 sec)

mysql> select user, host, password from mysql.user;
+------+-----------+-------------------------------------------+
| user | host      | password                                  |
+------+-----------+-------------------------------------------+
| root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root | ranga     | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root | 127.0.0.1 | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| root | ::1       | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
+------+-----------+-------------------------------------------+
4 rows in set (0.00 sec)
mysql> 

Quit from MySQL
mysql> exit
Bye
Changing MySQL root user password using MySQL sql command

1) Login to mysql server, type the following command at shell prompt:
$ mysql -u root -p

2) Use mysql database (type command at mysql> prompt):
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
3) Change password for user 'ranga'
mysql> update user set password=PASSWORD("reddy") where User='ranga';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

4) Finally, reload the privileges:
mysql> flush privileges;
mysql> quit
MySQL Root Password Recovery
Step # 1: Stop the MySQL server process.
[root@ranga ranga]# /etc/init.d/mysql stop
Stopping MySQL database server: mysqld.

Step # 2: Start the MySQL (mysqld) server/daemon process with the --skip-grant-tables option so that it will not prompt for password.
[root@ranga ranga]# mysqld_safe --skip-grant-tables &
[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[6025]: started

Step # 3: Connect to mysql server as the root user.
[root@ranga ranga]# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

Step # 4: Setup new mysql root account password i.e. reset mysql password.
mysql> use mysql;

mysql> update user set password=PASSWORD("root") where User='root';

mysql> flush privileges;

mysql> quit

Step # 5: Stop the Server.
[root@ranga ranga]# /etc/init.d/mysql stop

Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[6186]: ended

Done mysqld_safe --skip-grant-tables
Step # 6: Start the Server and test it
[root@ranga ranga]# /etc/init.d/mysql start[root@ranga ranga]# mysql -u root -p

UnInstall the MySQL:
Step1: 
[root@ranga ~]# rpm -qa | grep mysqlmysql-server-5.5.33-1.fc17.remi.x86_64
mysql-libs-5.5.33-1.fc17.remi.x86_64
mysql-devel-5.5.33-1.fc17.remi.x86_64
mysql-5.5.33-1.fc17.remi.x86_64
Step2:  Remove the all packages that come out of the query above.
Note: You can tell RPM to ignore dependencies and just rip stuff out with the --nodeps flag. 
[root@ranga ~]# rpm -e mysql-5.5.33-1.fc17.remi.x86_64 --nodeps
[root@ranga ~]# rpm -qa | grep mysql
mysql-server-5.5.33-1.fc17.remi.x86_64
mysql-libs-5.5.33-1.fc17.remi.x86_64
mysql-devel-5.5.33-1.fc17.remi.x86_64
[root@ranga ~]# rpm -e mysql-server-5.5.33-1.fc17.remi.x86_64 --nodeps
warning: /var/log/mysqld.log saved as /var/log/mysqld.log.rpmsave
[root@ranga ~]# rpm -e mysql-libs-5.5.33-1.fc17.remi.x86_64 --nodeps
[root@ranga ~]# rpm -e mysql-devel-5.5.33-1.fc17.remi.x86_64 --nodeps
[root@ranga ~]# rpm -qa | grep mysql
[root@ranga ~]#
In your system MySQL is successfully Uninstalled........
Another Trick to un install is
rpm -qa|grep <thing you want to uninstall> | xargs rpm -e
rpm -qa|grep mysql | xargs rpm -e
Simplest way of un install is System tools --> Add/Remove Application then looks for SQL and check MySQL to remove from the system.
Thanks for Reading this article.................

Wednesday, July 10, 2013

Reset forgotten Linux Root Password

Reset forgotten Linux Root Password

Reset forgotten Linux Root Password
Reset forgotten Linux Root Password
Reset forgotten Linux Root Password

How to Setup DNS Server in Linux

 How to Setup DNS Server in Linux


Click Here

Sunday, May 19, 2013

How to Install Sun Java JDK6 On Fedora 17/18

                                        How To Install Sun Java JDK6 On Fedora17/18


installing java on linux


The following are the steps to install a Sun JDK6 in Fedora. 

Step-1: Download the Java Jdk6 from the below link:
Download. 

After downloading you can get the rpm file( for example jdk-6u35-linux-x64-rpm.bin )

Step-2: Open terminal and copy the above file into any location. I am copying the above rpm file into following location
[ranga@ranga java]$ pwd
/home/ranga/install/java


[ranga@ranga java]$ ./jdk-6u35-linux-x64-rpm.bin
bash: ./jdk-6u35-linux-x64-rpm.bin: Permission denied
The above error you can get because of there is no permission to execute the above rpm file.
[ranga@ranga java]# chmod +x jdk-6u35-linux-x64-rpm.bin
Change to root user by using su command
[ranga@ranga java]$ su
Password:
[root@ranga java]# chmod +x jdk-6u35-linux-x64-rpm.bin
[root@ranga java]# ./jdk-6u35-linux-x64-rpm.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
  inflating: jdk-6u35-linux-amd64.rpm 
  inflating: sun-javadb-common-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-core-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-client-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-demo-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm 
Preparing...                ########################################### [100%]
   1:jdk                    ########################################### [100%]
Unpacking JAR files...
 rt.jar...
 jsse.jar...
 charsets.jar...
 tools.jar...
 localedata.jar...
 plugin.jar...
 javaws.jar...
 deploy.jar...
Installing JavaDB
Preparing...                ########################################### [100%]
   1:sun-javadb-common      ########################################### [ 17%]
   2:sun-javadb-core        ########################################### [ 33%]
   3:sun-javadb-client      ########################################### [ 50%]
   4:sun-javadb-demo        ########################################### [ 67%]
   5:sun-javadb-docs        ########################################### [ 83%]
   6:sun-javadb-javadoc     ########################################### [100%]

Java(TM) SE Development Kit 6 successfully installed.

Product Registration is FREE and includes many benefits:
* Notification of new versions, patches, and updates
* Special offers on Oracle products, services and training
* Access to early releases and documentation

Product and system data will be collected. If your configuration
supports a browser, the JDK Product Registration form will
be presented. If you do not register, none of this information
will be saved. You may also register your JDK later by
opening the register.html file (located in the JDK installation
directory) in a browser.

For more information on what data Registration collects and
how it is managed and used, see:
http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html

Press Enter to continue.....

Done.
[root@ranga java]# 


Now your installation is complete.

Step-3: Now you need to set the environment variables
There are two ways to set environment variables to the user wise.
1. Only particular user by using .bash_profile
2. Set to common to all users by using .profile
I am setting the the path to only particular user by using .bash_profile
Go to your home directory
 

[root@ranga java]$ cd
[root@ranga java]$ pwd
/home/ranga
[root@ranga ~]$ vi .bash_profile 
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

PATH=$PATH:$HOME/.local/bin:$HOME/bin
#export PATH

JAVA_HOME="/usr/java/jdk1.6.0_35"
export JAVA_HOME

export PATH=${JAVA_HOME}/bin:${PATH}
unset USERNAME

[root@ranga~]$. .bash_profile
Now check the JAVA_HOME setted properly or not by using following command.
 

[root@ranga~]$ echo $JAVA_HOME
/usr/java/jdk1.6.0_35
 

Step-4: Removing Open JDK

[root@ranga jdk1.6.0_35]# rpm -qa | grep java 

sun-javadb-core-10.6.2-1.1.i386 
sun-javadb-docs-10.6.2-1.1.i386 
tzdata-java-2013b-2.fc17.noarch 
sun-javadb-client-10.6.2-1.1.i386 
sun-javadb-javadoc-10.6.2-1.1.i386 
sun-javadb-common-10.6.2-1.1.i386 
java-1.7.0-openjdk-1.7.0.19-2.3.9.1.fc17.x86_64 
sun-javadb-demo-10.6.2-1.1.i386 
[root@ranga jdk1.6.0_35]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.19-2.3.9.1.fc17.x86_64
[root@ranga jdk1.6.0_35]# rpm -qa | grep java
sun-javadb-core-10.6.2-1.1.i386
sun-javadb-docs-10.6.2-1.1.i386
tzdata-java-2013b-2.fc17.noarch
sun-javadb-client-10.6.2-1.1.i386
sun-javadb-javadoc-10.6.2-1.1.i386
sun-javadb-common-10.6.2-1.1.i386
sun-javadb-demo-10.6.2-1.1.i386

Final step is reboot your system. 

[root@ranga jdk1.6.0_35]# reboot
After rebooting check once again which java installed.
[ranga@ranga ~]$ which java
/usr/java/jdk1.6.0_35/bin/java
[ranga@ranga ~]$ java -version
java version "1.6.0_35"
Java(TM) SE Runtime Environment (build 1.6.0_35-b10)
Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01, mixed mode)

Wednesday, May 1, 2013

Username is not in the sudoers file. This incident will be reported


If you are not on the "sudoers" list yet, Fedora/Ubuntu will tell you. You will see output like this:



Only the users listed in /etc/sudoers have the permission to use the command "sudo".

To give the sudo permission to a user we need to add the user to the file /etc/sudoers file.






Open the terminal and give the read and write permision to the sudoers file

chmod u+rw /etc/sudoers




Add the line




Here ranga is  the username

under the User privilege specification section.
Save the file and exit, now the sudo command should work for the user which was added in the file.

Sunday, April 14, 2013

How to Install Oracle 11g XE on Linux Fedora 17/18


Installing Oracle Database 11g XE on Fedora 17/18

[Oracle 11g Logo]

The following are the steps to install a Oracle 11g in fedora.

Step1:  Downloading the Software

Download the oracle-xe-11.2.0-1.0.x86_64.rpm.zip file from follwing url

Step2: Extracting the content

Extract the zip into any location. Here i am extracting the above zip into following location.

[ranga@ranga Disk1]$ pwd

/home/ranga/install/Disk1
[ranga@ranga Disk1]$ ls
oracle-xe-11.2.0-1.0.x86_64.rpm  response  upgrade
[ranga@ranga Disk1]$ 

Step3: Install libaio

[root@ranga Disk1]#  yum install libaio

Step4: Installing the oracle by using rpm command.

[root@ranga Disk1]# rpm -i oracle-xe-11.2.0-1.0.x86_64.rpm
Preparing... ########################################### [100%] 1:oracle-xe ########################################### [100%] Executing post-install steps... You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.

Your installation done but u need configure

Step5: Configuring the database

[root@ranga Disk1]# /etc/init.d/oracle-xe configure

Oracle Database 11g Express Edition Configuration ------------------------------------------------- This will configure on-boot properties of Oracle Database 11g Express Edition. The following questions will determine whether the database should be starting upon system boot, the ports it will use, and the passwords that will be used for database accounts. Press <enter> to accept the defaults. Ctrl-C will abort. Specify the HTTP port that will be used for Oracle Application Express [8080]: 9090 Specify a port that will be used for the database listener [1521]: Specify a password to be used for database accounts. Note that the same password will be used for SYS and SYSTEM. Oracle recommends the use of different passwords for each database account. This can be done after initial configuration: Confirm the password: Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y Starting Oracle Net Listener...Done Configuring database...Done Starting Oracle Database 11g Express Edition instance...Done Installation completed successfully.

In the above configuration, i am given port number is 9090 by default 8080 and database listener is same and you need to enter SYS or SYSTEM password. If you want while booting it self starting the database your giving 'y' in boot option. Finaly your database configured successfully. This installation created under /u01 directory. 

Starting the Database manually : 


To start the database manually, run this command as root user:
# /etc/init.d/oracle-xe start
or
# /usr/lib/oracle/xe/app/oracle/product/11.2.0/server/bin/lsnrctl start

Stopping the Database manually:
To stop the database manually, run the following command as root user:
# /etc/init.d/oracle-xe stop

Un Install the Oracle 11g: 

Step1: First you need to check which oracle version is installed.
[ranga@ranga ~]$ rpm -qa | grep oracle
oracle-xe-11.2.0-1.0.x86_64
Step2: Uninstall the oracle by using rpm -e with which version it is installed.
[ranga@ranga ~]$ rpm -e 
oracle-xe-11.2.0-1.0.x86_64