Installing and Managing Jenkins on Amazon Linux - amazon-ec2

I'm looking to move Jenkins to Amazon EC2 running Amazon Linux.
Currently we have Jenkins installed as a package (via yum). I'm considering running Jenkins as the contained jenkins.war on EC2 (for auto-upgrades and ease of deployment).
Unfortunately I've been unable to find much documentation regarding managing jenkins as the latter.
I'm trying to determine:
Which installation is preferred, and why?
If running as a contained jar:
How do I start/stop jenkins?
Should I create a jenkins user?

Installation Steps :
Please launch an Amazon Linux instance using Amazon Linux AMI.
Login to your Amazon Linux instance.
Become root using “sudo su -” command.
Update your repositories
yum update
Get Jenkins repository using below command
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
Get Jenkins repository key
rpm --import http://pkg.jenkins-ci.org/redhat-stable/jenkins-ci.org.key
Install jenkins package
yum install jenkins
Start jenkins and make sure it starts automatically at system startup
service jenkins start
chkconfig jenkins on
Open your browser and navigate to http://<Elastic-IP>:8080. You will see jenkins dashboard.
That’s it. You have your jenkins setup up and running. Now, you can create jobs to build the code.
Reference: http://sanketdangi.com/post/62715793234/install-configure-jenkins-on-amazon-linux

Jenkins Installation Ubuntu 14.04/16.01
Please follow the steps given below.
Switch to root user sudo su -
sudo apt-get update
sudo apt-get install default-jdk
sudo apt-get install default-jre
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list
sudo apt-get update
apt-get install jenkins
Get jenkins Password from:- vi /var/lib/jenkins/secrets/initialAdminPassword
Browse:- eg: 192.168.xx.xx:8080

Related

Linux Package installation in Kubernetes pods

I am running airflow pods and I am facing issue with installing package in pod
When I exec into a pod, I cannot run the following command
ps aux | grep airflow
Then
I used
apt-get update && apt-get install procps
but it is throwing this error
Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
Any ideas to resolve this?
Thanks
To use apt-get in linux, you need the root access, and almost all the airflow images create a new user to remove this access from the docker image in order to avoid the problems, so to solve this problem, you can create a custom image and install whatever you need.
Assume you are using the official docker image apache/airflow
FROM apache/airflow
USER root
RUN apt-get update && apt-get install procps
USER airflow
Then you need to build the image to use it directly if you are working in localhost, or to push it to a docker registry (docker hub for ex), then configure your server to use it.

Connect to CentOS desktop (GUI) installed on Google cloud

I've installed Centos7 on the Google Cloud Platform, as you know there is just ssh option to connect to the machine.
Now I need to have access to its desktop(GUI) from my laptop (it's win10).
it's appreciated if anyone can help me.
Thanks in advance
you need to ssh login into your CentOS machine either from ssh button in Gcloud, or using the cloud shell:
gcloud compute ssh test-vws
then setup a password for your account:
sudo passwd `whoami`
After that, you will need to install a client that will allow you to navigate the GUI for your server.
again, on your server command line execute:
sudo yum -y update
sudo yum -y groupinstall 'Server with GUI'
once finished, follow this guige to install and setup Teradici Cloud Access Software (Remote Desktop Agent for CentOS).
Installing Teradici Cloud Access Software
On your virtual workstation, install the Teradici repositories:
sudo yum -y install https://downloads.teradici.com/rhel/teradici-repo-latest.noarch.rpm
Install Teradici Standard Agent for Linux:
sudo yum -y update
sudo yum -y install pcoip-agent-standard
Then you will have to register the Agent and create a firewall rule to allow the connection, just follow the guide, and your desktop connection will look like this:

apt-get command not found in coreOS (cos)

I would like to install tools in my cluster VM to debug, like dnsutils or mysql to test connections.
My cluster VM use container optimized OS (cos).
Whenever I try
apt-get update
I got an error
-bash: apt-get: command not found
How could I achieve this ?
As explained here, execute
/usr/bin/toolbox
It will download docker images and login inside once completed, as root user.
You will be able to execute commands like apt-get update / install and debug

How to fix docker vulnerabilities (USN-4048-1) in ubuntu 18.08 LTS

I have AWS EC2 ubuntu 18.04 LTS machine. I want to fix the docker vulnerabilities (USN-4048-1).
Installed package : docker.io_17.03.2-0ubuntu7~ppa1
Fixed package : docker.io_18.09.7-0ubuntu1~18.04.3
How can i do that ? What's the steps to fix it ?
The simple way is to follow below step:
If the update-notifier-common package is installed, Ubuntu will alert you about pending updates via the message of the day (motd) upon console or remote login.
After logging in, you can check for and apply new updates with:
When performing an update, first review what apt is going to do, then confirm that you want to apply the updates (this is particularly true when running the development release).
If you would prefer to have updates applied automatically, make sure the unattended-upgrades package is installed, then run 'sudo dpkg-reconfigure unattended-upgrades'. Please note that updates may restart services on your server, so this may not be appropriate for all environments.
$ sudo apt-get update
$ sudo apt-get dist-upgrade
source : https://wiki.ubuntu.com/Security/Upgrades?_ga=2.36307296.1783287754.1567592268-1506938917.1567592268

Clamav installation steps for linux centos

I have tried to install clamav in linux centos, but not able to succeed, so anybody provide me the procedure to install clamav antivirus and test the same.
Thanks in advance
First thing to do is install the program sudo apt-get install clamav
It´s necessary install the deamon program as well sudo apt-get install clamav-daemon
Once that we have the program properly installed, will be necessary configure to make it works with our app. /etc/clamav/clamd.conf
TCPAddr 127.0.0.1
TCPSocket 3310
To configure by console the antivirus just type sudo dpkg-reconfigure clamav-freshclam
Restart the service sudo /etc/init.d/clamv-* restart
For CentOS 6
Install ClamAV via yum epel repo:
yum install clamd
Edit config file:
vim /etc/clamd.conf
ExtendedDetectionInfo yes
ExcludePath /usr/local/maldetect/
DetectPUA yes
Set to start on boot:
chkconfig clamd on
Update ClamAV prior to a scan:
freshclam
Start ClamAV:
service clamd start
Add the cron for daily automatic scans:
vim /etc/cron.daily/daily-clamscan
#!/bin/bash
SCAN_DIR="/"
LOG_FILE="/var/log/clamav/daily-clamscan.log"
/usr/bin/clamscan -i -r $SCAN_DIR >> $LOG_FILE
Set proper cron permissions:
sudo chmod +x /etc/cron.daily/daily-clamscan
Update the logrotate file to look for all logs via wildcard
vim /etc/logrotate.d/daily-clamscan
/var/log/clamav/daily-clamscan.log {
missingok
notifempty
create 644 clam clam
}
Thats how I installed it on my machine. Here are a few good quick commands or you can use the cron to manually run it. I also installed Linux Malware Detect (LMD) with it so I can do more for my scans.
Full System Scan that only displays infected files and runs in the background with bell
Use jobs command to view status
clamscan -r --bell -i / &

Resources