Install JDK 7 on Ubuntu

Posted on January 25, 2012

http://www.shinephp.com/install-jdk-7-on-ubuntu/

Task: Install JDK 7 on Ubuntu desktop.
Problem 1: Java version 7 is not available from Ubuntu repositories for your Ubuntu version (prior to 11.10 Oneiric). You don’t see it neither via “Ubuntu Software Center” nor via “Synaptic Package Manager”.
What to do: Download JDK 7 binaries from the official Java site.
Problem 2: You are Debian/Ubuntu user and don’t see applicable .deb package.
What to do: Again, download JDK 7 binaries from the official Java site, install and configure it manually.
Step by step instructions to install and manual configure JDK 7 on the Ubuntu 10.04 LTS (the Lucid Lynx) desktop follow:
- For my X64 Ubuntu 10.04 LTS Desktop installation I downloaded Linux x64 – Compressed Binary file named jdk-7-linux-x64.tar.gz.
- Unpack it with command
gzip -d jdk-7-linux-x64.tar.gz
You will get jdk-7-linux-x64.tar file.
- Extract files from tar archive with command
tar -xvf jdk-7-linux-x64.tar
JDK 7 package is extracted into ./jdk1.7.0 directory.
- Move JDK 7 directory to place where it should be. Right, to the /usr/lib/jvm/jdk1.7.0 directory. Use this command for that
sudo mv ./jdk1.7.0/ /usr/lib/jvm/jdk1.7.0
- Execute this command
sudo update-alternatives –config java
to know under what number you will config you new Java installation. You will get output as:

$sudo update-alternatives –config java
There are 2 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
————————————————————
* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode

Press enter to keep the current choice[*], or type selection number:

Remember the last number and press enter to exit this utility.
- Execute this command
sudo update-alternatives –install /usr/bin/java java /usr/lib/jvm/jdk1.7.0/jre/bin/java 3
to add your new JDK 7 installation into alternatives list. I put 3 there as 2 was last number for my configuration. You should use your own number from the previous step increased by 1.
- Execute this command
sudo update-alternatives –config java.
You will see output similar one below:
$sudo update-alternatives –config java
There are 3 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
————————————————————
* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode
3 /usr/lib/jvm/jdk1.7.0/jre/bin/java 3 manual mode

Press enter to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/lib/jvm/jdk1.7.0/jre/bin/java to provide /usr/bin/java (java) in manual mode.

In case you have other answer from update-alternatives –config java command, e.g. ‘no alternatives for java’, try this command:
sudo update-alternatives –install /usr/bin/java java /usr/lib/jvm/jdk1.7.0/jre/bin/java 0

This will select needed java version in case you had not any previous java version installed before.

The job is done. Task is completed and work is finished. Just check version of your new JDK 7 installation typing this command java -version. You should see something like this:
~$ java -version
java version “1.7.0″
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

Compile PHP4

Posted on January 18, 2012

CFLAGS="-I/usr/include/apr-1 -D_LARGEFILE64_SOURCE=1" ./configure --with-apxs2={where your apxs2 install} --with-mysql
make
make install

this is the 3rd times

in httpd.conf

LoadModule php4_module /usr/lib/httpd/modules/libphp4.so

SetHandler application/x-httpd-php

Fedora Apache Folder Permission

Posted on January 16, 2012

chcon -R -h -t httpd_sys_content_t /opt/sites/

SVN

Posted on January 16, 2012

1. svn ignore
svn propedit svn:ignore ./nbproject

2. svn create branch
a. Note the current head revision

svn info svn://server.com/svn/repository/trunk | grep Revision

b. Make a clean, remote copy of trunk into the branches folder. Name it something. We’ll call it your_branch:

svn cp svn://server.com/svn/repository/trunk svn://server.com/svn/repository/branches/your_branch -m “Branching from trunk to your_branch at HEAD_REVISION”

c. switch your local checkout to point to the new branch (this will not overwrite your changes):

svn switch svn://server.com/svn/repository/branches/your_branch .

d. Check that your local checkout is definitely now your_branch, and that you can update ok:

svn info | grep URL
svn up

3. updateing the branch

a. First, update your branch checkout and commit any outstanding changes.
b. Search the Subversion log to see at what revision number you last merged the changes (or when the original branch was made, if you’ve never merged). This is critical for making a successful merge

svn log –limit 500 | grep -B 3 your_branch

c. Also note the current head revision:

svn info svn://server.com/svn/repository/trunk | grep Revision

d. Merge the difference of the last merged revision on trunk and the head revision on trunk into the your_branch working copy:

svn merge -r LAST_MERGED_REVISION:HEAD_REVISION svn://server.com/svn/repository/trunk .

Replace LAST_MERGED_REVISION with the revision number you noted in step b, and HEAD_REVISION with the revision number you noted in step c.
Now look for errors in the output. Could all files be found? Did things get deleted that shouldn’t have been? Maybe you did it wrong. If you need to revert, run svn revert -R *.

e. Otherwise, if things seem ok, check for conflicts:

svn status | egrep ‘^C|^.C’

Resolve any conflicts. Make sure the application starts and the tests pass.

f. commit your merge.

svn ci -m “Merged changes from trunk to your_branch: COMMAND”

Replace COMMAND with the exact command contents from step 4.

4 folding the branch back into trunk

Hey, your_branch is done! Now it has to become trunk, so everyone will use it and see how awesome it is.

This only happens once per branch.

a. First, follow every step in the previous section (“updating the branch”) so that your_branch is in sync with any recent changes on trunk.

b. Delete trunk completely:

svn del svn://server.com/svn/repository/trunk

c. Move your_branch onto the old trunk location:

svn mv svn://server.com/svn/repository/branches/your_branch svn://server.com/svn/repository/trunk

d. Relocate your working copy back to trunk:

svn switch –relocate svn://server.com/svn/repository/branches/your_branch svn://server.com/svn/repository/trunk

PHP Reflection

Posted on December 08, 2011

http://blog.roodo.com/rocksaying/archives/10657709.html

GIT Group Permission

Posted on October 08, 2011

http://mapopa.blogspot.com/2009/10/git-insufficient-permission-for-adding.html

cd repository.git

sudo chmod -R g+ws *
sudo chgrp -R mygroup *

git repo-config core.sharedRepository true

Fix Firefox profile error

Posted on September 17, 2011

sudo chown -R `id -un`:`id -gn` ~

Mac Lion x64bit Install Python Mysql on python2.7

Posted on September 03, 2011

I’ve been struggling with installation of Python Mysql.

Here is my setup procedure.

Install Mysql 5.5.15 x32 first

In ~/.bash_profile, add
# let python run as 32 bit
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
export VERSIONER_PYTHON_PREFER_64_BIT=no
export VERSIONER_PYTHON_PREFER_32_BIT=yes

then,
defaults write com.apple.versioner.python Prefer-32-Bit -bool yes

Download MySQL_python-1.2.3-py2.7
ARCHFLAGS=’-arch i386′ python setup.py build
sudo ARCHFLAGS=’-arch i386′ python setup.py instal

All done

My Question is that should python mysql itself provide better solution for the installation? Anyway, it’s open source.

http://stackoverflow.com/questions/7335853/mysql-python-installation-problems-on-mac-os-x-lion

sudo ARCHFLAGS='-arch x86_64' python setup.py build
sudo ARCHFLAGS='-arch x86_64' python setup.py install

Change File Permission In Command Line

Posted on June 24, 2011

Find all file in the giving folder and change the permission to 644
find /path/to/apache -type f -print0 | xargs -I {} -0 chmod 0644 {}

Find all folder in the giving folder and change the permission to 755
find /path/to/apache -type d -print0 | xargs -I {} -0 chmod 0755 {}

Git Ignore File Permission

Posted on May 19, 2011


git config core.fileMode false