Today, I have installed Jenkins on Linux AWS can not start. Then start it, but an error as below.
[root@Jenkins_Server ~]# service jenkins restart
Shutting down Jenkins [FAILED]
Starting Jenkins Mar 13, 2020 11:22:44 AM Main verifyJavaVersion
SEVERE: Running with Java class version 51, which is older than the Minimum required version 52. See https://jenkins.io/redirect/java-support/
java.lang.UnsupportedClassVersionError: 51.0
at Main.verifyJavaVersion(Main.java:182)
at Main.main(Main.java:142)
Jenkins requires Java versions [8, 11] but you are running with Java 1.7 from /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.231.x86_64/jre
java.lang.UnsupportedClassVersionError: 51.0
at Main.verifyJavaVersion(Main.java:182)
at Main.main(Main.java:142)
I have installed java Version 1.8.x. Check Java version on Linux AWS the default version 1.7.x.
[root@Jenkins_Server ~]# java -version
java version "1.7.0_231"
OpenJDK Runtime Environment (amzn-2.6.19.1.80.amzn1-x86_64 u231-b01)
OpenJDK 64-Bit Server VM (build 24.231-b01, mixed mode)
[root@Jenkins_Server ~]# echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.50.amzn1.x86_64
Jenkins on Linux AWS can not start fixed
How to fix it. I use the command below to switch JDK to Java version “1.8.x”. You can refer to the link here
sudo alternatives --config java
Link youtube
Now, I have started Jenkins is OK. Thank you for reading DevOpsRoles.com page
In this tutorial, How to use Jenkins auto-build when git commit. You use a webhook to capture when a new git commit was made and Jenkins will start to build jobs.
Step-by-Step Guide to Jenkins Auto Build on Commit
Under ‘Manage Jenkins’ -> ‘Manage Plugins’, select and install both Github and Git plugins.
Restart to finish the installation.
Configure a Jenkins job to use your repository.
Create a Jenkins job ‘Freestyle project‘
First, You add a repository in the “Github project” text field under the general settings.
you’ll need to enable Git under ‘Source Code Management‘
Under ‘Build Triggers‘, tick ‘GitHub hook trigger for GITScm polling‘.
Add the hooks to Github.
Click “settings” for your repository. For Example, My repository https://github.com/huupv/jenkins/settings/hooks . Click ‘Add webhook‘ as the picture.
Setting webhooks for Jenkins.
Conclusion
When you commit changes to a repository on GitHub, Jenkins will automatically trigger a build job. Test it out and see how it works! I hope you find this information useful. Thank you for visiting the DevopsRoles website!
Now, We will access the tomcat application from the browser to port 8080
http://<Public_IP>:8080
But, the default tomcat and Jenkins runs on ports number 8080. Hence I will change the tomcat port number to 8090. Change port number in conf/server.xml file under tomcat home
[root@Tomcat_Server opt]# cd /opt/apache-tomcat-8.5.50/conf
# update port number in the "connecter port" field in server.xml
# restart tomcat after configuration update
[root@Tomcat_Server conf]# cat server.xml | grep '\<Connector port\=\"8090\"'
<Connector port="8090" protocol="HTTP/1.1"
[root@Tomcat_Server conf]# tomcatdown
[root@Tomcat_Server conf]# tomcatup
Access tomcat application from the browser on port 8090
http://<Public_IP>:8090
But the tomcat application doesn’t allow us to log in from the browser. changing a default parameter in context.xml
# comment (<!-- & -->) `Value ClassName` field on files which are under webapp directory.
[root@Tomcat_Server bin]# pwd
/opt/apache-tomcat-8.5.50/bin
[root@Tomcat_Server bin]# find /opt/apache-tomcat-8.5.50 -name context.xml
/opt/apache-tomcat-8.5.50/webapps/host-manager/META-INF/context.xml
/opt/apache-tomcat-8.5.50/webapps/manager/META-INF/context.xml
/opt/apache-tomcat-8.5.50/conf/context.xml
[root@Tomcat_Server bin]# vi /opt/apache-tomcat-8.5.50/webapps/manager/META-INF/context.xml
After that restart tomcat services to effect these changes.
tomcatdown
tomcatup
Update users information in the /opt/apache-tomcat-8.5.50/conf/tomcat-users.xml file
In this tutorial, How to create DevOps CI/CD pipelines using Git, Jenkins, Ansible, Docker, and Kubernetes on AWS. How to learn DevOps. Step-by-step Hand-on Lab DevOps CI/CD pipeline tutorial part 1.
It is a DevOps software development. It contains some combination of tools such as the Version Control System, Builds server, and testing automation tools.
What is Continuous Delivery (CD) & Continuous Deployment (CD)?
It is a practice that could be achieved. Combination of CI tool, configuration management tool, and orchestration tool.
How to Install Jenkins on AWS EC2
Jenkins is a self-contained Java-based program. Use Jenkins ci/cd pipeline for any project.
You need to confirm Java Version and set the java home in Linux.
# find java version on Linux
[root@Jenkins_Server ~]# find /usr/lib/jvm/java-1.8* | head -n 3
# To set JAVA_HOME it permanently update your .bash_profile
[root@Jenkins_Server ~]# vi ~/.bash_profile
[root@Jenkins_Server ~]# java -version
# Result, The output should be something like this
[root@Jenkins_Server ~]# find /usr/lib/jvm/java-1.8* | head -n 3
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/jre
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/jre/bin
[root@Jenkins_Server ~]# cat ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64
PATH=$PATH:$HOME/bin:$JAVA_HOME
export PATH
[root@Jenkins_Server ~]# java -version
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)
[root@~]# echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64
Install Jenkins on Amazon EC2
Get the latest version of Jenkins from here. You can install Jenkins using the rpm or by setting up the repo.
Vagrant up command the response in error “No usable default provider could be found for your system”. Vagrant issues solved.
My environment
OS: Windows 10
Vagrant is version 2.2.6
Virtualbox is version 6.1
I installed the latest Vagrant and VirtualBox versions. I got the following error.
$ vagrant.exe up
No usable default provider could be found for your system.
Vagrant relies on interactions with 3rd party systems, known as
"providers", to provide Vagrant with resources to run development
environments. Examples are VirtualBox, VMware, Hyper-V.
The easiest solution to this message is to install VirtualBox, which
is available for free on all major platforms.
If you believe you already have a provider available, make sure it
is properly installed and configured. You can see more details about
why a particular provider isn't working by forcing usage with
vagrant up --provider=PROVIDER, which should give you a more specific
error message for that particular provider.
Vagrant issues solved the problem
You need to downgrade Virtualbox to version 5.2. Vagrant support PROVIDER here.
The VirtualBox provider is compatible with VirtualBox versions 4.0.x, 4.1.x, 4.2.x, 4.3.x, 5.0.x, 5.1.x, 5.2.x, and 6.0.x.
I decided to downgrade from Virtualbox 6.1 to Virtualbox 5.2
In this tutorial, Oracle notes for beginners. How to query commands useful in Oracle database. Diving into the world of Oracle databases can be both exciting and overwhelming for beginners. With its robust features and capabilities, Oracle is a powerful tool for managing data effectively.
Oracle notes for beginners
Oracle Database commands
Changing passwords in Oracle
ALTER USER user_name IDENTIFIED BY new_password;
Create a table
CREATE TABLE my_table (
what VARCHAR2(10),
who VARCHAR2(10),
mark VARCHAR2(10)
);
Insert values as the same with 3 commands below
INSERT INTO my_table (
what,
who,
mark
) VALUES (
'Devops',
'Roles',
'.com'
);
INSERT INTO my_table VALUES (
'huu',
'phan',
'.com'
);
INSERT INTO my_table ( what ) VALUES ( 'Yeah!' );
Get the list of all tables in Oracle
SELECT
owner,
table_name
FROM
all_tables
Query your permission in Oracle
select * from USER_ROLE_PRIVS where USERNAME= USER;
select * from USER_TAB_PRIVS where Grantee = USER;
select * from USER_SYS_PRIVS where USERNAME = USER;
Oracle check version
SELECT
*
FROM
v$version
Find Users logged into Oracle / PLSQL
SELECT
username,
program,
machine,
status,
TO_CHAR(
logon_time,
'HH:MM:SS'
)
FROM
v$session
WHERE
username = 'huupv' -- Username
The query for active users SQL Executed
SELECT
a.sid,
a.serial#,
b.sql_text
FROM
v$session a,
v$sqlarea b
WHERE
a.sql_address = b.address
AND
a.username = 'huupv';
Kill session in Oracle
Step 1: Identify the Session to be killed
SELECT
s.inst_id,
s.sid,
s.serial#,
--s.sql_id,
p.spid,
s.username,
s.program
FROM
gv$session s
JOIN gv$process p ON
p.addr = s.paddr
AND
p.inst_id = s.inst_id
WHERE
s.type != 'BACKGROUND' and s.username ='huupv';
Note: The SID and SERIAL# values the relevant session.
Step 2: Kill Session
SQL> ALTER SYSTEM DISCONNECT SESSION 'sid,serial#' POST_TRANSACTION; -- The POST_TRANSACTION clause waits for ongoing transactions to complete before disconnecting the session
SQL> ALTER SYSTEM DISCONNECT SESSION 'sid,serial#' IMMEDIATE; -- ALTER SYSTEM DISCONNECT SESSION
Conclusion
Embarking on your journey with Oracle databases doesn’t have to be daunting. By understanding the basics and following the tips provided in this guide, you will gain the confidence and knowledge needed to effectively manage and manipulate data using Oracle.
Remember, practice and continuous learning are key to becoming proficient in any technology. Keep exploring, experimenting, and expanding your skills to unlock the full potential of Oracle in your projects. I will be updated later! Have a nice day! Oracle notes for beginners. Thank you for reading DevOpsRoles.com page
In this tutorial, How to install Terraform on Centos and Ubuntu. Terraform an Open Source tool. It is safely and predictably create, improve and change Infrastructure.
[vagrant@DevopsRoles terraform]$ terraform plan
Refreshing Terraform state in-memory prior to plan…
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
create
Terraform will perform the following actions:
# aws_instance.testEC2 will be created
resource "aws_instance" "testEC2" {
ami = "ami-0c64dd618a49aeee8"
arn = (known after apply)
associate_public_ip_address = true
availability_zone = (known after apply)
cpu_core_count = (known after apply)
cpu_threads_per_core = (known after apply)
get_password_data = false
host_id = (known after apply)
id = (known after apply)
instance_state = (known after apply)
instance_type = "t2.micro"
ipv6_address_count = (known after apply)
ipv6_addresses = (known after apply)
key_name = (known after apply)
network_interface_id = (known after apply)
password_data = (known after apply)
placement_group = (known after apply)
primary_network_interface_id = (known after apply)
private_dns = (known after apply)
private_ip = (known after apply)
public_dns = (known after apply)
public_ip = (known after apply)
security_groups = (known after apply)
source_dest_check = true
subnet_id = (known after apply)
tags = {
"Name" = "testEC2"
}
tenancy = (known after apply)
volume_tags = (known after apply)
vpc_security_group_ids = [
"sg-00c448cd3e48ba684",
]
ebs_block_device {
delete_on_termination = true
device_name = "/dev/sdf"
encrypted = (known after apply)
iops = (known after apply)
kms_key_id = (known after apply)
snapshot_id = (known after apply)
volume_id = (known after apply)
volume_size = 10
volume_type = "gp2"
}
ephemeral_block_device {
device_name = (known after apply)
no_device = (known after apply)
virtual_name = (known after apply)
}
network_interface {
delete_on_termination = (known after apply)
device_index = (known after apply)
network_interface_id = (known after apply)
}
root_block_device {
delete_on_termination = true
encrypted = (known after apply)
iops = (known after apply)
kms_key_id = (known after apply)
volume_id = (known after apply)
volume_size = 20
volume_type = "gp2"
}
}
Plan: 1 to add, 0 to change, 0 to destroy.
Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.
[vagrant@DevopsRoles terraform]$ terraform apply
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
create
Terraform will perform the following actions:
# aws_instance.testEC2 will be created
resource "aws_instance" "testEC2" {
ami = "ami-0c64dd618a49aeee8"
arn = (known after apply)
associate_public_ip_address = true
availability_zone = (known after apply)
cpu_core_count = (known after apply)
cpu_threads_per_core = (known after apply)
get_password_data = false
host_id = (known after apply)
id = (known after apply)
instance_state = (known after apply)
instance_type = "t2.micro"
ipv6_address_count = (known after apply)
ipv6_addresses = (known after apply)
key_name = (known after apply)
network_interface_id = (known after apply)
password_data = (known after apply)
placement_group = (known after apply)
primary_network_interface_id = (known after apply)
private_dns = (known after apply)
private_ip = (known after apply)
public_dns = (known after apply)
public_ip = (known after apply)
security_groups = (known after apply)
source_dest_check = true
subnet_id = (known after apply)
tags = {
"Name" = "testEC2"
}
tenancy = (known after apply)
volume_tags = (known after apply)
vpc_security_group_ids = [
"sg-00c448cd3e48ba684",
]
ebs_block_device {
delete_on_termination = true
device_name = "/dev/sdf"
encrypted = (known after apply)
iops = (known after apply)
kms_key_id = (known after apply)
snapshot_id = (known after apply)
volume_id = (known after apply)
volume_size = 10
volume_type = "gp2"
}
ephemeral_block_device {
device_name = (known after apply)
no_device = (known after apply)
virtual_name = (known after apply)
}
network_interface {
delete_on_termination = (known after apply)
device_index = (known after apply)
network_interface_id = (known after apply)
}
root_block_device {
delete_on_termination = true
encrypted = (known after apply)
iops = (known after apply)
kms_key_id = (known after apply)
volume_id = (known after apply)
volume_size = 20
volume_type = "gp2"
}
}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
aws_instance.testEC2: Creating…
aws_instance.testEC2: Still creating… [10s elapsed]
aws_instance.testEC2: Still creating… [20s elapsed]
aws_instance.testEC2: Still creating… [30s elapsed]
aws_instance.testEC2: Creation complete after 36s [id=i-0501a62ccf6380761]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
Outputs:
public_ip_of_testEC2 = 18.191.123.168
Check on the AWS console!
Have a good nice! Thank you for reading the DevopsRoles page!