Skip to content

Instantly share code, notes, and snippets.

Last active April 8, 2024 22:42
Show Gist options
  • Save jsuwo/9038610 to your computer and use it in GitHub Desktop.
Save jsuwo/9038610 to your computer and use it in GitHub Desktop.

Continuous Integration with Jenkins on Amazon EC2

Initial Setup

Fixing Locales in Ubuntu 13.04 on Amazon EC2

sudo apt-get install language-pack-en

Installing Jenkins

wget -q -O - | sudo apt-key add -
echo "deb binary/" | sudo tee -a /etc/apt/sources.list.d/jenkins.list
sudo apt-get update
sudo apt-get install jenkins

Installing and Configuring Apache

Installing Apache

sudo apt-get install apache2
sudo a2enmod proxy
sudo a2enmod proxy_http


<VirtualHost *:80>
	ServerName HOSTNAME
	ProxyRequests Off
	<Proxy *>
		Order deny,allow
		Allow from all
	ProxyPreserveHost on
	ProxyPass / http://localhost:8080/

Enabling jenkins.conf

sudo a2ensite jenkins
sudo service apache2 reload

Installing Java / Maven / Git

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer maven git-core
package ca.uwo.csd.cs2212.USERNAME;
public class BankAccount {
private double balance;
public BankAccount(double balance) {
this.balance = balance;
public double debit(double amount) {
if (balance < amount) {
amount = balance;
balance -= amount;
return amount;
package ca.uwo.csd.cs2212.USERNAME;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
public class TestBankAccount {
Copy link

SSH into your jenkins instance and check if jenkins is running perhaps it might be "Stopped"

Copy link

ghost commented Nov 8, 2017

Had the same problem. This is because the /etc/apache2/sites-available/jenkins.conf needs to be updated with the new hostname.

Copy link

victoremmanuel commented Mar 19, 2018

Starting LSB: Start Jenkins at boot time...
ERROR: No Java executable found in current PATH: /bin:/usr/bin:/sbin:/usr/sbin
If you actually have java installed on the system make sure the executable is in the aforementione...ble path
jenkins.service: Control process exited, code=exited status=1
Failed to start LSB: Start Jenkins at boot time.
jenkins.service: Unit entered failed state.
jenkins.service: Failed with result 'exit-code'.
Hint: Some lines were ellipsized, use -l to show in full.
dpkg: error processing package jenkins (--configure):
subprocess installed post-installation script returned error exit status 1
Processing triggers for systemd (229-4ubuntu21) ...
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:

Pls help do i have to install java again or i have to set the env var

Copy link

[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.096 s
[INFO] Finished at: 2018-03-20T08:59:53+00:00
[INFO] Final Memory: 9M/21M
[INFO] ------------------------------------------------------------------------
Finished: SUCCESS

but no test cases ran.... pls help

Copy link

I stopped the instance and restarted it again but when I enter ec2 instance public dns in url page I am unable to access the jenkins page. always showing "Apache2 Ubuntu Default Page" how to reslove this issue.

Copy link

tell me the GITHUB url where all the Maven java project code is stored ??

Copy link

when we try to enter systemctl reload apache2
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to reload 'apache2.service'.
Authenticating as: Ubuntu (ubuntu)
polkit-agent-helper-1: pam_authenticate failed: Authentication failure
because of this I am unable to access the jenkins with "aws ec2 instance name:8080" in my local browser.

can anyone please guide me to resolve this issue

Copy link

bhanuRanosys commented Dec 26, 2019

Err:1 binary/ jenkins ...                               
  Connection failed
E: Failed to fetch  Connection failed

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

If anyone facing the above error. Please use the following commands instead while installing Jenkins:

wget -q -O - | sudo apt-key add -

sudo rm  /etc/apt/sources.list.d/jenkins.list

echo "deb binary/" | sudo tee -a /etc/apt/sources.list.d/jenkins.list

sudo apt-get update

sudo apt-get install jenkins

If you still facing issues while installing Jenkins, you can directly download it from there website:


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment