Introduction
Here are the points in this article:
- Deploy
jenkins
onAWS EC2
withAmazon Linux 2 AMI (HVM)
- Deploy
jenkins
onAWS EC2
withAmazon Linux AMI 2018.03.0 (HVM)
- When specified branch on
GitHub
is updated, automatically implementgit pull
onAWS EC2
and synchronize with your project onGitHub
Launch EC2 instance
Connect toAWS EC2
with SSH
- Click
connect
, and follow the instruction
Amazon Linux 2 AMI (HVM)
Install
sudo yum install java-1.8.0 |
sudo yum update –y |
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key |
sudo yum install jenkins -y |
Config
sudo vim /etc/sysconfig/jenkins |
and revise setting as JENKINS_USER="root"
sudo service jenkins start |
sudo systemctl enable jenkins.service |
Config Jenkins on Browser
Open the following link on Browser
http://yourPublicDNS:8080
On server
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
copy the password and paste it in order to login
install suggested plugins
Sign up your account
Save and go ahead
Go to ‘Jenkins management’
Install GitHub integration plugin
Start a free style project
Go to configuration
Enter your project url
Check ‘git’, and enter your Git Repository url
check ‘GitHub hook trigger for GITScm polling’
Enter the shell script you like
If you installjenkins
on the machine where your project is installed:ssh -i /root/.ssh/yourKey.pem ec2-user@127.0.0.1 "cd /var/www/html/yourProjectName;git reset @^ --hard;git pull;/usr/local/bin/composer install;php artisan migrate --force;"
Config GitHub
- Go to GitHub->setting
- build the webhook as follows:
Amazon Linux AMI 2018.03.0 (HVM)
Install
sudo yum update –y |
sudo yum remove java-1.7.0-openjdk |
sudo yum install java-1.8.0 |
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat/jenkins.repo |
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key |
sudo yum install jenkins -y |
Config
sudo vim /etc/sysconfig/jenkins |
- Revise setting as
JENKINS_USER="root"
sudo service jenkins start |
- Set automatic startup when Server reboot
sudo chkconfig jenkins on
Config Jenkins on Browser
Open the following link on Browser
http://yourPublicDNS:8080
On server
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
copy the password and paste it in order to login
install suggested plugins
Sign up your account
Save and go ahead
Go to ‘Jenkins management’
Install GitHub integration plugin
Start a free style project
Go to configuration
Enter your project url
Check ‘git’, and enter your Git Repository url
check ‘GitHub hook trigger for GITScm polling’
Enter the shell script you like
If you installjenkins
on the machine where your project is installed:ssh -i /root/.ssh/yourKey.pem ec2-user@127.0.0.1 "cd /var/www/html/yourProjectName;git reset @^ --hard;git pull;/usr/local/bin/composer install;php artisan migrate --force;"
Config GitHub
- Go to GitHub->setting
- build the webhook as follows:
Comments