Maven installation and Tomcat easy installation under Ubuntu

Time:2020-10-26
Ah ha ha, this is a super simple tutorial, not suitable for advanced users
I'm also groping for a more high-end way to use it... But in a word, it can be used

1. Download the installation package

#I'm used to putting things in this folder
cd ~/Downloads

#Download tomcat8
wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-8/v8.0.32/bin/apache-tomcat-8.0.32.tar.gz

#Download maven
wget http://apache.fayea.com/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz

2. Create the installation directory

#I'm used to installing eclipse, Maven and Tomcat in the user directory (that is ~ / programs)
#One of the advantages of this is that you don't need to change your authority. The disadvantages have not been found yet. Ha ha
cd ~
mkdir Programs

3. Decompress and move

cd ~/Downloads

#After unzip, an apache-tomcat-8.0.32 folder appears
tar -zxvf apache-tomcat-8.0.32.tar.gz

#After unzipping, an apache-maven-3.3.9 folder appears
tar -zxvf apache-maven-3.3.9-bin.tar.gz

#Move to installation directory
mv apache-tomcat-8.0.32 ~/Programs/apache-tomcat-8.0.32
mv apache-maven-3.3.9 ~/Programs/apache-maven-3.3.9

4. Establish soft link

#The advantage of setting up soft links is that you don't have to change the environment variables again when you upgrade later
cd ~/Programs
ln -s apache-tomcat-8.0.32 apache-tomcat
ln -s apache-maven-3.3.9 apache-maven

5. Set environment variables

#If bash, turn on ~ /. Bashrc and add at the end
export CATALINA_HOME=~/Programs/apache-tomcat
export M2_HOME=~/Programs/apache-maven
#And add after path:
    :$M2_HOME/bin
#Then the settings take effect
    source .bashrc


#If it's a fish shell, open ~ /. Config / fish/ config.fish  At the end
set -x CATALINA_HOME ~/Programs/apache-tomcat
set -x M2_HOME ~/Programs/apache-maven
#And add after path:
    $M2_HOME/bin
#Then the settings take effect
    . ~/.config/fish/config.fish

6. Observe whether the installation is successful

#Whether Tomcat was successfully installed: 
#Open the command line and type
cd $CATALINA_HOME/bin
./startup.sh
#Then open the browser for input
127.0.0.1:8080
#Close, please enter
./shutdown.sh
#Did Maven install successfully
#Open command line input
mvn -version

End = D