Adding Oracle ‘dba’ group to Ubuntu User

April 20, 2011 1 comment

1- Go to System->Administration->Users and groups.

Then select the “Group” tab, search for the “dba” group, click on properties and select your user moving from the pane on the left to the pane on the right. Accept the modification and you’re done.

2- use usermod from a terminal to add your user to the group:

sudo usermod -a -Gdba stan

Although I would recommend you keep starting and stopping the database with the oracle default user (just su – oracle in the terminal when you need to do it). It’s like the concept behind the “sudo” command in ubuntu: you’re protecting the user and yourself from mistakes, other people accesing your machine.

Advertisements
Categories: Oracle Tags: , , ,

Recover MySQL root Password

August 6, 2010 Leave a comment

You Can Recover MySql database root password easily by following steps

Step 1: Stop MySql Service

# /etc/init.d/mysql stop

You will see:

Stopping MySql database server: mysqld

Step 2: Start MySql With Out Password

# mysqld_safe –skip-grany-tables &

You Will See:

[1] 5988

Starting mysqld daemon with databases from /var/lib/mysql

mysqld_safe[6025]: started

Step 3: Connect to mysql server using mysql client

# mysql -u root

You Will See:

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 user Password

mysql> use mysql;
mysql> update user set password=PASSWORD(“NEW-ROOT-PASSWORD”) where User=’root’;
mysql> flush privileges;
mysql> quit

Step 5: Stop MySql Server

# /etc/init.d/mysql stop

You Will See:

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

[1]+  Done                    mysqld_safe –skip-grant-tables

Step 6: Stop MySql Server and Login as root

# /etc/init.d/mysql start
# mysql -u root -p


Categories: Linux, MySql Tags: , , ,

To delete the / after the src From HTML Files

August 5, 2010 1 comment

Deleting the / from the all html file after src=

Deleting the / from the all html files containing in one folder

sed -i ‘s/src=”\//src=”/g’ *.html

To delete the JavaScript Tag in HTML Files

August 4, 2010 Leave a comment

sed -i  ‘/<script type=”text\/javascript”/,/<\/script>/d’  *.html

OR

U can use following code also for same process

#!/bin/bash
# ALL HTML FILES
FILES=”*.html”
# for loop read each file
for f in $FILES
do
INF=”$f”
OUTF=”$f.out.tmp”
# replace javascript
sed ‘/<script type=”text\/javascript”/,/<\/script>/d’ $INF > $OUTF
/bin/cp $OUTF $INF
/bin/rm -f $OUTF
done

Executing Our Own Shell Script When OS Booting in Debian

August 4, 2010 1 comment

Write a shell script.

To Open the folder with super user permission

#! /bin/sh

sudo nautilus

save the file as sample.sh

Make sample file as executable

chmod a+x sample.sh

Copy the file into init.d folder

sudo cp sample.sh /etc/init.d/

check which is default runlevel

sudo vi /etc/inittab

# The default runlevel.
id:2:initdefault:

This means your default run level is 2.

Give the link to to the default run level

ln /etc/init.d/sample.sh /etc/rc2.d/S10sample

why i gave the link rc2.d, because of the default runlevel is 2 so i gave the link to rc2.d.

In S10sample ‘ S ‘ is mandatory 10 is number u can give your own number from 10 to 99

After that update rc by following code

sudo update-rc.d sample defaults

Installing Mono 2.4 in Ubuntu

February 15, 2010 2 comments

This is a step by step guide to installing Mono 2.4 and mod_mono on a

fresh Ubuntu Server install. Let’s begin.

1) Logon to machine so you see a command prompt.

Type: sudo bash

Enter your password, you should now be root. This will allow you to do

whatever you want without typing “sudo” in front of every command.

2) Install all prequisits for Mono. Note you can put all packages on a

single line, but if you’re just starting out, you might want to install

each one just to make sure it all goes well. If any package is already

installed, just continue on. Depending on your system, you might already

have some of these.

Type: apt-get install build-essential

Type: apt-get install pkg-config

Type: apt-get install bison

Type: apt-get install libglib2.0-0 libglib2.0-dev

Type: apt-get install libpng12-dev

Type: apt-get install libx11-dev

Type: apt-get install libfontconfig1-dev

Type: apt-get install libfreetype6-dev

Type: apt-get install apache2

Type: apt-get install apache2-threaded-dev

Type: apt-get install gettext

3) Download and build libgdiplus which is required for Mono to build.

Type: cd ~

Type: wget

http://ftp.novell.com/pub/mono/sources/libgdiplus/libgdiplus-2.4.tar.bz2

You should now have the file libgdiplus-2.4.tar.bz2 in your ~/ directory

Type: tar -xpjf libgdiplus-2.4.tar.bz2

This will decompress the tar file into its own directory, note you won’t

see any output)

You should now have a directory called libgdiplus-2.4

Type: cd libgdiplus-2.4/

Type: ./configure

You should not see any errors, but if you’re missing any packages please

install them and run “./configure” again.

Type: make

Sometimes here I see some error about “link is not a valid
libtool object” and Error 1. I have no idea what causes this, but I can
usually work around it by running “apt-get update” and “./configure” again.

Type: make install

4) Build Mono:

Type: cd ~
Type: wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.4.tar.bz2
Type: tar -xpjf mono-2.4.tar.bz2

This will take a minute or so because it’s a big file and you won’t see
anything on the screen because stuff isn’t too chatty in the UNIX world.

Type: cd mono-2.4/
Type: ./configure
Type: make

This will take a while – probably about 15 minutes or so.

Type: make install

When this is done, you should be able to type “mono” from the prompt and
see mono options. This is a good sign.

5) Build xsp (this also includes mono-server which is used for Apache
integration)

Type: cd ~
Type: wget http://ftp.novell.com/pub/mono/sources/xsp/xsp-2.4.tar.bz2
Type: tar -xpjf xsp-2.4.tar.bz2
Type: cd xsp-2.4/
Type: ./configure
Type: make
Type: make install

6) Build mod_mono so you can run Mono web sites on Apache

Type: cd ~
Type: wget
http://ftp.novell.com/pub/mono/sources/mod_mono/mod_mono-2.4.tar.bz2
Type: tar -xpjf mod_mono-2.4.tar.bz2
Type: cd mod_mono-2.4/
Type: ./configure
Type: make
Type: make install

7) Configure Mod_Mono with Apache

Type: cd /etc/apache2
Type: pico apache2.conf

Search for this section:
# Include module configuration:
Include /etc/apache2/mods-enabled/*.

load

Include /etc/apache2/mods-enabled/*.conf

Add the following line under the above lines:

Include /etc/apache2/mod_mono.conf

At the end of this file, add the following line:

MonoServerPath /usr/local/bin/mod-mono-server2

Press CTRL+X to exit Pico, answer “Yes” to save your changes and press

enter to use the same file name.

Restart Apache by typing: /etc/init.d/apache2 restart

8) Make sure it all works!

Type: cd /var/www

This is your default website directory. By default there’s just a

temporary index.html file that says “It works!”, you can remove this.

Type: rm *

Now let’s create a test ASPX page.

Type: pico default.aspx

If you know ASP.NET, you can write some code here. But for something

dirt simple, just use:

Save the file and exit Pico (CTRL+X)

In your web browser, you should now be able to browse to the site and

see “Hello World!” on your screen. From this point on, you should be good

to go and develop a much more complex application 🙂

Categories: Mono, Ubuntu Tags: , ,

Virtual Hosting Using apache2

October 23, 2009 2 comments

What is Virtual Hosting and where and why it is used?

Vitual Hosting is a method that servers such as web servers use to host more than one domain

name on the same computer.

Virtual hosting allows a website owner to have a site hosted on a web server that is shared with

other websites. In other words, virtual hosting services and bandwidht to more than one website.

Virtual web hosting is one of the most popular hosting options available at the moment –

probably because of cost effective because you won’t have to pay for a dedicated server to host just

your website.

Virtual web hosting is good solution for SME’s even for MNC’s also websites that aren’t constantly being visited

There are two basic methods of accomplishing virtual hosting: name-based, and IP address or ip-based.

Lets move to the Practical Session

Check are you have Apache2, mysql5, php5 in your PC or Laptop or NoteBook what ever you calls otherwise follow below steps

1. Install LAMP

2. Control Apache2

3. Control MySql

4. Virtual Hosting

5. Virtual Hosting with multiple names

1. Install LAMP – Linux Apache2 Mysql Php

I preasume you have Ubuntu Linux installed. Let’s install everything else (Apache 2, PHP5 and MySQL 5)

sudo aptitude install apache2 mysql-server php5 php5-mysql libapache2-mod-php5

Open your favourite web browser and enter http://localhost (or http://127.0.0.1)

Check if Apache 2 and PHP 5 work fine

Create a file called test.php and enter this text in it

<?php phpinfo(); ?>

Save the file and copy it to your web site folder, e.g. /var/www

Open your web browser and run

http://localhost/test.php

2. Control Apache2

To start Apache2

sudo /etc/init.d/apache2 start

To stop Apache2

sudo /etc/init.d/apache2 stop

To restart Apache2

sudo /etc/init.d/apache2 restart

After first install I always get this error:

apache2: Could not determine the server’s domain name, using 127.0.0.1 for ServerName

It is easily fixed – add ServerName localhost into apache2.conf

gksudo gedit /etc/apache2/apache2.conf

3. Control MySQL

To start MySQL

sudo /etc/init.d/mysql start

To restart MySQL

sudo /etc/init.d/mysql restart

To stop MySQL

sudo /etc/init.d/mysql stop

Creating Database using MySql

First Login into MySql Using Following Command here it will ask password then enter the root password of My Sql. MySql Password has given when it was Installing

mysql -u root -p

Create Database

Create Database virtual;

Use Database

Use virtual;

4. Virtual Hosting


(a) Allow user to web directory

(b) Create Folder and link to web directory

(c) Using Virtual Hosts

(d) Adding Virtual Hosts

(e) Apache Configuaration


localhost is the default host, but if you add virtal hosts, you may want to change it to, say, somechow

However, the address http://localhost/ by default points to /var/www. That folder is basically empty that is why you do not see much in your web browser.

To show proper web site, you need to put some web pages in that folder.

(a) allow yourselft to have access to the folder /var/www

sudo chown -R USERNAME /var/www

Now, you can copy your great web site to the folder /var/www.

Start Firefox again and type http://localhost/. Do you see you web site?

If you hate to always navigate to /var/www, you can press Control-D in Nautilus to add a new bookmark in Places menu. You can create a link to it in your home folder for easy access, alternatively.

(b) Create a folder in your desired location and link to the web direcotry

ln -s /var/www ~/WebSite

Now you can place all your web content inside the folder WebSite in your home folder and you will see your web site by going to

http://localhost/

(c) Using virtual hosts

If I put a folder called somechow inside /var/www, I can run my local web site by entering http://localhost/somechow.

However, I prefer more human-readable web addresses. For example, when I enter http://somechow, my local WordPress copy of somechow.Ws (located in /home/some/WebSites/somechow) runs in Firefox.

To use virtual hosts, you need to change hosts file and add some information for Apache.

(d) I add my virtual host address to Hosts file

sudo nano /etc/hosts

127.0.0.1 somechow

In above quote instead of 127.0.0.1 I used my desktop IP.

Then I reboot the computer or networking for changes to take effect

sudo /etc/init.d/networking restart

(e) Apache Configuration

Open the window in super user mode  uisng following command prompt

sudo nautilus

I create a copy of file default which is located in /etc/apache2/sites-available and rename it to somechow.

I created a link to this file by right-clicking and selected MakeLink option

I copy this link to /etc/apache2/sites-enabled

I change link file into somechow:

NameVirtualHost * is changed to NameVirtualHost somechow

ServerName@somechow is added under ServerAdmin

DocumentRoot /var/www/ is changed to DocumentRoot /home/some/WebSites/somechow

5. Virtual Hosting with multiple names


(a) Allow user to web directory

(b) Create Folder and link to web directory

(c) Using Virtual Hosts

(d) Adding Virtual Hosts

(e) Apache Configuaration

localhost is the default host, but if you add virtal hosts, you may want to change it to, say, somechow and somedary

However, the address http://localhost/ by default points to /var/www. That folder is basically empty that is why you do not see much in your web browser.

To show proper web site, you need to put some web pages in that folder.

(a) allow yourselft to have access to the folder /var/www

sudo chown -R USERNAME /var/www

Now, you can copy your great web site to the folder /var/www.

Start Firefox again and type http://localhost/. Do you see you web site?

If you hate to always navigate to /var/www, you can press Control-D in Nautilus to add a new bookmark in Places menu. You can create a link to it in your home folder for easy access, alternatively.

(b) Create a folder in your desired location and link to the web direcotry

ln -s /var/www ~/WebSite

Now you can place all your web content inside the folder WebSite in your home folder and you will see your web site by going to

http://localhost/

(c) Using virtual hosts

If I put a folder called somechow and somedary inside /var/www, I can run my local web site by entering http://localhost/somechow or http://localhost/somedary

However, I prefer more human-readable web addresses. For example, when I enter http://somechow and http://somedary , my local WordPress copy of somechow.Ws or somedary.ws(located in /home/some/WebSites/somechow and /home/some/WebSites/somedary ) runs in Firefox.

To use virtual hosts, you need to change hosts file and add some information for Apache.

(d) I add my virtual host address to Hosts file

sudo nano /etc/hosts

127.0.0.1 somechow

127.0.0.1 somedary

In above quote instead of 127.0.0.1 I used my desktop IP.

Then I reboot the computer or networking for changes to take effect

sudo /etc/init.d/networking restart

(e) Apache Configuration

(i) For somechow

Open the window in super user mode  uisng following command prompt

sudo nautilus

I create a copy of file default which is located in /etc/apache2/sites-available and rename it to somechow.

I created a link to this file by right-clicking the somechow and selected MakeLink option

I copy this link to /etc/apache2/sites-enabled

I change link file into somechow:

NameVirtualHost * is changed to NameVirtualHost somechow

ServerName@somechow is added under ServerAdmin

DocumentRoot /var/www/ is changed to DocumentRoot /home/some/WebSites/somechow

(ii) For somedary

Open the window in super user mode  uisng following command prompt

sudo nautilus

I create a copy of file default which is located in /etc/apache2/sites-available and rename it to somedary.

I created a link to this file by right-clicking the somechow and selected MakeLink option

I copy this link to /etc/apache2/sites-enabled

I change link file into somedary:

NameVirtualHost * is changed to NameVirtualHost somedary

ServerName@somedary is added under ServerAdmin

DocumentRoot /var/www/ is changed to DocumentRoot /home/some/WebSites/somedary






%d bloggers like this: