Jenkins Beginner Tutorial 3 - How to change Home Directory

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome to this session on Jenkins beginner tutorial this is the third session in this series and today we are going to learn how do we change the home directory of Jenkins so what is the home directory of Jenkins is whenever we are deployed Jenkins on any system there is a folder where which is created by default and most of the times the name of the folder is dot Jenkins and the default location will be the user profile of that system and this folder or this directory contains all the information about the logs configuration jobs everything about Jenkins ok so let's say in we have seen in our last session how do we install and you know get started with Jenkins so if I go to my user profile ok I can see there is a folder called dot Jenkins and if I go inside this folder I can see everything related to Jenkins all the logs jobs and then the plugins everything right so we have all the configuration plug-ins jobs and logs inside this home directory now the basic question why do we want to change this home directory this is working fine and you do not have any issues with this home directory then why should we even bother to change it so the one of the most common reasons why people want to change this home directly to some other location is mostly this is getting installed in the user profile and we want to move it to a place where we have enough disk space because there will be a lot of jobs being added to our Jenkins there will be a lot of plugins being added and other configurations and we want this home directory to be placed in such a location where we have sufficient space so we want to change it the other common reason is the requirement of the project ok so these are the two reasons why we change the directory okay so let's get started and let's see this process how what we have to do is step one is check your current home directory okay so how do you do that let us start our Jenkins and you have to go to your the location where you have downloaded and you have put your Jenkins folder so in my case it is desktop tools Jenkins so wherever your Jenkins dot war file is you have to go to that location whether you are on Windows or on a Mac and then you have to say Java space - jar Jenkins dot wash so this will start our Jenkins on the default port which is 8080 okay so let me go to my browser and let me go to localhost 8080 okay so now my Jenkins is up and running and what you have to do is you have to go to manage Jenkins and inside manage encase the very first option option you be are getting is configure system I am clicking here and you see the very first option it is showing me the home directory so you will see your current home directory here and now I want to change this okay so what we are going to do is the very first thing that we have to do is step two is create a new folder okay which will be new home directory okay so let's suppose I want I want to have my new directory inside my tools folder and inside my tools folder I have Jenkins folder so very I have my genkan stored water in the same location I want to have a new folder wage which will be my new parent home directory for Jenkins and I say this says Jenkins home ok so I have created this step 3 will be copy all data from old directory to new directory ok so my old directory was here dot Jenkins I will go inside this copy everything ok I will copy all this everything and now I will move to my new directory and I will paste everything here okay so this is get getting copied now after the after is copy is completed now you have to change environment variable and the environment variable Jenkins underscore home and set to new directory ok so in this case what you have to do is in case you are on Windows on Windows whatever you will do is you will go to your system variables and you can go through your control panel or you can go to your my computer right click go to properties and here go to advanced system settings and here you can see your the system properties window has come up and here their environment variables ok and here you will find Jenkins home in case you do not have it you can create it ok and if it is already there you can just go to edit and you have to give the variable name as Jenkins home and the value as the new directory wherever you have created it okay you can do it like this on Windows okay and here you have to change environment variable and if you are on a Mac okay so I am on a Mac so what I have to do is I have to go to my terminal okay and I will say export Jenkins underscore home equal to whatever value of my the path of my new folder so it is at desktop tools Jenkins and Jenkins home okay so this is the new location and just I will say enter okay now let me put it here this is what I have to do go to terminal and this is what I have to do on terminal right set the part export the path it will start from export let me just paste it here okay this is what you do for Mac right now we have to step five is we have to restart Jenkins okay so for restarting Jenkins one of the ways is on your command prompt or terminal wherever you had started your Jenkins you can say ctrl C okay and it will get closed and then you can again start Jenkins by Java - Joe Jenkins what what one of the other ways to start Jenkins says you can go to your browser where your Jenkins is running localhost 8080 and here you say G start it will ask you I show about restarting Jenkins yes and it will restart Junkins and you can see the logs will come up here okay it will close Jenkins and then it will start up again okay so now let me go and check if Jen consistory started actually it will come up by itself when Jenkins restarting is done so now Jenkins is fully up and running okay so now I have to check okay I go to manage Jenkins then I go to configure system and here see the home directory is still showing me the old folder this has not changed here in Windows most probably this will not happen because there you do not you have to change only the environment variables but if you are on a Mac there is another thing that you will have to do to change this here and that is you have to set the environment variables for a permanent session now what happened is we set it up here okay we had done export Jenkins home here but this is only for a temporary session to do it permanently what you will need to do is go to your finder okay and I am pressing command shift G and I am going to my users profile and you in your users profile you will find a file called dot bash profile which is a hidden file okay in case you are not seeing this file you can enable hidden files on Mac and in my last session I have shown exactly how to do that so you can look at their how to view the hidden files and even after enabling hidden files if you are not able to view this dot bash profile files you can actually create our dot Bash underscore profile file and open this and here I have to do the same thing the export that I did here I will just add this statement to my dot bash profile and I will save it and I will exit from terminal and even here I will exit okay and I will start I will start a new terminal session I will go to the location of my Jenkins dot war and now I will start the Jenkins toward war so now my Jenkins is getting started again and let me go to localhost 8080 just getting started yes now it is fully up and running and go I am going to manage Jenkins again and I am going to configure system and yes now you can see the home directory has changed successfully to the new directory okay now whatever jobs I add or plugins I add or whatever I do on Jenkins all the files logs folders everything will be stored in my new Jenkins directory okay this one more thing you can do is you can go to system info localhost 8080 system info and you can get all the system properties here and you can see the environment variables as well here okay now you can see my Jenkins dot home is set to my new directory okay and information about plugins and everything is here right so this is how you can change the home directory and if you face any issues or problems whether in Windows or Mac in setting this up you can send me a comment and I will help you out okay so this is how we can change the home directory for Jenkins hope you like it thank you
Info
Channel: Automation Step by Step
Views: 302,190
Rating: undefined out of 5
Keywords: jenkins how to, jenkins how to change home directory, jenkins configuration, jenkins how to configure, jenkins basics, learn jenkins, jenkins beginner tutorial, jenkins introduction, jenkins how to configure home directory, learning jenkins, jenkins step by step, jenkins sytem info, jenkins, jenkins step by step for beginners
Id: m47MWSXNslg
Channel Id: undefined
Length: 13min 16sec (796 seconds)
Published: Fri Sep 02 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.