Tuesday, March 27, 2018

Install TeamCity on Ubuntu with MySQL

Please find steps involved in installing TeamCity on Ubuntu server with MySQL:

Here below are the steps:

Java Installation
sudo apt-get update
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer -y

Teamcity Installation
First download the teamcity latest version.
sudo wget https://download.jetbrains.com/teamcity/TeamCity-2017.2.3.tar.gz
tar xfz TeamCity-2017.2.3.tar.gz
sudo mkdir /opt/jetbrains
sudo mv TeamCity/ /opt/jetbrains
sudo useradd teamcity

sudo vi /etc/init.d/teamcity
#!/bin/sh
# /etc/init.d/teamcity -  startup script for teamcity
export TEAMCITY_DATA_PATH="/opt/jetbrains/TeamCity/.BuildServer"
export TEAMCITY_SERVER_OPTS=-Djava.awt.headless=true # Configure TeamCity for use on a headless OS.

case $1 in
start)
 start-stop-daemon --start  -c teamcity --exec /opt/jetbrains/TeamCity/bin/runAll.sh start
;;

stop)
 start-stop-daemon --start -c teamcity  --exec  /opt/jetbrains/TeamCity/bin/runAll.sh stop
;;

esac

exit 0

sudo update-rc.d teamcity enable
sudo update-rc.d teamcity defaults
sudo chmod +x /etc/init.d/teamcity
sudo apt-get remove insserv -y
sudo apt install procps
sudo update-rc.d teamcity defaults
sudo chown -R ubuntu:ubuntu /opt/jetbrains/TeamCity
sudo service teamcity start
Open browser and access teamcity home page
http://server_ip:8111/

Click on Proceed
Now stop the Teamcity server
sudo service teamcity status
sudo service teamcity stop


MySQL Installation
TeamCity needs a database to run. You have options to choose Postgres, MySQL or any database.
Let us try with MySQL.

sudo apt-get install mysql-server -y
enter a password for default user root and repeat the password
sudo mysql -u root -p
Now execute all the commands:
create database teamcity character set UTF8 collate utf8_bin;
Use teamcity;
create user 'teamcityuser'@'localhost' identified by 'password';
grant all privileges on teamcity.* to 'teamcityuser'@'localhost';

type exit to come out

Download MySQL JDBC driver

sudo wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.31.tar.gz -O mysql-connector.tar.gz
sudo tar zxvf mysql-connector.tar.gz
cd mysql-connector-java-5.1.31/
sudo mv mysql-connector-java-5.1.31-bin.jar /opt/jetbrains/TeamCity/.BuildServer/lib/jdbc/

cd /opt/jetbrains/TeamCity/.BuildServer/lib/jdbc
mv ? mysql-connector-java-5.1.31-bin.jar
sudo chown -R teamcity:teamcity /opt/jetbrains/TeamCity
sudo chown teamcity:teamcity /opt/jetbrains/TeamCity/.BuildServer/lib/jdbc/mysql-connector-java-5.1.31-bin.jar
sudo service teamcity start
Open browser, type http://serverip:8111/
Click proceed and select MySQL as database type
Click on Proceed
enter database name as teamcity
user as teamcityuser
password as password
leave host as it is
Click on Proceed
Agree the License agreement

Monday, March 26, 2018

DevOps Training in Plano, Frisco and Dallas

DevOps Training in Plano, Frisco and Dallas 

Course duration is 5 to 7 weeks.

All batches are in-person and will be conducted exclusively by DevOps Coach:

Weekend batch Saturdays & Sundays - 09 AM  to 11 AM - location near Independence Pkwy and Eldorado Pkwy (SOLD OUT)- starting from March 31st

Week End batch Saturdays & Sundays - 11 AM  to 1 PM - location near Independence Pkwy and Eldorado Pkwy (Seats available) - starting from April 08th

Week Day batch  Mondays & Wednesdays - 6:30 pm to 8:30 pm - location near Independence Pkwy and Eldorado Pkwy (seats available)  - starting from April 02nd

Saturday, March 24, 2018

DevOps Interview Questions - Part I - Basic DevOps Interview Questions

Please find DevOps Interview questions asked during the interview:

They are simple but we should be able to answer them convincingly.
  1. Tell us about yourself..
  2. Tell us about your Devops role in your existing project.
  3. What is Devops about your perspective ?
  4. What are the challenges you faced from DevOps perspective?
  5. What is the team size?
  6. What are your day to day activities?
  7. How do you troubleshoot in case of any errors?
  8. Tell me about your Devops tools experience or what are the Devops tools you worked on?
  9. Walk us through stages of pipeline you created in Jenkins.
  10. What was the difficult challenge you faced and how did you overcome?
  11. What is the difference between Git and any other version control systems?
  12. What is the difference between Continuous Delivery and Continuous Deployment?

Monday, March 12, 2018

How to set up TeamCity on Ubuntu 16.0.4? Install Teamcity on Ubuntu 16.0.4

Please find below steps for installing TeamCity on Ubuntu:

Pre-requistes:
Make sure instance has at least 2 GB RAM memory(for EC2 at least small instance)
Open port 8111 in security firewall.

We need to set up some database for storing all the build information. For this exercise, lets us use Postgres:

Postgres Installation
sudo apt-get update
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
sudo wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
sudo apt-get -y install postgresql postgresql-contrib

sudo systemctl enable postgresql
sudo systemctl start postgresql

Change the password for postgres user by entering below command
sudo passwd postgres
Enter any password but do remember the password and confirm the same password
su - postgres
createuser teamcity

Switch to sql shell by entering
psql
ALTER USER teamcity WITH ENCRYPTED password 'password';
CREATE DATABASE teamcity OWNER teamcity;
\q

type exit to come out of postgres user.

TeamCity Installation

sudo apt-get update
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer -y
Say OK
Say Yes by pressing <— button and enter
wget https://download.jetbrains.com/teamcity/TeamCity-2017.1.2.tar.gz
tar -xvf TeamCity-2017.1.2.tar.gz
sudo mkdir /opt/JetBrains
sudo mv TeamCity /opt/JetBrains/TeamCity
cd /opt/JetBrains/TeamCity
sudo nano /etc/init.d/teamcity
(copy the whole text colored in green)
#!/bin/sh
### BEGIN INIT INFO
# Provides:          TeamCity autostart
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start teamcity daemon at boot time
# Description:       Enable service provided by daemon.
# /etc/init.d/teamcity -  startup script for teamcity
### END INIT INFO

#  Ensure you enter the  right  user name that  TeamCity will run  under
USER="ubuntu"

export TEAMCITY_DATA_PATH="/opt/JetBrains/TeamCity/.BuildServer"

case $1 in

start)
  start-stop-daemon --start  -c $USER --exec /opt/JetBrains/TeamCity/bin/runAll.sh start
 ;;
stop)
  start-stop-daemon --start -c $USER  --exec  /opt/JetBrains/TeamCity/bin/runAll.sh stop
 ;;
 esac

exit 0

Ctrl + O enter
Ctrl + X enter
sudo chmod +x /etc/init.d/teamcity
sudo update-rc.d teamcity defaults
sudo /etc/init.d/teamcity start

cat /opt/JetBrains/TeamCity/buildAgent/logs/teamcity-agent.log

Open browser and access team city url in the browser
http://public_dns_name:8111

Click on Proceed.
Select database type as jdbc driver as Postgres SQL, now you need to download the jdbc driver at below location.
cd /opt/JetBrains/TeamCity/.BuildServer/lib/jdbc
sudo wget https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar

Select database type PostgreSQL in the browser.
Refresh JDBC driver
You should see like this —> Loaded PostgreSQL JDBC driver version: 9.4

Now provide the below info
Enter database Host - localhost
Enter database name - teamcity
User name - teamcity
Password - password
Click on Proceed

please wait and watch..As It may take a few mins…

Scroll down the page, Accept license agreement
Uncheck Send anonymous usage statistics
Continue button

Register as a user and create an account.

Install Nexus on Ubuntu - Install Nexus 3 on Ubuntu 16.0.4 - How to set up Nexus on Ubuntu server?

How to Install Nexus on Ubuntu:

SonaType Nexus3 is Java based application, it is used as binary repository manager. We need to install Java first.

Java

sudo apt-get update 
sudo apt-get install default-jdk -y


Execute the below commands -  navigate to /opt directory by changing directory:
cd /opt

Download Nexus

sudo wget https://sonatype-download.global.ssl.fastly.net/nexus/3/nexus-3.0.2-02-unix.tar.gz

Extract Nexus

sudo tar -xvf nexus-3.0.2-02-unix.tar.gz
sudo mv nexus-3.0.2-02 nexus

Create a user called Nexus
sudo adduser nexus
give some password may be ad nexus, but do remember.

sudo chown -R nexus:nexus /opt/nexus
sudo vi /opt/nexus/bin/nexus.rc
change run_as_user="nexus"
sudo vi /opt/nexus/bin/nexus.vmoptions
Add all the below changes the file with below yellow highlighted entry:



-Xms256M
-Xmx256M
-XX:+UnlockDiagnosticVMOptions
-XX:+UnsyncloadClass
-Djava.net.preferIPv4Stack=true
-Dkaraf.home=.
-Dkaraf.base=.
-Dkaraf.etc=etc
-Djava.util.logging.config.file=etc/java.util.logging.properties
-Dkaraf.data=/opt/nexus/nexus-data
-Djava.io.tmpdir=data/tmp
-Dkaraf.startLocalConsole=false

sudo ln -s /opt/nexus/bin/nexus /etc/init.d/nexus

sudo su - nexus
give password for nexus which was nexus per above
type 
cd /opt/nexus/bin
./nexus start

./nexus status

it should show nexus is running..



if it says stopped, review the steps above. also navigate to logs by

cat /opt/nexus/nexus-data/log/nexus.log

look for any error.

It should say Nexus is running..If you Nexus stopped, review the steps above.
Once Nexus is successfully installed, you can access it in the browser by 



with user name/password is admin/admin123
you should see the home page of Nexus

Install kubectl on Mac OS | How to install kubectl in MAC OS

Kubernetes uses a command line utility called  kubectl  for communicating with the cluster API server. It is  tool for controlling  Kubernet...