Установка Java
1 |
# apt-get update && apt-get install default-jdk |
1 |
# update-alternatives --config java |
1 2 |
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java Nothing to configure. |
1 |
# nano /etc/environment |
1 |
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64" |
1 |
# source /etc/environment |
1 |
# echo $JAVA_HOME |
1 |
/usr/lib/jvm/java-8-openjdk-amd64 |
Установка Nexus
1 |
# wget http://download.sonatype.com/nexus/3/latest-unix.tar.gz |
1 |
# tar xvf latest-unix.tar.gz -C /opt/ |
1 |
# ln -s /opt/nexus-* /opt/nexus |
1 |
# useradd -m -r -s /bin/false nexus |
1 |
# chown -R nexus:nexus /opt/nexus-* /opt/sonatype-work /opt/nexus |
1 |
# nano /opt/nexus/bin/nexus.rc |
1 |
run_as_user="nexus" |
1 |
# nano /etc/systemd/system/nexus.service |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
[Unit] Description=nexus service After=network.target [Service] Type=forking ExecStart=/opt/nexus/bin/nexus start ExecStop=/opt/nexus/bin/nexus stop User=nexus Restart=on-abort [Install] WantedBy=multi-user.target |
1 |
# systemctl daemon-reload && systemctl enable nexus |
1 |
# systemctl start nexus && systemctl status nexus |
Логи смотрим в
1 |
# tail -f /opt/sonatype-work/nexus3/log/*.log |
Настройка ротации логов Nexus
1 |
# cat /etc/logrotate.d/nexus |
1 2 3 4 5 6 7 8 9 10 |
/opt/sonatype-work/nexus3/log/*.log { daily dateext copytruncate missingok rotate 3 compress delaycompress notifempty } |
Установка Nginx
1 |
# wget -q -O - https://nginx.org/keys/nginx_signing.key | apt-key add - |
1 |
# nano /etc/apt/sources.list.d/nginx.list |
1 2 |
deb http://nginx.org/packages/ubuntu/ xenial nginx deb-src http://nginx.org/packages/ubuntu/ xenial nginx |
1 |
# apt-get update && apt-get install nginx |
1 |
# systemctl enable nginx && systemctl start nginx |
Настройка проксирования Nginx на Nexus
1 |
# nano /etc/nginx/conf.d/nexus.mydomain.com.conf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
upstream nexus_server { server 127.0.0.1:8081 fail_timeout=0; } server { listen 80; server_name nexus.mydomain.com www.nexus.mydomain.com; error_log /var/log/nginx/nexus-error.log; access_log /var/log/nginx/nexus-access.log main; location / { proxy_redirect off; proxy_pass http://nexus_server; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 90; } } |
1 |
# nano /etc/nginx/ssl.conf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
ssl_session_cache shared:SSL:20m; ssl_session_timeout 1d; ssl_prefer_server_ciphers on; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; ssl_dhparam /etc/nginx/ssl/dhparam.pem; # ssl_ecdh_curve secp521r1; ## Improves TTFB by using a smaller SSL buffer than the nginx default ssl_buffer_size 8k; ## Enables OCSP stapling ssl_stapling on; resolver 8.8.8.8; ssl_stapling_verify on; ## Send header to tell the browser to prefer https to http #add_header Strict-Transport-Security max-age=31536000; |
1 |
# openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
1 |
# nginx -t && service nginx reload |
Перевод Nexus […]