Install and configure JDK in CentOS 7 and jdk in centos 7
1. Set up an ftp server
We have installed the vsftpd server on CentOS. For details about how to install and configure the vsftpd server, refer to enable FTP and configure users in CentOS, install the LeapFTP client in Windows, and upload resources to the vsftpd server through LeapFTP, it is stored in the/var/ftp/pub path of CentOS by default.
2. Enable the ssh service
The ssh service of CentOS is disabled by default.Service sshd startCommand to enable the CentOS ssh service, install the putty client on Windows, so that you can remotely control the CentOS System on windows through putty.
3. Install jdk
Enter the commandCd/var/ftp/pubEnter the pub directory and enter the commandLsShow all files in pub. By default, the resources do not have the execution permission, so we need to enterChmod + x jdk-8u45-linux-x64.rpmGrant the execution permission to the resource and enter the resource again.LsCommand. If the target resource is green, it indicates that you have the execution permission.
RunRpm-ivhJdk-8u45-linux-x64.rpmCommand to install jdk. The default installation path is/usr/java/java1.8.0 _ 45. To facilitate later configuration, You can rename the file and enter the commandMv/Usr/java/java1.8.0 _ 45/Usr/java/java1.8Rename java1.8.0 _ 45 to java1.8.
4. Configure jdk Environment Variables
Enter the commandVi/etc/profileVi is the command mode by default. Enter the commandIThen enter the editing mode. Add the following content at the end of the profile:
JAVA_HOME=/usr/java/jdk1.8PATH=$JAVA_HOME/bin:$PATHCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport JAVA_HOMEexport PATHexport CLASSPATH
After editing, Press ESC and enter
: XSave and exit.
5. Test jdk
Enter the javac-version command. If the java version is displayed, the configuration is successful.