How Do You Upgrade the Flavor of Your EC2 Instance with Only 15 Minutes of down Time?

Problem scenario
The needs for a server have changed.  You now want your AWS EC-2 virtual server to have more CPU and RAM, but you do not want to  migrate to a new instance.  You can only afford 15 minutes of down time.  What should you do to resize the server's capacity  to have more processors and greater memory?

Solution
These basic steps will work if you want to downgrade your server too (to save money).

1.  This is an optional step if the instance is running Linux (as a "sanity check").  From the instance, check the amount of RAM and number of processors with these commands:
free -mh
cat /proc/cpuinfo | grep processor | tail -n 1

2.  The following steps are performed from the AWS console (except the last step which is optional).  In the AWS console go to the EC2 instance screen.
3.  Check the radio button on the left column for the instance (the row that has information about the instance you want to modify).
4.  Go to Actions -> Instance State -> Stop.
5.  When it has stopped go to Actions -> Instance Settings -> Change Instance Type.
6.  In the pop-up choose the Instance Type you want (e.g.,  m4.xlarge).  Click "Apply."
7.  Go to Actions -> Instance State -> Start.
8.  To the next prompt, click "Yes, Start."
9.  You are done. This is an optional step if the instance is running Linux.  From the instance, check the amount of RAM and number of processors with these commands:
free -mh
cat /proc/cpuinfo | grep processor | tail -n 1

How Do You Install Jenkins 2.x on Debian Linux in Google Cloud Platform?

Problem scenarios
#1  You have a Debian server in GCP with roughly 0.592 GB of RAM.  You want to install Jenkins on it.  How do you do this?

OR

#2  You have a nano flavor of an EC2 instance running Ubuntu Linux (i.e., 0.5 GB of RAM).  You want to install Jenkins on it.  How do you install Jenkins 2.x on Ubuntu Linux in AWS?  (If you do not want to install a "apt-transport-https" package, but you can run "apt-get upgrade", then see this posting.)

Solution
(The directions were tested separately in both AWS and GCP.)

1.  Run these commands from the command line prompt of the Debian Linux server:

sudo apt-get -y update 
sudo apt-get -y install apt-transport-https
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 -y update
sudo apt-get -y install jenkins
sudo systemctl start jenkins
curl http://icanhazip.com
 # to find the external IP address of the server

2.  Go back to your workstation and open a web browser.  Go to this URL where x.x.x.x is the IP address obtained from the curl command above:  http://x.x.x.x:8080

Ensure (e.g., in the GCP console) that the relevant firewall rule allows for inbound connections over port 8080 (unless you configured a different port) from your workstation.  If you are not sure how, see this posting.  If you are running the server in AWS, ensure that the Security Group allows for connectivity.

3.  In the web browser, enter the initial password.  You may need to use sudo to access the file from the Linux back-end after you see the path to the file is shown in the web browser.  You will then click choose "Install Suggested Plugins."  Enter the fields as requested for the "First Admin User."  Click "Save and Finish."  You are done.

FYI
A server with 0.5 GB of RAM will be sufficient for Jenkins as a development test server.  If you will put a considerable load on Jenkins, you will need a server with more memory.  To resize a server in AWS, see this posting.  To resize a server in GCP, see this posting.

How Do You Get Jenkins 2.x Running on Linux to Do Code Deployments to Windows Servers?

Problem scenario
You are trying to set up a CI/CD pipeline in your heterogeneous enterprise server network.  You want to push down files (integrate code) from your Jenkins 2.x server running on Linux to your Windows 2016 Servers.  How do you get builds to be controlled by Jenkins on Linux to be deployed to other Windows servers?

Prerequisites
This solution assumes that Jenkins is running on Linux.  If you have Debian Linux, see this posting.  If you have Ubuntu Linux, see this posting.

Solution
1.  Install cygwin on the Windows server so it is ready for SSH.  If you do not know how to do this, see this posting.  Cygwin is covered under the GNU General Public License.   

2.  On the Linux server run this:  sudo su jenkins

3.  Set up SSH with the Windows server so that the Jenkins user can passwordlessly connect to the Windows server.  If you do not know how to configure passwordless SSH, see this posting and prepare the Windows server for SSH via its Cygwin command prompt application.

4.  On the Linux server run these commands:

cd /home
mkdir jenkins
sudo chown jenkins jenkins
sudo chgrp jenkins jenkins
cd jenkins
mkdir .ssh
chmod 700 .ssh

5.  Create an authorized_keys file in the .ssh directory.  The content should be that of an id_rsa.pub file.  This id_rsa.pub file should belong to a local user of the server you want to SSH into (e.g., a Windows server with Cygwin on it).  This content should become the basis of the authorized_keys file to reside in the .ssh directory from the above step.

6.  Run these commands from the .ssh directory in step #4:

sudo chmod 600 authorized_keys
sudo chown jenkins authorized_keys
sudo chgrp jenkins authorized_keys

7.  Go to the Jenkins web UI and log in.

8.  Go to "New Item" and enter a name.  Then click "Freestyle project."  Then click "Ok."

9.  Go to "Add build step" -> "Execute Shell". 

10.  Insert a command such as this (where jdoe is the user and x.x.x.x is the IP address of the Windows server):

scp /tmp/basic.txt jdoe@x.x.x.x:/home/jdoe/basic.txt

11.  Click "Save."

12.  Schedule the build or choose the option to "Build now."

How Do You SSH to a Windows Server or How Do You Install Cygwin on a Windows 2016 Server?

Problem scenario
You want to install Cygwin to allow for SSH connections (from Linux servers) to your Windows server.  How do you do this?

Solution
1.  If the server is new, skip step #1.

  a)  Log in and go to Control Panel -> System and Security -> System.  Click on "Advanced system settings" on the left.

  b)  Go to the Advanced tab and click on "Environment Variables..."

  c)  Under the "System variables", highlight the "Path" variable.  Click "Edit..."

  d)  Verify the "Variable value" does not have "OpenSSH\bin" nor "mksnt".  Normally they will not; so you would click "Cancel".  Delete them if they are present.

  e)  Go to services.  Verify the MKS Secure Shell service is not running.

2.  If the server is new (freshly installed with just the OS and a typical image), or if you have completed step #1, download the 64-bit version of Cygwin from www.cygwin.com from the server itself.  (Go to "Install Cygwin" in the upper lefthand corner.  If the download doesn't work, go to I.E.'s sprocket symbol, Security tab, click the Internet zone, go to "Custom level..." button and ensure that Downloads -> File download is set to "Enable" and "Font download" is set to "Prompt.")

3.  Click "Save" for the download to start.  

4.  Run the .exe file and click "Yes" to allow it to make changes to your system.  

5.  When you see the "Cygwin" set up window, choose "Next".

6.  Choose "Install from Internet" and click "Next".

7.  Install for "All Users" and click "Next."

8.  Make a note of the location of where it is being installed.  You will need this folder path.  Accept the default location of the "Local Package Directory" and click "Next".

9.  For "Select Your Internet Connection" use "Use System Proxy Settings" (which will certainly work if the Windows server is in GCP).

10.  Choose any available download site you want.

11.
  a)  Expand Net.  Make sure you install the openssl and openssl-devel.  There are two boxes.  The left box should be checked for both of these two (to signify binary).  

  b) Expand Archive.  Make sure you install the unzip and zip.  There are two boxes.  The left box should be checked for both of these two (to signify binary).  Click "Next."

12.  For the "Resolving Dependencies" option, ensure that "Select required packages" is checked.  Click "Next."

13.  Click "Finish."  

14.  Open the Cygwin.bat file (e.g., in C:\cygwin\ if you accepted the default location).  Make sure it has this sole stanza above the "bash --login -" stanza:

set CYGWIN=binmode ntsec

Here is an example of how the whole file may look when you are done (the emboldened text is just for clarity):

@echo off

C:
chdir C:\cygwin\bin
set CYGWIN=binmode ntsec
bash --login -i

15.  Open Cygwin as administrator.  (Right click it and go to "Run as Administrator".)

16.  Run this command in Cygwin:

ssh-host-config   # respond to the prompt with "yes" with no quotes

# To the question about StrictModes, respond to the prompt with "yes" with no quotes

# To the prompt about "new local account 'sshd', respond with "yes" with no quotes

# To the prompt about installing sshd as a service, respond with "yes" with no quotes

# To the prompt about "Enter the value of CYGWIN for the daemon, enter this with no leading spaces

before "binmode":  binmode ntsec

# To the prompt that says "Create new privileged user account", enter "yes" with no quotes

# Enter the password for this new local user.  Press enter.  Repeat the process for confirmation.

# To the prompt about "Do you want to proced anyway", enter "yes" with no quotes

17.  Go to Services. Start the Cygwin service (right click it, go to Start).

18.  Open Windows Firewall.  Either turn it off or configure it to allow inbound TCP connectivity over port 22. 
Optional details:  To turn it off, open the MMC, in the Overview section in the middle there is a hyperlink for "Windows Firewall Properties".  Click this link and go to the drop down menu for "Firewall state."  Choose off.

19.  Now you are ready to use SSH.  If you want details on how to use passwordless SSH authentication, see this posting.

How Do You Install Terraform on any Type of Linux?

Problem scenario
You want to quickly install Terraform on any type of Linux.  How do you write a single script that will work on Debian/Ubuntu, CentOS/RedHat/Fedora, or Linux SUSE?

Solution
1.  Create a file called terra.sh in /tmp/ with the content below.

#!/bin/bash
# Written by www.continualintegration.com
# Updated in January of 2022

tfv=0.15.5  # Change this version as necessary

distro=$(cat /etc/*-release | grep NAME)

debflag=$(echo $distro | grep -i "ubuntu")
if [ -z "$debflag" ]
then   # If it is not Ubuntu, test if it is Debian.
  debflag=$(echo $distro | grep -i "debian")
  echo "determining Linux distribution..."
else
   echo "You have Ubuntu Linux!"
fi

rhflag=$(echo $distro | grep -i "red*hat")
if [ -z "$rhflag" ]
then   #If it is not RedHat, see if it is CentOS or Fedora.
  rhflag=$(echo $distro | grep -i "centos")
  if [ -z "$rhflag" ]
    then    #If it is neither RedHat nor CentOS, see if it is Fedora.
    echo "It does not appear to be CentOS or RHEL..."
    rhflag=$(echo $distro | grep -i "fedora")
    fi
fi
 
if [ -z "$rhflag" ]
  then
  echo "...still determining Linux distribution..."
else
  echo "You have a RedHat distribution (e.g., CentOS, RHEL, or Fedora)"
  yum -y install unzip
fi

if [ -z "$debflag" ]
then
  echo "...still determining Linux distribution..."
else
   echo "You are using either Ubuntu Linux or Debian Linux."
   apt-get -y install unzip  # necessary for Azure Ubuntu Linux distros. May not be needed with typical AWS AMIs.
   fi
 
suseflag=$(echo $distro | grep -i "suse")
if [ -z "$suseflag" ]
then
  if [ -z "$debflag" ]
  then
    if [ -z "$rhflag" ]
      then
      echo "*******************************************"
      echo "Could not determine the Linux distribution!"
      echo "Installation aborted. Nothing was done."
      echo "******************************************"
      exit
    fi
  fi
else
   echo "You have Linux SUSE."
   zypper -n install unzip
fi
 
cd /tmp
tflink='https://releases.hashicorp.com/terraform/'$tfv'/terraform_'$tfv'_linux_amd64.zip'
destiny='terraform_'$tfv'_linux_amd64.zip'
curl $tflink > $destiny
unzip $destiny
mv /tmp/terraform /usr/local/bin
echo "Run 'terraform --version' manually to verify it is correctly installed."

2.  Run the script like this:  sudo bash /tmp/terra.sh

How Do You Keep a User from Logging off Unexpectedly?

Problem scenario
You have a Bash script that keeps logging out the user unexpectedly.  You have done research and nothing seems to work.  Your script does not use the reboot command.  Your script does use the exit command.

What do you do to keep the user from logging off while still using this script with the exit command?

Solution
This solution below is for one specific root cause.  There are different scenarios where you can have a user being logged out unexpectedly.  For general troubleshooting, you may want to see AskUbuntu or StackOverflow.  But if you have a script that has the exit builtin shell command, this solution may help you.

Are you running the script with the source command?  See if you can run the script with the bash command instead of the source command.

Are you running the script like this (with no quotes)?

". nameofscript.sh"

Try this method instead (with no quotes to have the script run in a newly-forked shell):

"./nameofscript.sh"

If you must start the script using source (with the source command or this ". nameofscript.sh" method), you may need to re-write the script.  The "exit" command when executed via a "sourced" bash script will exit as if the user entered the exit command.  When the script is executed with the bash command, the process is forked into a new shell.  If the script shares a shell, the exit command will terminate the shell of the user.

To demonstrate, create this two-line contint.sh file in /tmp/:

#!/bin/sh
cd /var

Now run change directories to /tmp/.  Run it like this:

bash contint.sh; pwd

Now run it with source:

source contint.sh; pwd

# With the "source contint.sh" method, the working directory you will be in will be /var/.

How Do You Set up an FTP Server on an RHEL Server Running in AWS?

Problem scenario
You want to use a Red Hat Enterprise Linux server to be an FTP server.  You have a RHEL instance in AWS.  How do you configure this server to serve as an FTP server?

Solution
1.  Run this command: sudo yum -y install vsftpd

2.  Run the commands below but replace contint with the username of your choice.  You will need to respond to a password prompt too.

sudo adduser contint
sudo passwd contint # give this user a password and remember it
sudo mkdir /home/contint/ftp
sudo chmod a-w /home/contint/ftp
sudo mkdir /home/contint/ftp/files
sudo chown contint:contint /home/contint/ftp/files
echo "file to test vsftpd" | sudo tee /home/contint/ftp/files/basic.txt

3.  Edit the /etc/vsftpd/vsftpd.conf file so that

    a) "chroot_local_user=YES" is not commented out.  (There should be no leading "#" in front of this stanza.)

    b) these lines are appended at the bottom (and then save the changes to vsftpd.conf):

user_sub_token=$USER
local_root=/home/$USER/ftp
pasv_min_port=40000
pasv_max_port=50000

4.  Run these two commands (where contint is the username that was added in step #2):

echo "contint" | sudo tee -a /etc/vsftpd/vsftpd.userlist
sudo systemctl restart vsftpd

How Do You Connect to an Amazon RDS Instance?

Problem scenario
You created an Amazon RDS instance that uses PostgreSQL.  How do you connect to it without using the AWS CLI or AWS API from a Windows workstation?

Solution

Prerequisites

  • Install HeidiSQL on your Windows machine.  (Toad or other SQL front-end applications can work too.)
  • You need a username and password for the PostgreSQL instance.  These are entered when you create the RDS instance. 
  • To create an RDS instance with the PostgreSQL database engine, see this posting.

Procedures
1.  In the AWS console for Amazon RDS, click on the instance you want to connect to.
2.  Click on Security Group.  
3.  Search for "Endpoint."  You should see something like this:

foobar.chzvo2xaqtdx.us-east-2.rds.amazonaws.com

4.  Copy that FQDN into the "Hostname / IP " field in the Session manager window of HeidiSQL.  (Open HeidiSQL)
5.  In Session manager for HeidiSQL note the following settings:

  • For the Network Type drop down box, choose "PostgreSQL (experimental)".
  • For the port use 5432.
  • Enter the username and password.

Click "Open."

Reputations of Cryptocurrency Exchange Companies in the U.S.

Question
What ratings do U.S. based cryptocurrency exchange companies have with the Better Business Bureau?

Answer
Updated on 3/6/24.
Updated on 12/4/20.
Some bitcoin and altcoin enthusiasts are not interested in purchasing cryptocurrencies from non-American companies.  Some people argue that the Better Business Bureau is run by the businesses themselves, and thus protector of businesses.  Arbitrators want to be picked by the member businesses when a consumer raises a dispute; arbitrators are not automatically assigned.  The consumer and a representative of the business are each given input on selecting a potential arbitrator.  This selection method may give arbitrators incentive toward issuing a ruling in favor of the companies to increase an arbitrator's demand in the future.  Consumers may be less involved in disputes than the member businesses.  Many authorities recognize the BBB as having an influence on a company's overall reputation.  But by no means is the BBB the ultimate judge of a company's reputation.  Many consumers have had positive experiences with companies that are rated an "F" by the BBB.

This lists the BBB rating of some U.S. cryptocurrency companies (as of 12/4/20):

Company Name                            BBB Rating

Bittrex, Inc. F (on 1/20/18 they were not rated but their customer review rating has been 91% negative)
Coinbase, Inc. F (on 1/20/18 they had a D-)
Gemini Trust Company, LLC B  (their website is www.gemini.com; on 1/20/18 they had an F)
Kraken F  (www.kraken.com is run by Payward - Kraken Bitcoin Exchange; on 1/20/18 they had an "F" too.)
Paxful, Inc. F (on 1/20/18 they had an "F" too.)
Poloniex, Inc. F (on 1/20/18 they had an "F" too.)


This lists the BBB rating of some U.S. cryptocurrency companies as of 3/6/24:

Company Name                            BBB Rating

Bittrex, Inc. No review. [1]
Coinbase, Inc. B+
Gemini Trust Company, LLC F  
Kraken F 
Paxful, Inc. NR
Poloniex, Inc. F


Sitejabber.com reviews businesses.  Some of the businesses have not been reviewed or they have been reviewed by merely one person.  One person, in theory, could have been paid by a competitor or the business itself.  In these early days of cryptocurrency, we have little to go on. 

Here are the sitejabber.com reviews as of 12/4/20:

Company website SiteJabber.com Star Review (out of five possible stars)

Bittrex.com                                       roughly 2.5 (up from 1 on 1/20/18)
Coinbase.com                                   roughly 1.5
Gemini.com                                      not reviewed
Kraken.com                                      roughly 2.5 (up from 1 on 1/20/18)
Paxful.com                                         2 (down from 5 on 1/20/18)
Poloniex.com                                    4 (previously not reviewed on 1/20/18)

(As of 11/26/20 and still in 2024, we think Coinbase.com is a highly regarded website/platform by most people in the crypto world. Their exclusion of an altcoin can affect its price significantly.)


Here are the sitejabber.com reviews as of 3/4/24:

Company website SiteJabber.com Star Review (out of five possible stars)

Bittrex.com                                       1
Coinbase.com                                   roughly 1.5
Gemini.com                                      roughly 1.5
Kraken.com                                      roughly 1
Paxful.com                                        roughly 1.5
Poloniex.com                                    roughly 2


Cryptocompare.com reviews these platforms using a variety of factors in their methodologies. Here are some standings as of 12/4/20.

Company website Cryptocompare.com rating (where AA is highest and F is lowest)

Bittrex.com                                       BB (up from a "B" on 9/3/19)
Coinbase.com                                   AA (the same as of 9/3/19)
Gemini.com                                       AA (up from an "A" on 9/3/19)
Kraken.com                                       A (the same as of 9/3/19)
Paxful.com                                         not reviewed
Poloniex.com                                    BB (down from AA on 9/3/19)


Company website Cryptocompare.com rating (where AA is highest and F is lowest)

Bittrex.com                                       no longer listed
Coinbase.com                                   AA
Gemini.com                                       A
Kraken.com                                       AA
Paxful.com                                        not reviewed
Poloniex.com                                    C


Final thoughts
The low ratings in January of 2018 with the BBB and Sitejabber.com may be explained by the unexpectedly high demand for purchasing cryptocurrencies at the time.  It is understandable that the businesses were not prepared for the volume of customers rapidly signing on to invest in new assets. 

While not related to the American group of companies, the Canadian exchange coinsquare.io (owned by goNumerical Ltd.) has an A with the BBB.  Their website has not been reviewed by sitejabber.com. 

*According to an external source "GDAX was changed to Coinbase Pro in May 2018." GDAX.com used to have a D- rating with the BBB.

More people are using cryptocurrency wallets as of December 2020. You may want to buy a wallet or learn more about the accessories here.

To sign up for Coinbase.com, click here. (You often get up to $200 in free coins if you sign up for the first time.)

[1] Bittrex's website indicated they went out of business with a "Thanks for the memories" message. Coindesk indicated that their American division filed for bankruptcy.

Disclaimer
We have used one or more of these companies above and did not have a bad experience.  To have your case adjudicated in the U.S., you may want to consider using an American cryptocurrency exchange.  ContinualIntegration.com is an affiliate with the Czech Republic company called Changelly.  We like how they offer a breadth of altcoins that can be purchased directly with U.S. dollars (so you do not need to first buy Bitcoin and do a pair exchange).  We cannot guarantee what type of experience you may have with a given cryptocurrency company.  Good luck!


To see the share of market transactions that the cryptocurrency exchanges have, see this link.

If you want to receive free cryptocurrency by just learning more, try Coinbase; it is ideal for Americans. For Europeans, the platform/company Iconomi.com can allow you to buy crypto or learn more.

How Do You Create an Amazon RDS Database Instance?

Problem scenario
You want to test out an Amazon RDS database instance.  (You want to use a database PaaS offering and VPC as opposed to EC-2.)  What do you do?

Solution
1.  Log into the AWS console.  
2.  Click "Launch a DB instance"
3.  Choose the database engine you want (e.g., PostgreSQL). Click "Next".
4.  Click the option for "Dev/Test" and click "Next".
5.  Type in a DB instance identifier, a master username and master password as prompted.  Then click "Next".
6.  For the next window ensure that "Public accessibility" is set to "Yes" if you want to access it directly from your workstation.  (For security reasons, this may not be advisable if you have sensitive data.  These directions were written for the purpose of helping people test out RDS.)  Then click "Launch DB instance".