{"id":587,"date":"2013-03-15T19:33:44","date_gmt":"2013-03-15T18:33:44","guid":{"rendered":"http:\/\/blog.rabahi.net\/?page_id=587"},"modified":"2014-08-04T17:35:28","modified_gmt":"2014-08-04T15:35:28","slug":"nexus","status":"publish","type":"page","link":"https:\/\/blog.rabahi.net\/?page_id=587","title":{"rendered":"Nexus"},"content":{"rendered":"<h1>Prerequiste<\/h1>\n<p>I assume that you have a Centos installation.<\/p>\n<h1>Installation<\/h1>\n<p>You can copy\/paste this script and use it to configure automatically your server.<\/p>\n<pre class=\"bash\" style=\"font-family:monospace;\"><ol><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #666666; font-style: italic;\">#!\/bin\/bash<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;create nexus auto-update script&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">mkdir<\/span> <span style=\"color: #660033;\">-p<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<span style=\"color: #000000; font-weight: bold;\">\/<\/span>bundle<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">mkdir<\/span> <span style=\"color: #660033;\">-p<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<span style=\"color: #000000; font-weight: bold;\">\/<\/span>scripts<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;create user nexus&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">useradd nexus<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #666666; font-style: italic;\">#remove nexus as a service if exists<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">systemctl stop nexus.service<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">systemctl disable nexus.service<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #666666; font-style: italic;\"># download latest bundle<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">rm<\/span> <span style=\"color: #660033;\">-fr<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<span style=\"color: #000000; font-weight: bold;\">\/<\/span>bundle<span style=\"color: #000000; font-weight: bold;\">\/*<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">mkdir<\/span> <span style=\"color: #660033;\">-p<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<span style=\"color: #000000; font-weight: bold;\">\/<\/span>download<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">wget<\/span> <span style=\"color: #660033;\">-O<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<span style=\"color: #000000; font-weight: bold;\">\/<\/span>download<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus-latest-bundle.tar.gz http:<span style=\"color: #000000; font-weight: bold;\">\/\/<\/span>download.sonatype.com<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<span style=\"color: #000000; font-weight: bold;\">\/<\/span><span style=\"color: #000000;\">3<\/span><span style=\"color: #000000; font-weight: bold;\">\/<\/span>latest-unix.tar.gz<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">tar<\/span> xvfz <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<span style=\"color: #000000; font-weight: bold;\">\/<\/span>download<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus-latest-bundle.tar.gz <span style=\"color: #660033;\">-C<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<span style=\"color: #000000; font-weight: bold;\">\/<\/span>bundle<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">chown<\/span> nexus:nexus <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<span style=\"color: #000000; font-weight: bold;\">\/<\/span>bundle <span style=\"color: #660033;\">-R<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #666666; font-style: italic;\">#set nexus as a service<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #007800;\">nexusDirectory<\/span>=<span style=\"color: #000000; font-weight: bold;\">`<\/span><span style=\"color: #c20cb9; font-weight: bold;\">ls<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<span style=\"color: #000000; font-weight: bold;\">\/<\/span>bundle<span style=\"color: #000000; font-weight: bold;\">\/<\/span> <span style=\"color: #000000; font-weight: bold;\">|<\/span> <span style=\"color: #c20cb9; font-weight: bold;\">grep<\/span> nexus<span style=\"color: #000000; font-weight: bold;\">`<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">sed<\/span> <span style=\"color: #660033;\">-i<\/span> <span style=\"color: #ff0000;\">&quot;s\/^#\\(run_as_user=\\s*\\).*\/\\1<span style=\"color: #000099; font-weight: bold;\">\\&quot;<\/span>nexus<span style=\"color: #000099; font-weight: bold;\">\\&quot;<\/span>\/&quot;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<span style=\"color: #000000; font-weight: bold;\">\/<\/span>bundle<span style=\"color: #000000; font-weight: bold;\">\/<\/span><span style=\"color: #007800;\">$nexusDirectory<\/span><span style=\"color: #000000; font-weight: bold;\">\/<\/span>bin<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus.rc<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">sed<\/span> <span style=\"color: #660033;\">-i<\/span> <span style=\"color: #ff0000;\">&quot;s\/^\\(nexus-context-path=\\s*\\).*\/\\1\\\/nexus\/&quot;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<span style=\"color: #000000; font-weight: bold;\">\/<\/span>bundle<span style=\"color: #000000; font-weight: bold;\">\/<\/span><span style=\"color: #007800;\">$nexusDirectory<\/span><span style=\"color: #000000; font-weight: bold;\">\/<\/span>etc<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus-default.properties<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">cat<\/span> <span style=\"color: #000000; font-weight: bold;\">&gt;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>etc<span style=\"color: #000000; font-weight: bold;\">\/<\/span>systemd<span style=\"color: #000000; font-weight: bold;\">\/<\/span>system<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus.service <span style=\"color: #cc0000; font-style: italic;\">&lt;&lt; EOF<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #cc0000; font-style: italic;\">[Unit]<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #cc0000; font-style: italic;\">Description=nexus service<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #cc0000; font-style: italic;\">After=network.target<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #cc0000; font-style: italic;\">[Service]<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #cc0000; font-style: italic;\">Type=forking<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #cc0000; font-style: italic;\">ExecStart=\/opt\/nexus\/bundle\/$nexusDirectory\/bin\/nexus start<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #cc0000; font-style: italic;\">ExecStop=\/opt\/nexus\/bundle\/$nexusDirectory\/bin\/nexus stop<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #cc0000; font-style: italic;\">User=nexus<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #cc0000; font-style: italic;\">Restart=on-abort<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #cc0000; font-style: italic;\">[Install]<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #cc0000; font-style: italic;\">WantedBy=multi-user.target<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #cc0000; font-style: italic;\">EOF<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">systemctl daemon-reload<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">systemctl <span style=\"color: #7a0874; font-weight: bold;\">enable<\/span> nexus.service<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">systemctl start nexus.service<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">rm<\/span> <span style=\"color: #660033;\">-fr<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<span style=\"color: #000000; font-weight: bold;\">\/<\/span>bundle<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonatype-work<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">ln<\/span> <span style=\"color: #660033;\">-s<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonatype-work <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<span style=\"color: #000000; font-weight: bold;\">\/<\/span>bundle<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonatype-work<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">mkdir<\/span> <span style=\"color: #660033;\">-p<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonatype-work<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">chown<\/span> nexus:nexus <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<span style=\"color: #000000; font-weight: bold;\">\/<\/span>sonatype-work<span style=\"color: #000000; font-weight: bold;\">\/<\/span> <span style=\"color: #660033;\">-R<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">systemctl start nexus.service<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;configure httpd (create \/etc\/httpd\/conf.d\/nexus.conf)&quot;<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">cat<\/span> <span style=\"color: #000000; font-weight: bold;\">&gt;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>etc<span style=\"color: #000000; font-weight: bold;\">\/<\/span>httpd<span style=\"color: #000000; font-weight: bold;\">\/<\/span>conf.d<span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus.conf <span style=\"color: #000000; font-weight: bold;\">&lt;&lt;<\/span> <span style=\"color: #ff0000;\">&quot;EOF&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">ProxyPreserveHost On<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">Proxypass <span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus http:<span style=\"color: #000000; font-weight: bold;\">\/\/<\/span>localhost:<span style=\"color: #000000;\">8081<\/span><span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">Proxypassreverse <span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus http:<span style=\"color: #000000; font-weight: bold;\">\/\/<\/span>localhost:<span style=\"color: #000000;\">8081<\/span><span style=\"color: #000000; font-weight: bold;\">\/<\/span>nexus<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">ProxyRequests     Off<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">EOF<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">systemctl restart httpd.service<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #007800;\">myip<\/span>=<span style=\"color: #000000; font-weight: bold;\">`<\/span><span style=\"color: #c20cb9; font-weight: bold;\">hostname<\/span> -I<span style=\"color: #000000; font-weight: bold;\">`<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;Now meet you here: http:\/\/<span style=\"color: #007800;\">$myip<\/span>\/nexus&quot;<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><\/ol><\/pre>\n<p>That&#8217;s all \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prerequiste I assume that you have a Centos installation. Installation You can copy\/paste this script and use it to configure automatically your server. That&#8217;s all \ud83d\ude42<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":562,"menu_order":3,"comment_status":"closed","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-587","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/587","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=587"}],"version-history":[{"count":6,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/587\/revisions"}],"predecessor-version":[{"id":1021,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/587\/revisions\/1021"}],"up":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/562"}],"wp:attachment":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=587"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}