|
1 |
| ---- |
2 |
| -title: Create a Jenkins server on Azure |
3 |
| -description: Install Jenkins on an Azure Linux virtual machine from the Jenkins solution template and build a sample Java application. |
4 |
| -keywords: jenkins, azure, devops, portal, virtual machine, solution template |
5 |
| -ms.topic: quickstart |
6 |
| -ms.date: 6/7/2017 |
7 |
| ---- |
8 |
| - |
9 |
| -# Create a Jenkins server on an Azure Linux VM from the Azure portal |
10 |
| - |
11 |
| -This quickstart shows how to install [Jenkins](https://jenkins.io) on an Ubuntu Linux VM with the tools and plug-ins configured to work with Azure. When you're finished, you have a Jenkins server running in Azure building a sample Java app from [GitHub](https://github.com). |
12 |
| - |
13 |
| -## Prerequisites |
14 |
| - |
15 |
| -* An Azure subscription |
16 |
| -* Access to SSH on your computer's command line (such as the Bash shell or [PuTTY](https://www.putty.org/)) |
17 |
| - |
18 |
| -[!INCLUDE [quickstarts-free-trial-note](../../includes/quickstarts-free-trial-note.md)] |
19 |
| - |
20 |
| -## Create the Jenkins VM from the solution template |
21 |
| -Jenkins supports a model where the Jenkins server delegates work to one or more agents to allow a single Jenkins installation to host a large number of projects or to provide different environments needed for builds or tests. The steps in this section guide you through installing and configuring a Jenkins server on Azure. |
22 |
| - |
23 |
| -[!INCLUDE [jenkins-install-from-azure-marketplace-image](../../includes/jenkins-install-from-azure-marketplace-image.md)] |
24 |
| - |
25 |
| -## Connect to Jenkins |
26 |
| - |
27 |
| -Navigate to your virtual machine (for example, `http://jenkins2517454.eastus.cloudapp.azure.com/`) in your web browser. The Jenkins console is inaccessible through unsecured HTTP so instructions are provided on the page to access the Jenkins console securely from your computer using an SSH tunnel. |
28 |
| - |
29 |
| - |
30 |
| - |
31 |
| -Set up the tunnel using the `ssh` command on the page from the command line, replacing `username` with the name of the virtual machine admin user chosen earlier when setting up the virtual machine from the solution template. |
32 |
| - |
33 |
| -```bash |
34 |
| -ssh -L 127.0.0.1:8080:localhost:8080 [email protected] |
35 |
| -``` |
36 |
| - |
37 |
| -After you have started the tunnel, navigate to `http://localhost:8080/` on your local machine. |
38 |
| - |
39 |
| -Get the initial password by running the following command in the command line while connected through SSH to the Jenkins VM. |
40 |
| - |
41 |
| -```bash |
42 |
| -sudo cat /var/lib/jenkins/secrets/initialAdminPassword |
43 |
| -``` |
44 |
| - |
45 |
| -Unlock the Jenkins dashboard for the first time using this initial password. |
46 |
| - |
47 |
| - |
48 |
| - |
49 |
| -Select **Install suggested plugins** on the next page and then create a Jenkins admin user used to access the Jenkins dashboard. |
50 |
| - |
51 |
| - |
52 |
| - |
53 |
| -The Jenkins server is now ready to build code. |
54 |
| - |
55 |
| -## Create your first job |
56 |
| - |
57 |
| -Select **Create new jobs** from the Jenkins console, then name it **mySampleApp** and select **Freestyle project**, then select **OK**. |
58 |
| - |
59 |
| - |
60 |
| - |
61 |
| -Select the **Source Code Management** tab, enable **Git**, and enter the following URL in **Repository URL** field: `https://github.com/spring-guides/gs-spring-boot.git` |
62 |
| - |
63 |
| - |
64 |
| - |
65 |
| -Select the **Build** tab, then select **Add build step**, **Invoke Gradle script**. Select **Use Gradle Wrapper**, then enter `complete` in **Wrapper location** and `build` for **Tasks**. |
66 |
| - |
67 |
| - |
68 |
| - |
69 |
| -Select **Advanced** and then enter `complete` in the **Root Build script** field. Select **Save**. |
70 |
| - |
71 |
| - |
72 |
| - |
73 |
| -## Build the code |
74 |
| - |
75 |
| -Select **Build Now** to compile the code and package the sample app. When your build completes, select the **Workspace** link for the project. |
76 |
| - |
77 |
| - |
78 |
| - |
79 |
| -Navigate to `complete/build/libs` and ensure the `gs-spring-boot-0.1.0.jar` is there to verify that your build was successful. Your Jenkins server is now ready to build your own projects in Azure. |
80 |
| - |
81 |
| -## Troubleshooting the Jenkins solution template |
82 |
| - |
83 |
| -If you encounter any bugs with the Jenkins solution template, file an issue in the [Jenkins GitHub repo](https://github.com/azure/jenkins/issues). |
84 |
| - |
85 |
| -## Next Steps |
86 |
| - |
87 |
| -> [!div class="nextstepaction"] |
88 |
| -> [Add Azure VMs as Jenkins agents](jenkins-azure-vm-agents.md) |
| 1 | +--- |
| 2 | +author: tomarcher |
| 3 | +ms.service: jenkins |
| 4 | +ms.topic: include |
| 5 | +ms.date: 03/03/2020 |
| 6 | +ms.author: tarcher |
| 7 | +--- |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +* An Azure subscription |
| 12 | +* Access to SSH on your computer's command line (such as the Bash shell or [PuTTY](https://www.putty.org/)) |
| 13 | + |
| 14 | +[!INCLUDE [quickstarts-free-trial-note](quickstarts-free-trial-note.md)] |
| 15 | + |
| 16 | +## Create the Jenkins VM from the solution template |
| 17 | +Jenkins supports a model where the Jenkins server delegates work to one or more agents to allow a single Jenkins installation to host a large number of projects or to provide different environments needed for builds or tests. The steps in this section guide you through installing and configuring a Jenkins server on Azure. |
| 18 | + |
| 19 | +[!INCLUDE [jenkins-install-from-azure-marketplace-image](jenkins-install-from-azure-marketplace-image.md)] |
| 20 | + |
| 21 | +## Connect to Jenkins |
| 22 | + |
| 23 | +Navigate to your virtual machine (for example, `http://jenkins2517454.eastus.cloudapp.azure.com/`) in your web browser. The Jenkins console is inaccessible through unsecured HTTP so instructions are provided on the page to access the Jenkins console securely from your computer using an SSH tunnel. |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +Set up the tunnel using the `ssh` command on the page from the command line, replacing `username` with the name of the virtual machine admin user chosen earlier when setting up the virtual machine from the solution template. |
| 28 | + |
| 29 | +```bash |
| 30 | +ssh -L 127.0.0.1:8080:localhost:8080 [email protected] |
| 31 | +``` |
| 32 | + |
| 33 | +After you have started the tunnel, navigate to `http://localhost:8080/` on your local machine. |
| 34 | + |
| 35 | +Get the initial password by running the following command in the command line while connected through SSH to the Jenkins VM. |
| 36 | + |
| 37 | +```bash |
| 38 | +sudo cat /var/lib/jenkins/secrets/initialAdminPassword |
| 39 | +``` |
| 40 | + |
| 41 | +Unlock the Jenkins dashboard for the first time using this initial password. |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | +Select **Install suggested plugins** on the next page and then create a Jenkins admin user used to access the Jenkins dashboard. |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +The Jenkins server is now ready to build code. |
| 50 | + |
| 51 | +## Create your first job |
| 52 | + |
| 53 | +Select **Create new jobs** from the Jenkins console, then name it **mySampleApp** and select **Freestyle project**, then select **OK**. |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | +Select the **Source Code Management** tab, enable **Git**, and enter the following URL in **Repository URL** field: `https://github.com/spring-guides/gs-spring-boot.git` |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +Select the **Build** tab, then select **Add build step**, **Invoke Gradle script**. Select **Use Gradle Wrapper**, then enter `complete` in **Wrapper location** and `build` for **Tasks**. |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | +Select **Advanced** and then enter `complete` in the **Root Build script** field. Select **Save**. |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | +## Build the code |
| 70 | + |
| 71 | +Select **Build Now** to compile the code and package the sample app. When your build completes, select the **Workspace** link for the project. |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | +Navigate to `complete/build/libs` and ensure the `gs-spring-boot-0.1.0.jar` is there to verify that your build was successful. Your Jenkins server is now ready to build your own projects in Azure. |
| 76 | + |
| 77 | +## Troubleshooting the Jenkins solution template |
| 78 | + |
| 79 | +If you encounter any bugs with the Jenkins solution template, file an issue in the [Jenkins GitHub repo](https://github.com/azure/jenkins/issues). |
| 80 | + |
| 81 | +## Next Steps |
| 82 | + |
| 83 | +> [!div class="nextstepaction"] |
| 84 | +> [Add Azure VMs as Jenkins agents](/azure/jenkins-azure-vm-agents) |
0 commit comments