2

I am trying to install a completely working Jenkins on my old PC with Ubuntu Server 12.04. I think my installation of Ubuntu Server and Jenkins was succesfull. I can access the Jenkins page by internet from any computer. So now I want Jenkins to access my private gitrepo on BitBucket.com. I have found this tutorial: Configuring Jenkins Git Tutorial and I am stuck with step 3.5. With says do this:

cd /srv/jenkins/jobs/project/workspace
git config user.email "some@email.com"
git config user.name "jenkins"

But with the first command I get the error:

-su cd: /srv/jenkins/jobs/project/workspace: No such file or directory

Do I have to make this folder? But when I do:

mkdir /srv/jenkins/jobs/project/workspace
mkdir: cannot create directory '/srv/jenkins/jobs/project/workspace': No such file or directory

I don't know much about all these things, because I am fairly new to this. I have come this far just because of all the tutorial on the internet, but now I am stuck :(

Edit:
I have tried the commando:

mkdir -p /srv/jenkins/jobs/project/workspace
mkdir: cannot create directory: '/srv/jenkins': Permission denied

So I guess this is not the solution, because user jenkins doesn't have sudo rights. I hope some has another suggestion.

martijnn2008
  • 135
  • 1
  • 1
  • 9

3 Answers3

1

To create a whole path/set of directories, like you did with /srv/jenkins/jobs/project/workspace you need to pass the -p parameter to mkdir to create all of them at once.

mkdir -p /srv/jenkins/jobs/project/workspace
rfindeis
  • 269
  • 1
  • 3
  • Ok thanks, but do you know if that is the intention of the tutorial? I think I should already have that folder. I have tried your command, but It didn't work out see edit. – martijnn2008 May 05 '14 at 18:40
  • You need to have super user rights, either log in a s `root` or use `sudo`, otherwise you will not have write access to `/` to create `srv`. On Ubuntu one typically does not have the password for `root`, but at least the first user created at installation is set as sudoer, i.e. can elevate his rights to super user by prefixing a command with `sudo`. Just call `sudo mkdir -p /srv/jenkins/jobs/project/workspace`. Also see `man sudo` for more information on `sudo`. – rfindeis May 05 '14 at 18:45
  • The tutorial said do `sudo su - jenkins`, so that's why I find it strange to logout or use `sudo` rights. The `srv` folder already exists but the `jenkins` folder isn't. – martijnn2008 May 05 '14 at 18:48
  • As pointed out below by @ayr-ton, you need to create `jenkins` directory first and `chown` it to the `jenkins` user. The `sudo su - jenkins` from the tutorial makes you the `jenkins` user, so that all further operations are done using this user id. Do this first and then create the remaining directories `jobs/project/workspace` as needed to follow the tutorial. – rfindeis May 05 '14 at 19:04
0

With a user with sudo privileges, try:

sudo chown jenkins:jenkins /srv/jenkins
chmod 750 /srv/jenkins 

Please, check first it the directory /srv/jenkins exists.

And then, try the mkdir -p /srv/jenkins/jobs/project/workspace.

ayr-ton
  • 765
  • 5
  • 19
0

Ok I have it all working. The tutorial gave me a good start, but I never completed step 3.5. I did searching in all the options and there I was able to set all necessary options. And I went on with step 4 of the tutorial and filled all required fields.

martijnn2008
  • 135
  • 1
  • 1
  • 9