sudo wget https:\/\/www-us.apache.org\/dist\/maven\/maven-3\/3.6.0\/binaries\/apache-maven-3.6.0-bin.tar.gz\n<\/code><\/pre>\n\n\n\nOnce the download has completed, extract the downloaded archive:<\/p>\n\n\n\n
sudo tar -xvzf apache-maven-3.6.0-bin.tar.gz\n<\/code><\/pre>\n\n\n\nNext, rename the extracted directory:<\/p>\n\n\n\n
sudo mv apache-maven-3.6.0 maven \n<\/code><\/pre>\n\n\n\nSetup environment variables<\/h2>\n\n\n\n
Next, you will need to setup the environment variables such as M2_HOME<\/code>, JAVA_HOME<\/code> and PATH<\/code>. You can do this by creating a mavenenv.sh<\/code> file inside of the \/etc\/profile.d\/<\/code> directory:<\/p>\n\n\n\nsudo vi \/etc\/profile.d\/mavenenv.sh\n<\/code><\/pre>\n\n\n\nAdd the following lines:<\/p>\n\n\n\n
export JAVA_HOME=\/usr\/lib\/jvm\/default-java\n\nexport M2_HOME=\/opt\/maven\n\nexport PATH=${M2_HOME}\/bin:${PATH}\n<\/code><\/pre>\n\n\n\nSave and close the file, and make it executable:<\/p>\n\n\n\n
sudo chmod +x \/etc\/profile.d\/mavenenv.sh\n<\/code><\/pre>\n\n\n\nNow you can load the environment variables:<\/p>\n\n\n\n
source \/etc\/profile.d\/mavenenv.sh\n<\/code><\/pre>\n\n\n\nVerify installation<\/h2>\n\n\n\n
Once everything has been successfully configured, check the version of Apache Maven:<\/p>\n\n\n\n
mvn --version\n<\/code><\/pre>\n\n\n\nYou will see a similar output to the following:<\/p>\n\n\n\n
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T18:41:47Z)\n\nMaven home: \/opt\/maven\n\nJava version: 10.0.2, vendor: Oracle Corporation, runtime: \/usr\/lib\/jvm\/java-11-openjdk-amd64\n\nDefault locale: en_US, platform encoding: UTF-8\n\nOS name: \"linux\", version: \"4.15.0-36-generic\", arch: \"amd64\", family: \"unix\"\n<\/code><\/pre>\n\n\n\nCongratulations, you have successfully installed Apache Maven on your Ubuntu 18.04 server. To get started using Maven, visit the official Apache Maven documentation<\/a>.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","manualknowledgebasecat":[242,245,247],"manual_kb_tag":[],"_links":{"self":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/3752"}],"collection":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/comments?post=3752"}],"version-history":[{"count":2,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/3752\/revisions"}],"predecessor-version":[{"id":3759,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/3752\/revisions\/3759"}],"wp:attachment":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/media?parent=3752"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manualknowledgebasecat?post=3752"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb_tag?post=3752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}