CentOS6.5 in the use of the OPENJDK set java_home; Python; Golang;vb

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

1.

When running Java application, the prompt cannot find Java_home, query java-version

    1. [Jifeng@localhost bin]$ java-version
    2. java Version "1.7.0_55"
      OpenJDK Runtime Environment (rhel-2.4.7.1.el6_5-x86_64 u55-b13)
      OpenJDK 64-bit Server VM (build 24.51-b03, Mixed mode)

Centos 6.5 comes with a OPENJDK environment, but requires manual configuration of Java_home environment variables.


But OpenJDK's installation directory is different from our common Sun JDK storage location directory.

OPENJDK installed after the directory is located in:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.55.x86_64

The other versions are under/USR/LIB/JVM, including the JRE and JDK.


You can see "bin" in the "java-1.7.0-openjdk-1.7.0.55.x86_64" directory, and you can find the Javac file under Bin, which means that this is the JDK!

You only need to open the environment variable file vim/etc/profile or VIM/ROOT/.BASHRC in the terminal, (Save the command press ESC, then enter ": w" to Save, then ": Q" Exit VI) fill in the appropriate directory:

Export java_home=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.55.x86_64

Export classpath=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

Export path= $PATH: $JAVA _home/bin

This allows us to set up the JDK and then enter Source/etc/profile or SOURCE/ROOT/.BASHRC to take effect.

2.

centos6.5 under the VB virtual Machine CentOS installation vboxadditions:

Yum Install kernel-devel gcc make
ls/usr/src/kernels/
2.6.32-71.29.1.el6.i686
Ln-s/usr/src/kernels/2.6.32-71.29.1.el6.i686//usr/src/linux
SH vboxlinuxadditions.run

Replace with the corresponding version.

3.

Installation of Python2.7. After downloading 2.7, start the installation:

./configure--prefix=/usr/python2.7 #默认情况下python2.7 Several folders are loaded in different paths, so specify a unified path, installed together.

Make

Make install

Then you set up the Python environment variable in/root/.bash_profile or/etc/profile:

python_home=/usr/python2.7/
Export Python_home
Path= $PYTHON _home/bin: $PATH
Export PATH

Source/root/.bash_profile

Once you have specified the Python environment variable, the installation package will take advantage of the python specified by the environment variable.

PS: Before updating Python I have the Yum update system. After installing Python, the Python-v display version is 2.7.6, then Yum, will prompt the error, the reason is that Yum still use the system comes with the python2.6.6, but/usr/bin/yum in the python has pointed to 2.7.6. On-line approach:

1 2 3 4 5 6 7 8 #正常情况下即使python2.7 After the installation succeeds, the python that the system points to is still the 2.6.6 version, it is not recommended to uninstall because Yum is based on python2.6.6 to work properly. #采用下面的方法把系统默认的python修改为2. Version 7.6 mv/usr/bin/python/usr/bin/python2.6.6 ln-s/usr/local/bin/python2.7/usr/bin/python #检测是否成功 python-v #出现2.7.6 version information represents a successful Python 2.7.6

6. Solve the problem that Yum is not available after modifying the system default Python version

1 2 #修改yum文件 Vi/usr/bin/yum

The file header is

1 #!/usr/bin/python

change to the following content

1 #!/usr/bin/python2.6.6
Yum still won't work when you're done.

first find the CD or ISO file where you installed CentOS, as long as the system version is the same. Copy the following files into the system:

1 2 3) 4 5 python-2.6.6-36.el6.x86_64.rpm python-urlgrabber-3.9.1-8.el6.noarch.rpm python-devel-2.6.6-36.el6.x86_64.rpm python-libs-2.6.6-36.el6.x86_64.rpm yum-3.2.29-40.el6.centos.noarch.rpm

the specific version number is subject to your system disk or ISO availability. I copied it to the following directory

1 /usr/local/src/python-2.6.6

performing the installation

1 2 3 4 5 6 7 8 9 CD/USR/LOCAL/SRC/PYTHON-2.6.6/RPM-UVH--replacepkgs *.rpm #出现如下提示 Preparing ... #################################### ####### [100%] 1:python-libs ########################################### [20%] 2:python ############################ ############### [40%] 3:python-urlgrabber ########################################### [60%] 4:yum ################## ######################### [80%] 5:python-devel ########################################### [100%]
Since the previous update, Python, Python-libs, Yum have upgraded a minor version number, Python-urlgrabber has been installed, so just download python-devel-2.6.6-52.el6.x86_64. RPM installation.

The error message is still being prompted, but it is already available.

4.

Kernel Panic-not syncing:attempted to kill Init

Workaround:
When the system starts, press the ' E ' key to enter the grub editing interface, edit the Grub menu, select the "Kernel/vmlinuz-2.6.23.1-42.fc8 ro root=/dev/vogroup00/logvol00 rhgb quiet" column, Press ' E ' key to enter edit, add enforcing=0 at the end, i.e.:
Kernel/vmlinuz-2.6.23.1-42.fc8 ro root=/dev/vogroup00/logvol00 rhgb quiet enforcing=0
Press ' B ' key to continue booting, OK to go forward smoothly.

5.

Export GOARCH=AMD64
Export Goos=linux
Export path=.: $PATH: $GOBIN
Writing Programs

For example, use the Hello.go code to compile the command:

Package Mainimport "FMT" Func Main () {FMT. Printf ("Hello world\n")}

$ go Build hello.go
Run the program: $  ./hello

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.