-->
  • Recent Articles

    How to Install Jenkins, NGINX on CentOS 7.3 & Configure jenkins through NGINX. in 10 Steps

    Install Jenkins, NGINX on CentOS 7.3 & Configure jenkins through NGINX.



    1. Install CentOS 7.2
    2. Update the OS.

    yum install epel-release
    yum list update
    yum check-update
    yum update
    reboot

    3. Disable selinux and Filewall service.
     sestatus
    systemctl stop firewalld.service
    systemctl disable firewalld.service
    systemctl -all | grep -i firew
    reboot

    4. Install Java
    yum install java-1.8.0-openjdk.x86_64
    java -version
    5.  set two environment variables: "JAVA_HOME" and "JRE_HOME".
      cp /etc/profile /etc/profile_backup
     echo 'export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk' | sudo tee -a /etc/profile
    echo 'export JRE_HOME=/usr/lib/jvm/jre' | sudo tee -a /etc/profile
    source /etc/profile
    echo $JAVA_HOME
    echo $JRE_HOME

    6. Install Jenkins

    yum install wget telnet
     wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
    rpm --import http://pkg.jenkins-ci.org/redhat-stable/jenkins-ci.org.key
    yum install jenkins

    7. Start the service and Enable Service.

     systemctl start jenkins.service
     systemctl enable jenkins.service

    8. Install Nginx
    yum install nginx
    vi /etc/nginx/nginx.conf

        server {
            listen       80 default_server;
            listen       [::]:80 default_server;
            server_name  _;
            root         /usr/share/nginx/html;

            # Load configuration files for the default server block.
            include /etc/nginx/default.d/*.conf;

            location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_redirect off;
        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;
            }

            error_page 404 /404.html;
                location = /40x.html {
            }

            error_page 500 502 503 504 /50x.html;
                location = /50x.html {
            }
        }

    9. Enable and start nginx Service
    systemctl start nginx.service
    systemctl enable nginx.service
    systemctl status nginx.service

    10. Now access your Jenkins.

    http://<Jenkins-server-IP>

    No comments