source: general/prog/ojdk-conf.xml

trunk
Last change on this file was 755607e3, checked in by Xi Ruoyao <xry111@…>, 3 weeks ago

Kick MANPATH out of the book

The man program automatically deduce a good default from PATH, thus no
need to set MANPATH as long as the corresponding PATH component is
added.

  • Property mode set to 100644
File size: 4.6 KB
RevLine 
[ab4fdfc]1<?xml version="1.0" encoding="UTF-8"?>
[58cba7f0]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6]>
7
[c751775]8<sect1 id="ojdk-conf" xreflabel="Configuring the Java environment">
[58cba7f0]9 <?dbhtml filename="ojdk-conf.html"?>
10
11
[c751775]12 <title>Configuring the Java environment</title>
[58cba7f0]13
[55bcdd7]14 <sect2 id="java-profile">
15 <title>Setting up the environment</title>
16
[58cba7f0]17 <para>
18 After the package installation is complete, the next step is to make sure
19 that the system can properly find the files. If you set up your login
20 scripts as recommended in <xref linkend='postlfs-config-profile'/>, update
21 the environment by creating the <filename>openjdk.sh</filename> script,
22 as the <systemitem class="username">root</systemitem> user:
23 </para>
24
25<screen role="root"><userinput>cat &gt; /etc/profile.d/openjdk.sh &lt;&lt; "EOF"
26<literal># Begin /etc/profile.d/openjdk.sh
27
28# Set JAVA_HOME directory
29JAVA_HOME=/opt/jdk
30
31# Adjust PATH
32pathappend $JAVA_HOME/bin
33
34# Auto Java CLASSPATH: Copy jar files to, or create symlinks in, the
[7c6b211f]35# /usr/share/java directory.
[58cba7f0]36
37AUTO_CLASSPATH_DIR=/usr/share/java
38
39pathprepend . CLASSPATH
40
41for dir in `find ${AUTO_CLASSPATH_DIR} -type d 2>/dev/null`; do
42 pathappend $dir CLASSPATH
43done
44
45for jar in `find ${AUTO_CLASSPATH_DIR} -name "*.jar" 2>/dev/null`; do
46 pathappend $jar CLASSPATH
47done
48
49export JAVA_HOME
[f0206fc]50
51# By default, Java creates several files in a directory named
52# /tmp/hsperfdata_[username]. This directory contains files that are used for
53# performance monitoring and profiling, but aren't normally needed on a BLFS
54# system. This environment variable disables that feature.
55_JAVA_OPTIONS="-XX:-UsePerfData"
56
57export _JAVA_OPTIONS
58
59unset AUTO_CLASSPATH_DIR dir jar _JAVA_OPTIONS
[58cba7f0]60
61# End /etc/profile.d/openjdk.sh</literal>
[77b64bd]62EOF</userinput></screen>
63
64 <para>
65 If <xref linkend="sudo"/> is installed, the super user should have
66 access to the above variables. Execute the following commands as the
67 <systemitem class="username">root</systemitem> user:
68 </para>
69
70<screen role="root"><userinput>cat &gt; /etc/sudoers.d/java &lt;&lt; "EOF"
71<literal>Defaults env_keep += JAVA_HOME
[f0206fc]72Defaults env_keep += CLASSPATH
73Defaults env_keep += _JAVA_OPTIONS</literal>
[58cba7f0]74EOF</userinput></screen>
75
76 <para>
[0d754e01]77 To use <command>mandb</command> to include the OpenJDK man pages
[58cba7f0]78 in its database, issue, as the <systemitem class="username">root
79 </systemitem> user:
80 </para>
81
82<screen role="root"><userinput>cat &gt;&gt; /etc/man_db.conf &lt;&lt; "EOF" &amp;&amp;
83<literal># Begin Java addition
84MANDATORY_MANPATH /opt/jdk/man
85MANPATH_MAP /opt/jdk/bin /opt/jdk/man
86MANDB_MAP /opt/jdk/man /var/cache/man/jdk
87# End Java addition</literal>
88EOF
89
[f9f0406c]90mkdir -p /var/cache/man &amp;&amp;
[58cba7f0]91mandb -c /opt/jdk/man</userinput></screen>
92
[55bcdd7]93 </sect2>
94
95 <sect2 id="ojdk-certs" xreflabel="installing the JVM Certificate Authority Certificates">
96
97 <title>Setting up the Certificate Authority Certificates for Java</title>
98
99 <para>
100 <application>OpenJDK</application> uses its own format for the
101 CA certificates. The Java security modules use
102 <envar>$JAVA_HOME</envar><filename>/lib/security/cacerts</filename> by
103 default. In order to keep all the certificates in one place, we use
[8944fff]104 <filename>/etc/ssl/java/cacerts</filename>. The instructions
105 on the <xref linkend="make-ca"/> page previously created the file
[55bcdd7]106 located in <filename class="directory">/etc/ssl/java</filename>.
[b59e5eb3]107 Set up a symlink in the default location as the
[55bcdd7]108 <systemitem class="username">root</systemitem> user:
109 </para>
110
[8944fff]111<screen role="root"><userinput>ln -sfv /etc/pki/tls/java/cacerts /opt/jdk/lib/security/cacerts</userinput></screen>
[55bcdd7]112
[58cba7f0]113 <para>
[8944fff]114 Use the following command to check if the <filename>cacerts</filename>
[55bcdd7]115 file has been successfully installed:
[58cba7f0]116 </para>
117
[8944fff]118<screen role="root"><userinput>/opt/jdk/bin/keytool -list -cacerts</userinput></screen>
[55bcdd7]119
120 <para>
121 At the prompt <computeroutput>Enter keystore password:</computeroutput>,
122 enter <userinput>changeit</userinput> (the default) or just press the
123 <quote>Enter</quote> key. If the <filename>cacerts</filename> file was
124 installed correctly, you will see a list of the certificates with
125 related information for each one. If not, you need to reinstall them.
126 </para>
127
128 <para>
129 If you later install a new JVM, you just have to create the symlink in
130 the default location to be able to use the cacerts.
131 </para>
132
133 </sect2>
134
[58cba7f0]135</sect1>
Note: See TracBrowser for help on using the repository browser.