In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to install maven in centos6.x, which has certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let Xiaobian take you to understand it together.
Install maven under centos6.x
1. Download maven package
First download the latest version of Maven from http://maven.apache.org/
I downloaded the package apache-maven-3.2.1-bin.tar.gz
2. Decompression maven package
Execute tar -zxvf apache-maven-3.2.1-bin.tar.gz
The following picture shows the decompression success page
3. Place under Expectations Directory (optional)
Put the decompressed files in the/opt directory
Execute sudo mv apache-maven-3.2.1 /opt
4. change the link
Execute ln -s apache-maven-3.2.1 apache-maven
5. Configure environment variables
6. changes to take effect
Executing source /etc/profile is the profile file takes effect
7. Check if configuration is successful
Execute mvn-v
The image above indicates successful installation.
CentOS automatically installs Maven
1. Automatic download of Maven
2. set the environment variable
3. Configure mirror
Installation: Download maven.rar Follow readme to execute
mirror configuration:
alimaven aliyun maven http://maven.aliyun.com/nexus/content/groups/public/ central central Maven Repository Switchboard http://repo1.maven.org/maven2/ central repo2 central Human Readable Name for this Mirror. http://repo2.maven.org/maven2/ ibiblio central Human Readable Name for this Mirror. http://mirrors.ibiblio.org/pub/mirrors/maven2/ jboss-public-repository-group central JBoss Public Repository Group http://repository.jboss.org/nexus/content/groups/public maven.net.cn oneof the central mirrors in china http://maven.net.cn/content/groups/public/ central
Add shell file:
#!/ bin/sh #close process killpies (){ pids=($(ps -ef | grep $1 | awk '{print $2}')) for pid in ${pids[@]}; do echo "Close process: pid ${pid}" kill -9 ${pid} done } killpids maven #Delete old maven echo "Delete old maven" rm -rf /usr/local/apache-maven-* #install maven srcPath=$(find /usr/maven -maxdepth 1 -type f|grep '.* maven.*. tar.gz$') if [[ $srcPath =~ "maven" ]] then echo "Installation package: $srcPath" rpm -ivh $srcPath else #Download maven yum -y install wget echo -e "Download Maven" wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz -P /usr/maven/ srcPath=$(find /usr/maven -maxdepth 1 -type f|grep '.* maven.*. tar.gz$') fi #unzip echo "unzip... " tar -xf $srcPath -C /usr/local path=$(find /usr/local -maxdepth 1 -type d|grep 'apache-maven-.* ') dir_name=${path##*/} echo $path echo $dir_name #grant permissions chmod -R 755 $path #Set environment variable sed -i '/M2_HOME/d' /etc/profile echo "Set environment variable echo "export M2_HOME=$path" > /etc/profile echo 'export PATH=$PATH:$M2_HOME/bin'>> /etc/profile source /etc/profile echo "Create soft links $path -> apache-maven" ln -s $path apache-maven echo "Configure mirrors" IFSBAK=$IFS #Backup original value IFS=# mirror=" # # alimaven # aliyun maven # http://maven.aliyun.com/nexus/content/groups/public/ # central # # # central # Maven Repository Switchboard # http://repo1.maven.org/maven2/ # central # # # repo2 # central # Human Readable Name for this Mirror. # http://repo2.maven.org/maven2/ # # # ibiblio # central # Human Readable Name for this Mirror. # http://mirrors.ibiblio.org/pub/mirrors/maven2/ # # # jboss-public-repository-group # central # JBoss Public Repository Group # http://repository.jboss.org/nexus/content/groups/public # # # maven.net.cn # oneof the central mirrors in china # http://maven.net.cn/content/groups/public/ # central # # ' " #loop for line in $mirror; do sed -i "//i\ $line" $path/conf/settings.xml done IFS=$IFSBAK #Restore echo "mvn -v" mvn -v echo "" Thank you for reading this article carefully. I hope that the article "How to install maven in centos6.x" shared by Xiaobian will be helpful to everyone. At the same time, I hope that everyone will support it a lot. Pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.