CentOS7 installation java8, tomcat8.5 graphic tutorials

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/fengdong1996/article/details/96187940

Preface:

  • We are the first to build a learning linux virtual machine in their own windows linux local time, the virtual machine is turned on remote ssh service, he will hang in the background when the server uses. Remote control software then install the virtual machines connected to remote control operation in the local windows, the whole is not linux operating on a virtual machine.
  •  We request must use the command linux way to build, not install a desktop, because we bought Ali server is contos7, after a local linux server that is not connected to the desktop, can not go to the server to install a desktop, so a waste of server resources. All we can do is to install remote control software locally, the local remote control server, the server only have to install some software.

Will be used herein in the windows end finalshell software for remote control is connected centos. finalshell is an interface with a remote control software, we can use it to achieve:

  1. To "drag and drop" approach to local windows files to upload files to the virtual machine
  2. Copy and paste command statement (centos command window is impossible)
  3. Direct display a virtual machine folder directory with a graphical interface

We need the following operations linux open remote ssh service that connects remote control in the local linux.


linux open ssh remote service Tutorial : https: //blog.csdn.net/fengdong1996/article/details/93191336



Ready to work:


In the end a windows install remote control software: finalshell
1, download path (directly copy the URL into a browser to run automatically downloaded) : http://www.hostbuf.com/downloads/finalshell_install.exe

2, after the installation is complete open the connection to the centos, Click:

3, the connection information in the window that opens enter the virtual machine:

Note: The virtual machine must be open ssh service, and open network, or can not connect, the virtual machine can run the command ip   ip addr  view .

4, the connection interface:

Here we can enter commands in the command window, create a new virtual machine to delete the file directly in the following directory, drag and drop the diameter of the windows file drag thrown into the virtual machine to complete the upload file, you can modify the copy in the upper right corner setup paste shortcut, you can quickly reach the copy command from the browser to run the command window.

 

Preparations completed, the installation began java8


java8 installation

java installation process is: windows java8 local download archive -> Upload from the local to the linux -> linux compressed file on the decompression -> Configure unzip the file path to the environment variable to complete the installation.

1, local download linux version java8 archive

Click this link to download the official website: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Tip: Download must be ** linux-64 ** version, ending ** tar.gz **. Official website to download need to download account login, register for a no, anyway, no charge.

2, transfer files to linux

Find windows local software downloaded java8 selected drag directly to the root directory of the virtual machine:

注意:一定要传到root目录,否则下一步解压会找不到文件。


3、解压java压缩文件

tar -zxvf jdk-8u211-linux-x64.tar.gz(自己的java压缩包名)

提示:tar -zxvf 是解压命令,后面的路径是自己下的压缩包的名称。自己的压缩包文件名可以选中上传的文件,->右键->复制路径

解压结果:


    
4、配置环境变量

输入以下命令使用vi编辑器配置环境变量:

vi /etc/profile

vi编辑器简单介绍:输入上面命令会进入到”**vi编辑器**”,vi编辑器刚进入时是不能编辑的,需要按字母"i"或"insert"键才开始进入编辑模式,使用上下左右键移动光标进行编辑。建议将虚拟机窗口全屏,进入编辑模式后左下角会有 "--  INSERT --"字样。当我们编辑完成后按键盘左上角的退出**Esc**键,接着输入字符 "**:wq!**" **回车**即可保存退出。

将如下信息复制粘贴到配置文件的最后面:

export JAVA_HOME=/root/jdk1.8.0_211(自己的java解压路径)
export CLASSPATH=$JAVA_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin

提示:复制都会ctrl+c,在虚拟机中,粘贴用  Shift+Insert 组合键,不行就鼠标右键,然后点粘贴,最好在finalshell的设置中改一下快捷键。

5、使配置信息生效

source /etc/profile

注意:必须运行上面语句后配置的环境变量才会立即生效。

6、测试是否成功

java -version

如图已经能查看到java版本信息,说明java8已经安装配置成功了



题外话:我记的windows安装完成后都是输入**javac**进行查看是否成功,我在linux上输入测试了一下竟让也可以,而且且专门回到windows上用cmd输入javac查看,发现输入结果一模一样。如此看来java的安装还是十分成功 的-_- ,瞬间感觉成就感十足啊。


----------------------------centos7安装java8完成--------------------------


 

tomcat8.5的安装

注:tomcat运行依赖java,安装的前提是必须确定安装了java。

tomcat的安装过程和java的安装类似:本地官网下载 —> 上传到linux —>解压 —>配置环境变量。

1、下载

tomcat下载官网地址:http://tomcat.apache.org/


注意:这里下载的版本依然是tar.gz格式。


2、上传到linux

 

同样使用finalsell从windows中将下载的压缩包拖到root目录下进行上传。


3、解压

tar -zxvf apache-tomcat-8.5.42.tar.gz(自己的压缩包文件名)

使用 tar -zxvf 命令解压,后面的是tomcat压缩文件名,压缩文件名可以选中上传到root根目录中的压缩包右键,复制路径方式得到,防止自己输入打错单词。



4、启动

可以先运行到tomcat的bin目录下,然后执行startup.sh文件。
我这里两句合成一句,可以一条命令直接启动tomcat。

/root/apache-tomcat-8.5.42/bin/./startup.sh


---------------------------centos7安装tomcat完成--------------------------

查看关闭linux防火墙

tomcat启动后,别人如果想要通过192.168.0.111:8080方式访问本服务器,一定要先关闭linux防火墙,否则浏览器会一直无法访问!!

1、查看防火墙状态

firewall-cmd --state

 running表示正在运行

2、停止防火墙

systemctl stop firewalld.service

这条命令是没有返回提示的。运行完成再次查看运行状态,显示服务已停止

3、禁止防火墙开机自启

systemctl disable firewalld.service


    
4、如果不想关防火墙可以开放tomcat端口

firewall-cmd --add-port=8080/tcp --permanent

其实留着也没啥用,建议还是直接关闭防火墙吧!

--------------------ContOS7防火墙设置结束-------------------------

Guess you like

Origin blog.csdn.net/fengdong1996/article/details/96187940