{"id":1375,"date":"2023-03-19T10:40:11","date_gmt":"2023-03-19T02:40:11","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1375"},"modified":"2023-04-28T21:15:10","modified_gmt":"2023-04-28T13:15:10","slug":"build-nexus-maven-private-server-on-centos-7","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/19\/build-nexus-maven-private-server-on-centos-7\/","title":{"rendered":"CentOS 7\u642d\u5efaNexus Maven\u79c1\u670d"},"content":{"rendered":"<h2>Nexus\u7b80\u4ecb<\/h2>\n<p>Nexus\u4ed3\u5e93\u7ba1\u7406\u5668\uff0c\u5206\u4e3a\u4e24\u4e2a\u7248\u672c\uff0cNexus Repository Manager OSS \u548c Nexus Repository Manager Pro\u3002\u524d\u8005\u53ef\u4ee5\u514d\u8d39\u4f7f\u7528\uff0c\u76f8\u6bd4\u540e\u8005\uff0c\u529f\u80fd\u7f3a\u5c11\u4e00\u4e9b\uff0c\u4f46\u662f\u4e0d\u5f71\u54cd\u6211\u4eec\u642d\u5efamaven\u79c1\u670d\u3002<\/p>\n<p>\u6240\u4ee5\u9009\u62e9OSS\u7248\u672c\uff0c\u4e0b\u8f7d\u5730\u5740\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/www.sonatype.com\/download-oss-sonatype\">https:\/\/www.sonatype.com\/download-oss-sonatype<\/a><\/p>\n<p><!-- more --><\/p>\n<h2>Nexus\u90e8\u7f72<\/h2>\n<p>\uff081\uff09\u5b89\u88c5JDK\u5e76\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/p>\n<pre><code># vim \/etc\/profile\n\nexport JAVA_HOME=\/usr\/local\/java\/jdk1.8.0_212\nexport JRE_HOME=${JAVA_HOME}\/jre\nexport CLASSPATH=.:${JAVA_HOME}\/lib:${JRE_HOME}\/lib\nexport PATH=$PATH:${JAVA_HOME}\/bin<\/code><\/pre>\n<p>\uff082\uff09\u5b89\u88c5Nexus<\/p>\n<pre><code># tar -zxf nexus-3.16.1-02-unix.tar.gz -C \/data\/www\/\n# cd \/data\/www\/\n# mv nexus-3.16.1-02 nexus\n# vim \/etc\/profile\n\nexport NEXUS_HOME=\/data\/www\/nexus\n\n# source \/etc\/profile\n# echo $NEXUS_HOME<\/code><\/pre>\n<h2>\u542f\u52a8\u670d\u52a1\u5668<\/h2>\n<ul>\n<li>\u524d\u53f0\u542f\u52a8<\/li>\n<\/ul>\n<pre><code># cd \/data\/www\/nexus\n# .\/bin\/nexus run<\/code><\/pre>\n<ul>\n<li>\u4ee5\u540e\u53f0\u8fdb\u7a0b\u542f\u52a8<\/li>\n<\/ul>\n<pre><code># .\/bin\/nexus start\n\u67e5\u770b\u8f93\u51fa\u7684\u65e5\u5fd7\uff1a\n# tail -f \/data\/www\/sonatype-work\/nexus3\/log\/nexus.log<\/code><\/pre>\n<ul>\n<li>\u505c\u6b62\u53ca\u91cd\u542f\u670d\u52a1<\/li>\n<\/ul>\n<pre><code># .\/bin\/nexus start\n# .\/bin\/nexus restart\n# .\/bin\/nexus stop\n# .\/bin\/nexus status<\/code><\/pre>\n<h2>Web\u63a7\u5236\u53f0<\/h2>\n<p>\u6253\u5f00Web\u63a7\u5236\u53f0\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/xxx.xxx.xxx.xxx:8081\/\">http:\/\/xxx.xxx.xxx.xxx:8081\/<\/a><\/p>\n<p>\u70b9\u51fb\u53f3\u4e0a\u89d2\u767b\u5f55\uff1a\u9ed8\u8ba4\u7528\u6237\u540d\u4e3aadmin\uff0c\u5bc6\u7801admin123<\/p>\n<h2>\u66f4\u65b0 Nexus\u7d22\u5f15<\/h2>\n<p>\u5728 <a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/repo.maven.apache.org\/maven2\/.index\/\">http:\/\/repo.maven.apache.org\/maven2\/.index\/<\/a> \u4e0b\u8f7d<code>nexus-maven-repository-index.gz<\/code>\u53ca<code>nexus-maven-repository-index.properties<\/code><\/p>\n<p>\u5728 <a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/central.maven.org\/maven2\/org\/apache\/maven\/indexer\/indexer-cli\/\">http:\/\/central.maven.org\/maven2\/org\/apache\/maven\/indexer\/indexer-cli\/<\/a> \u4e0b\u8f7d<code>indexer-cli-6.0.0.jar<\/code><\/p>\n<p>\u4e0a\u4f20\u521a\u624d\u4e0b\u8f7d\u7684\u4e09\u4e2a\u6587\u4ef6\u5230\u670d\u52a1\u5668\u7684\u540c\u4e00\u4e2a\u76ee\u5f55\u4e0b\uff08\u8fd9\u91cc\u4e3a<code>\/data\/www\/nexus<\/code>\uff09\uff0c\u7136\u540e\u6267\u884c<br \/>\n\u00a0\u00a0<\/p>\n<pre><code>java -jar indexer-cli-6.0.0.jar -u nexus-maven-repository-index.gz -d indexer<\/code><\/pre>\n<p>\u7b49\u5f85\u7a0b\u5e8f\u8fd0\u884c\u5b8c\u6210\u4e4b\u540e\u53ef\u4ee5\u53d1\u73b0<code>indexer<\/code>\u6587\u4ef6\u5939\u4e0b\u51fa\u73b0\u4e86\u5f88\u591a\u6587\u4ef6\uff0c\u5c06\u8fd9\u4e9b\u6587\u4ef6\u653e\u7f6e\u5230<code>{nexus-home}\/sonatype-work\/nexus3\/indexer\/central-ctx<\/code>\u76ee\u5f55\u4e0b<\/p>\n<h2>\u57df\u540d\u8bbf\u95ee<\/h2>\n<p>Nginx\u53cd\u5411\u4ee3\u7406\u914d\u7f6e\uff1a<\/p>\n<pre><code>server {\n    listen       80;\n    server_name  resp.yezhou.me;\n\n    location \/ {\n        proxy_pass  http:\/\/47.96.110.9;\n    }\n}<\/code><\/pre>\n<p>\u8bbf\u95ee\u5730\u5740\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/resp.yezhou.me:8081\/\">http:\/\/resp.yezhou.me:8081\/<\/a><\/p>\n<h2>\u4fee\u6539 Nexus \u8fd0\u884c\u914d\u7f6e<\/h2>\n<pre><code># vim etc\/nexus-default.properties<\/code><\/pre>\n<h2>\u8bbe\u7f6e Nexus \u5f00\u673a\u542f\u52a8<\/h2>\n<p>\u53c2\u8003\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/help.sonatype.com\/repomanager3\/system-requirements#SystemRequirements-Linux\">https:\/\/help.sonatype.com\/repomanager3\/system-requirements#SystemRequirements-Linux<\/a><\/p>\n<p>\uff081\uff09\u81ea\u542f\u52a8\u811a\u672c<\/p>\n<pre><code>vim \/usr\/lib\/systemd\/system\/nexus.service\n\n    [Unit]\n    Description = nexus service\n    After = network.target\n\n    [Service]\n    Type = forking\n    LimitNOFILE = 65536\n    ExecStart = \/www\/data\/nexus\/nexus-3.16.1-02\/bin\/nexus start\n    ExecReload= \/www\/data\/nexus\/nexus-3.16.1-02\/bin\/nexus restart\n    ExecStop =  \/www\/data\/nexus\/nexus-3.16.1-02\/bin\/nexus stop\n    Restart = on- abort\n\n    [Install]\n    WantedBy = multi-user.target<\/code><\/pre>\n<p>\uff082\uff09\u670d\u52a1\u52a0\u5165\u5f00\u673a\u542f\u52a8<br \/>\n\u00a0\u00a0<\/p>\n<pre><code>systemctl enable nexus.service<\/code><\/pre>\n<p>\uff083\uff09\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6<\/p>\n<pre><code>systemctl daemon-reload<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Nexus\u7b80\u4ecb Nexus\u4ed3\u5e93\u7ba1\u7406\u5668\uff0c\u5206\u4e3a\u4e24\u4e2a\u7248\u672c\uff0cNexus Repository Manager OSS  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[341],"tags":[],"class_list":["post-1375","post","type-post","status-publish","format-standard","hentry","category-nexus"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1375","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1375"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1375\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1375"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1375"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1375"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}