How Do You Get the VNC Viewer Application to Show the Full Screen of the Linux Desktop That You Have Connected To?

Problem scenario
On Windows (e.g., 7 or 10) you have a VNC viewer application installed.  You are trying to use the VNC application to remotely connect to a Linux desktop.  You can connect to the Linux server (or computer or Raspberry Pi).  The problem is that the VNC viewer is not showing the full screen of the Linux desktop.  You know there is more to the screen horizontally and/or vertically.  You have changed various settings (including the size of the application), but you cannot view the entire desktop.  You have tried different sized monitors and different VNC configuration settings.  What do you do to see the entire desktop of the Linux machine?

Background
This solution was made for Raspberry Pi 3.  But it may help you with other Linux distributions.  

Solution
1.  Go to the /boot/ directory. 
2.  Make a backup of config.txt. 
3.  Modify config.txt in two ways. Uncomment these two lines:

framebuffer_width=1280
framebuffer_height=720

4.  Save the changes. 
5.  Reboot the Linux machine. 
6.  Now connect with VNC from the Windows workstation.

How Do You Install the Go Programming Language on an Ubuntu Linux Server?

Problem scenario
You want to use the Go programming language.  There are various directions online that involve downloading files and modifying configuration files.  You just want simple directions to install Go to an Ubuntu Linux server.  What do you do?

Solution
Run these two commands:
sudo apt-get -y update
sudo apt -y install golang-go

How Do You Troubleshoot the Error “ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)”?

Problem scenario
You install mysql on a RedHat (RHEL) Linux server in AWS.  You run this command: mysql -u root -p

But you get this message:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

How can you get around this problem and get to a SQL interface?

Solution
sudo systemctl start mariadb.service

How Do You Get a Docker Container to Run That Was Made for Graylog?

Problem scenario
You are trying to follow the directions for installing Graylog from Docker hub.  You run these commands:

docker pull graylog2/server

docker run --name contint-mongo -d mongo:2

docker run --name contint-elasticsearch -d elasticsearch:2 elasticsearch -Des.cluster.name="graylog"

docker run --link contint-mongo:mongo --link contint-elasticsearch:elasticsearch -p 9000:9000 -e GRAYLOG_WEB_ENDPOINT_URI="http://127.0.0.1:9000/api" -d graylog2/server

The first two containers (for MongoDB and ElasticSearch) work and run.  The third for Graylog will not start.  It says it has "Exited 1 second ago."  You cannot get it to start.  Port 9000 is not blocked.  

How do you get a Docker container with Graylog to run?  There are no error messages that you see.

Solution
Stop the Docker containers running MongoDB and ElasticSearch.  Start the Docker containers running MongoDB, ElasticSearch, and Graylog.

List of Cryptocurrency Accessories

List of Cryptocurrency Accessories
Ethereum – Gold Plated “Cryptocurrencies You Hold"
Gold Ripple – “Cryptocurrencies You Hold"
KeepKey: the Simple Cryptocurrency Hardware Wallet
Ledger Nano S Bitcoin Wallet Bundle With VUVIV Micro-USB Adapter and USB-C Adapter for MacBook (3 Items)
Ledger Nano S Cryptocurrency Hardware Wallet
Ledger Nano S - Cryptocurrency Hardware Wallet With MintCell Magnetic USB Cable and Cable Tie
Trezor Bitcoin Wallet black *
Trezor bitcoin wallet white *

* The Trezor wallet has the highest rating on CryptoCompare.com.


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

How Do You Use Flask as a RESTful Endpoint on an Ubuntu Server?

Problem scenario
You want to deploy Flask to test it out.  You also want a RESTful endpoint on an Ubuntu Linux server.  How do you do this?

Solution
1.  Install Flask.  Run these five commands:

sudo apt-get -y update
sudo apt-get -y install python python-pip 
sudo pip install --upgrade pip setuptools
sudo apt-get -y install python3-dev virtualenv python3-venv
pip install flask

2.  Make a directory and create a basic Python program to test it out.  To do these things follow these steps:

mkdir contintflask
vi __init__.py  # Place the code below inside this __init__.py file:

from flask import Flask, Response

app = Flask(__name__)

@app.route("/")
def index():
    return Response("It works! Continually Integrate and Improve!"), 200

if __name__ == "__main__":
    app.run(debug=True)
# Most of this code was taken from https://www.fullstackpython.com/blog/python-3-flask-green-unicorn-ubuntu-1604-xenial-xerus.html

3.  From another terminal (e.g., open another command prompt from your desktop or create a duplicate Putty session to the server), run this command:

curl http://localhost:5000

Look at the output on the first terminal.  You should see an HTTP status code of 200 and other information.

List of Bitcoin and Other Cryptocurrency Books

Sic Itur Ad Astra (on pages 390 and 391) discusses fiat currency and how non-governmental entities can create valuable currency. The author was an astrophysicist; he seems to have almost predicted bitcoin.

List of Bitcoin and Other Cryptocurrency Books

The Age of Cryptocurrency: How Bitcoin and the Blockchain Are Challenging the Global Economic Order
The Bitcoin Big Bang: How Alternative Currencies Are About to Change the World
Bitcoin: Everything That You Need to Know About Bitcoin and Blockchain
Bitcoin for Dummies
Bitcoin From Beginner To Expert: The Ultimate Guide To Cryptocurrency And Blockchain Technology
Bitcoin Rebellion - the Beginning
Bitcoin: The Ultimate Guide from Beginner to Expert: Bitcoin and Cryptocurrency
Bitcoin: The Ultimate Guide to the World of Bitcoin, Bitcoin Mining, Bitcoin Investing, Blockchain Technology, Cryptocurrency
Blockchain and Bitcoin Basics: A Beginners Guide To Blockchain, Bitcoin, Other Cryptocurrencies And Why It's Important To Learn Now!
Cryptocurrency: Mining, Investing and Trading in Blockchain, including Bitcoin, Ethereum, Litecoin, Ripple, Dash, Dogecoin, Emercoin, Putincoin, Auroracoin and others (Fintech)
Cryptocurrency Investing Bible: The Ultimate Guide About Blockchain, Mining, Trading, ICO, Ethereum Platform, Exchanges, Top Cryptocurrencies for Investing and Perfect Strategies to Make Money
Cryptoassets: The Innovative Investor’s Guide to Bitcoin and Beyond
Digital Gold: Bitcoin and the Inside Story of the Misfits and Millionaires Trying to Reinvent Money
How Money Got Free: Bitcoin and the Fight for the Future of Finance
Mastering Bitcoin for Dummies: Bitcoin and Cryptocurrency Technologies, Mining, Investing and Trading - Bitcoin Book 1, Blockchain, Wallet, Business
Mastering Bitcoin: Programming the Open Blockchain
The Rise and Rise of Bitcoin


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

How Do You Get Jenkins to Push Files to Other Servers in AWS?

Problem scenario
You have Jenkins set up on Linux.  You want it to deploy files to other Linux servers, how do you do this as a proof of concept?

Solution
There are many different ways of accomplishing this task.  These directions do not cover the production-recommended best practices associated with security.  For such a solution, you may want to see this external site.  (These directions could be adapted for non-AWS environments.  You would configure the relevant firewall(s) instead of the relevant Security Group(s).)

Prerequisite
You need to have Jenkins set up.  If you do not know how to set it up and you are using Debian/Ubuntu Linux, see this link.; if you are using CentOS/RHEL/Fedora Linux, see this posting.  Ensure that the Security Group(s) governing the Jenkins server allows for connectivity to this other server.

Procedures
Part 1
Configure passwordless SSH between the two servers.

1.  Optional step to be potentially done on the back-end of the Jenkins server.  If you do not know the Jenkins password and you can change it, do the following:
sudo passwd jenkins # Press enter.  Then enter a new password twice.

2.  On the Jenkins server run these commands:

su jenkins
ssh-keygen -t rsa -P ""

# You will be prompted after the above command.  Press enter to accept the default location to save the key.

Then run this command:
cat /var/lib/jenkins/.ssh/id_rsa.pub

3.  Go to the non-Jenkins server.  Append the output of the above command to an authorized_keys file on the non-Jenkins server.  Assuming the "ubuntu" username on the non-Jenkins server that has the ability to write to the destination directory where the file will go, the authorized_keys file that will receive the appendage is this /home/ubuntu/.ssh/authorized_keys

4. Connect from the Jenkins server to the server just configured. When prompted to "Continue" type "Yes" (with no quotes) and press enter. Then exit the SSH connection. (Alternatively you could turn off the fingerprint verification step.) This is just to allow Jenkins to SSH to the server.

Part 2
1.  Identify the file path on the Jenkins server you want to transfer.  (Make note of the full directory path.)  For this example, we will assume it is /coolpath/goodfile.
2.  Open Jenkins web UI.
3.  Click on "New Item."
4.  Give it a name, and choose "Freestyle project" and click "Ok."
5.  On the next screen for configuring this project, scroll to the bottom and click on the "Add build step" underneath "Build."  
6.  Click on "Execute shell."  Enter this text*:

scp /coolpath/goodfile ubuntu@x.x.x.x:/tmp/goodfile2

* You will substitute the text above according to the following:
- "/coolpath/goodfile" is the full directory path of the source file you want to transfer on the Jenkins server
- "ubuntu" with the username that received the modification to its authorized_keys file on the non-Jenkins server that will receive files from jenkins (in step 3 of Part 1 above).
- "/tmp/goodfile2" is the directory destination and file name you want the file to be on the non-Jenkins server
- x.x.x.x is the IP address of the non-Jenkins server.  To determine if it should be the internal (found with an ip addr show command) or external IP address (found with a curl icanhazip.com command), use the one that corresponds with the AWS Security Group rule or GCP firewall rule for the Jenkins server.  That is if the AWS Security Group or GCP firewall was configured to all an external IP address of the Jenkins server, use the external IP address of the non-Jenkins server.  If the Jenkins server's internal IP address was used in the GCP firewall or AWS Security Group configuration, use the internal IP address of the non-Jenkins server.


- "/tmp/goodfile2" is the directory destination and file name you want the file to be on the non-Jenkins server
- x.x.x.x is the IP address of the non-Jenkins server.  To determine if it should be the internal (found with an ip addr show command) or external IP address (found with a curl icanhazip.com command), use the one that corresponds with the AWS Security Group rule or GCP firewall rule for the Jenkins server.  That is if the AWS Security Group or GCP firewall was configured to all an external IP address of the Jenkins server, use the external IP address of the non-Jenkins server.  If the Jenkins server's internal IP address was used in the GCP firewall or AWS Security Group configuration, use the internal IP address of the non-Jenkins server.

7.  Click "Save."

8.  From the back end of the Jenkins server, run the shell command you entered in step #6.  You do this exactly one time to manually accept the fingerprint.  (This prompt will not happen again; it would have stopped the Jenkins job from completing successfully.)

9.  Go back to the Jenkins web UI.  Click "Build Now" on the left.

How Do You Deploy Jenkins 2.X to Ubuntu Linux in AWS?

Problem scenario
You have an Ubuntu server in AWS with 0.5 GB of RAM.  You want to install Jenkins on it without installing an "apt-transport-http" package.  (You are ok with using an "apt-get upgrade" command on the Linux server.)  How do you do this?

Solution
(If you do not want to run "apt-get upgrade", and you can install "apt-transport-http", then see this posting.  Otherwise proceed with the below.)

Prerequisites
Install Java.  See this posting if you need assistance.

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

sudo apt-get -y update; sudo apt-get -y upgrade & sudo apt-get -y upgrade

# When you see the "Package configuration" menu that says "Configuring grub-pc" press the tab key (to get to the "Ok" option for "keep the local version currently installed").  Then press the enter key.  In other words, press the tab key when you see this (and then press the enter key):

2.  After the above finishes processing and you are returned to a command prompt, run these commands:
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

3.  Go back to your workstation with a GUI 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 AWS Console) that the relevant security group allows for inbound connections over port 8080 (unless you configured a different port) from your workstation.

4.  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.  If you want Jenkins to push files (or integrate code) to other servers, see this posting.

How Do You Determine the Port Number That a Web Service Is Listening On?

Problem scenario
You have access to the backend of a Linux server.  You want to know if a port is in use (e.g., if there is activity on it).  You believe that an active service is listening an a TCP port.  How do you determine the port number of that service?

Solution
To be diligent, do these three things:

1.  Run this command to find a list of listening services:
sudo netstat -anlp | grep -i listen

The output may be associated with a specific service, process or application that is visible in the output of the netstat command above.  You may exhaustively try the different ports if you construct sockets in a web browser (e.g., x.x.x.x:123 to test port 123 where x.x.x.x is the external IP address of the server).

2.  If you have the nmap utility installed, you run this command to find similar results:

nmap -p1-65535 127.0.0.1 | grep open

3.Run these two commands:
ssh 127.0.0.1
lsof -i