1. 安装虚拟机VMware
1)下载并一步一步安装vmware workstation 14
在vmware官网下载 https://www.vmware.com/
进入“下载”页面,会进入如下link:
https://my.vmware.com/cn/web/vmware/info/slug/desktop_end_user_computing/vmware_workstation_pro/14_0
选择合适下载, 很简单,这个就不多说了。
安装之后,这是试用版,1个月以后会过期,加上下面一串数字就可以长久使用了,网上可以搜到很多、、、
Note: 密钥: CG54H-D8D0H-H8DHY-C6X7X-N2KG6
2)下载CentOS 7镜像
link: http://archive.kernel.org/centos-vault/7.5.1804/isos/x86_64/
下载版本: CentOS-7-x86_64-DVD-1804.iso
workstation导入镜像,一步步安装。
可参考: https://blog.csdn.net/weixin_39879326/article/details/79617042
2. 安装java 并设置环境变量
1)安装java
yum install -y java
2)设置java环境变量
a. 查看java的home目录
[root@localhost ~]# ll /usr/bin/java
lrwxrwxrwx. 1 root root 22 Oct 30 01:29 /usr/bin/java -> /etc/alternatives/java
[root@localhost ~]# ll /etc/alternatives/java
lrwxrwxrwx. 1 root root 46 Oct 30 01:29 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.201.b09-2.el7_6.x86_64/jre/bin/java
由此可知,java的home目录是/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.201.b09-2.el7_6.x86_64/jre
b. 添加环境变量
[root@localhost ~]# vim /etc/profile
…
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.201.b09-2.el7_6.x86_64/jre
export CLASSPATH=.:
JAVA_HOME/lib/dt.jar:
PATH:$JAVA_HOME/bin
使之生效
[root@localhost ~]# source /etc/profile
3. 安装maven
yum install -y maven
Issues
Issue1 : Ifconfig command not found
Solution:
yum安装net-tools package
Yum -y install net-tools
Issue 2: yum install failed:One of the configured repositories failed (Unknown)
Solution:
Ping www.baidu.com, if failed, update /etc/sysconfig/network-scripts/ifcfg-ens33
ONBOOT=no, 改为yes
Then it should be ok for ping www.baidu.com
And then yum install will be ok.
Issue 3: locate command not found
Solution:
Yum install -y mlocate
Issue 4: locate: can not stat () `/var/lib/mlocate/mlocate.db’: No such file or directory
Solution:
Command: updatedb