当前位置:   article > 正文

云计算实训(day01)

云计算实训(day01)

Linux的基础知识(文件的创建,删除,复制,移动,三种权限rwx)

查看文件:ls 查看文件详细信息 ls -l

新增文件:touch 创建Start.java文件 touch Start.java

移动文件:mv 把文件移动到/opt目录下 mv /opt/src/Start.java /opt/

复制文件:cp opt目录下的java复制到src目录 cp /opt/Start.java /opt/src/

创建目录:mkdir 创建src目录 mkdir src

修改属主,组:chown 三种用户类型:u属主 g属组 o其他人 修改abc文件的属主和数组

[root@localhost opt]# chown hh:hh abc

[root@localhost opt]# ll abc -rwxrwxrwx. 1 hh hh 13 7月 8 19:03 abc

修改权限:chmod 三种权限:r读 4 w写 2 x执行 1

[root@localhost  opt]# chmod 444 abc [root@1 opt]# ll abc -r--r--r--. 1 hh hh 13 7月 8 19:03 abc

[root@localhost ~]# yum -y install wget

[root@localhost ~]# wget https://dlcdn.apache.org/tomcat/tomcat-10/v10.1.25/bin/apache-tomcat-10.1.25.tar.gz

[root@localhost ~]# yum -y install lrzsz

[root@localhost ~]# rz -E

[root@localhost ~]# ls

anaconda-ks.cfg  apache-tomcat-10.1.25.tar.gz

[root@localhost ~]# tar -zxvf apache-tomcat-10.1.25.tar.gz

[root@localhost ~]# mv  apache-tomcat-10.1.25 /usr/local/

[root@localhost ~]# ls /usr/local/

apache-tomcat-10.1.25  bin  etc  games  include  lib  lib64  libexec  sbin  share  src

[root@localhost ~]# cd /usr/local/apache-tomcat-10.1.25/conf

[root@localhost conf]# ls

[root@localhost apache-tomcat-10.1.25]# ls webapps/ROOT/

[root@localhost apache-tomcat-10.1.25]# ls -l bin/

[root@localhost apache-tomcat-10.1.25]# cat /etc/profile

[root@localhost apache-tomcat-10.1.25]# yum list | grep jdk

[root@localhost apache-tomcat-10.1.25]# yum -y install java-1.8.0-openjdk.x86_64

[root@localhost apache-tomcat-10.1.25]# ./bin/startup.sh

[root@localhost apache-tomcat-10.1.25]# java -version

查看Java版本

[root@localhost opt]# yum install java-1.8.0-openjdk-devel

[root@localhost apache-tomcat-10.1.25]# vim /etc/profile

[root@localhost apache-tomcat-10.1.25]# cd /opt/

[root@localhost opt]# touch Main.java

[root@localhost opt]# vim Main.java

[root@localhost opt]# javac Main.java

[root@localhost opt]# ls -l

[root@localhost opt]# java Main

Hello World

[root@localhost opt]# ls /usr/local/

apache-tomcat-10.1.25  bin  etc  games  include  lib  lib64  libexec  sbin  share  src

[root@localhost opt]# ls /usr/local/apache-tomcat-10.1.25/

bin           conf             lib      logs    README.md      RUNNING.txt  webapps

BUILDING.txt  CONTRIBUTING.md  LICENSE  NOTICE  RELEASE-NOTES  temp         work

[root@localhost opt]# ls /usr/local/apache-tomcat-10.1.25/bin/

[root@localhost opt]# tar -zxvf apache-maven-3.9.8-bin.tar.gz

[root@localhost opt]# cd apache-maven-3.9.8/bin

[root@localhost bin]# vim /etc/profile

[root@localhost bin]# source /etc/profile

[root@localhost bin]# mvn -v

Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256)

Maven home: /opt/apache-maven-3.9.8

Java version: 1.8.0_161, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64/jre

Default locale: zh_CN, platform encoding: UTF-8

OS name: "linux", version: "3.10.0-862.el7.x86_64", arch: "amd64", family: "unix"

[root@localhost bin]# tar -zxvf apache-tomcat-9.0.91.tar.gz

[root@localhost bin]# cd apache-tomcat-9.0.91/

[root@localhost apache-tomcat-9.0.91]# ./bin/startup.sh

[root@localhost apache-tomcat-9.0.91]# systemctl stop firewalld​

一、Tomcat压缩包的下载与解压
1、下载Tomcat压缩包
官网下载地址:Tomcat官网

下载后利用xshell工具将压缩包传入虚拟机中

2、Tomcat解压缩

[root@localhost ~]#tar -zxvf apache-tomcat-9.0.91.tar.gz

3、把解压之后的目录移动到/usr/local/目录中

[root@localhost ~]# mv apache-tomcat-9.0.91 /usr/local/

[root@localhost ~]# yum -y install wget

[root@localhost ~]# wget https://dlcdn.apache.org/tomcat/tomcat-10/v10.1.25/bin/apache-tomcat-10.1.25.tar.gz

[root@localhost ~]# yum -y install lrzsz

[root@localhost ~]# ls

anaconda-ks.cfg  apache-tomcat-10.1.25.tar.gz

[root@localhost ~]# tar -zxvf apache-tomcat-10.1.25.tar.gz

[root@localhost ~]# mv  apache-tomcat-10.1.25 /usr/local/

[root@localhost ~]# ls /usr/local/

apache-tomcat-10.1.25  bin  etc  games  include  lib  lib64  libexec  sbin  share  src

[root@localhost ~]# cd /usr/local/apache-tomcat-10.1.25/conf

[root@localhost conf]# ls -l

[root@localhost apache-tomcat-10.1.25]# ls logs/

[root@localhost apache-tomcat-10.1.25]# ls -l webapps/

[root@localhost apache-tomcat-10.1.25]# ls bin/

[root@localhost apache-tomcat-10.1.25]# ls -l bin/

[root@localhost apache-tomcat-10.1.25]# ./bin/startup.sh

Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

At least one of these environment variable is needed to run this program

[root@localhost apache-tomcat-10.1.25]# cat /etc/profile

二、jdk的安装

[root@localhost apache-tomcat-10.1.25]# yum list | grep jdk

[root@localhost apache-tomcat-10.1.25]# yum -y install java-1.8.0-openjdk.x86_64

[root@localhost apache-tomcat-10.1.25]# ./bin/startup.sh

[root@localhost apache-tomcat-10.1.25]# java -version

[root@localhost opt]# yum install java-1.8.0-openjdk-devel

[root@localhost apache-tomcat-10.1.25]# vim /etc/profile

[root@localhost apache-tomcat-10.1.25]# cd /opt/

[root@localhost opt]# touch Main.java

[root@localhost opt]# vim Main.java

[root@localhost opt]# javac Main.java

[root@localhost opt]# ls -l

[root@localhost opt]# java Main

Hello World

三、maven的安装

检查
jdk环境
tomcat是否能运行

maven 是快速创建java应用的工具,依赖java环境,通过配置/etc/profile文件,让maven中的mvn指令暴露,就可以直接在命令行中使用,在绿色版本的软件中,不需要安装,所有bin和sbin目录中都没有link文件指定mvn指令,在/etc/
profile中新起一行。export暴露这个指令
export PATH=/opt/apache-maven-3.9.8/bin:$PATH修改完成之后,让配置文件立即生效,source /etc/profile

[root@localhost opt]# ls /usr/local/

[root@localhost opt]# ls /usr/local/apache-tomcat-10.1.25/

BUILDING.txt  CONTRIBUTING.md  LICENSE  NOTICE  RELEASE-NOTES  temp         work

[root@localhost opt]# ls /usr/local/apache-tomcat-10.1.25/bin/
[root@localhost opt]# ls apache-maven-3.9.8/bin/
m2.conf  mvn  mvn.cmd  mvnDebug  mvnDebug.cmd  mvnyjp
[root@localhost opt]# pwd
/opt

[root@localhost opt]# tar -zxvf apache-maven-3.9.8-bin.tar.gz

[root@localhost opt]# cd apache-maven-3.9.8/bin

[root@localhost apache-maven-3.9.8]# vim /etc/profile

[root@localhost ~]# cd /opt
[root@localhost opt]# cd apache-maven-3.9.8/bin

[root@localhost bin]# vim /etc/profile

[root@localhost bin]# source /etc/profile

[root@localhost bin]# mvn -v

四、练习

[root@localhost bin]# tar -zxvf apache-tomcat-9.0.91.tar.gz

[root@localhost bin]# ls
apache-tomcat-9.0.91         m2.conf  mvn.cmd   mvnDebug.cmd
apache-tomcat-9.0.91.tar.gz  mvn      mvnDebug  mvnyjp
[root@localhost bin]# cd apache-tomcat-9.0.91/
[root@localhost apache-tomcat-9.0.91]# ./startup.sh
-bash: ./startup.sh: 没有那个文件或目录
[root@localhost apache-tomcat-9.0.91]# ls
[root@localhost apache-tomcat-9.0.91]# systemctl stop firewalld

验证

​​​​​​​

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号