Last active
January 11, 2024 15:44
-
-
Save PlagueHO/0691483fa1be4b9e79cc7d078b3e1bb2 to your computer and use it in GitHub Desktop.
Create a Jenkins Master on a Windows Server 2012 R2 Core install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configure the settings to use to setup this Jenkins Executor | |
$Port = 80 | |
$IPAddress = '192.168.1.96' | |
$SubnetPrefixLength = 24 | |
$DNSServers = @('192.168.1.1') | |
$DefaultGateway = '192.168.1.1' | |
# Install .NET Framework 3.5 | |
Install-WindowsFeature -Name NET-Framework-Core | |
# Install Chocolatey | |
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) | |
# Install JDK 8 | |
choco install jdk8 -y | |
# Install Jenkins using Chocolatey | |
choco install Jenkins -y | |
# Set the port Jenkins uses | |
$Config = Get-Content ` | |
-Path "${ENV:ProgramFiles(x86)}\Jenkins\Jenkins.xml" | |
$NewConfig = $Config ` | |
-replace '--httpPort=[0-9]*\s',"--httpPort=$Port " | |
Set-Content ` | |
-Path "${ENV:ProgramFiles(x86)}\Jenkins\Jenkins.xml" ` | |
-Value $NewConfig ` | |
-Force | |
Restart-Service ` | |
-Name Jenkins | |
# Set a static IP Address - optional | |
New-NetIPAddress ` | |
-IPAddress $IPAddress ` | |
-InterfaceAlias Ethernet ` | |
-DefaultGateway $DefaultGateway ` | |
-AddressFamily IPv4 ` | |
-PrefixLength $SubnetPrefixLength | |
Set-DnsClientServerAddress ` | |
-InterfaceAlias Ethernet ` | |
-Addresses $DNSServers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment