How Do You Install the Latest Version of python-setuptools (aka easy_install) when Your Package Repositories Do Not Have It Available?

Problem scenario
Your apt or yum repositories do not have the newest version of python-setuptools (aka easy_install) available.  You need to install a recent version.  What should you do?

Solution
Prerequisites
a.  You need to have unzip installed.  Debian/Ubuntu servers usually have this by default, but if you still need assistance, see the Debian/Ubuntu link below.  Click on your distribution of Linux for assistance with installing unzip:
CentOS/RHEL/Fedora
Debian/Ubuntu
SUSE
b.  If the server is completely new, we recommend uninstalling python-setuptools.  If you have installed Docker or other tools that rely on python-setuptools, we do not recommend uninstalling python-setuptools as it is a dependency to other packages.  If you do remove python-setuptools, the first command in step #3 below will return an error.

Procedures
1.  If you need to upgrade python-setuptools on a Linux server you can download the zip file from here.  If you have access to the internet, run this command (but substitute the URL with the desired .zip file on the page that is hyperlinked earlier and replace "file.zip" with the name of the file that you are downloading): curl -Lk http://pypi.org/path/to/file.zip > /tmp/file.zip
2.  Copy the .zip file to the /bin/ directory: sudo mv /tmp/file.zip /bin
3.  Run these commands:
sudo mv /bin/easy_install ~
cd /bin
sudo unzip nameOfFileabove.zip
cd setuptools   #then press tab to autocomplete
sudo python setup.py build
sudo python setup.py install

4.  You should be done.  To test your version of easy_install (which is the same as python-setuptools), run this command:
easy_install --version
For the sake of a proof-of-concept, provided you are not in a sensitive environment, you can ignore a message "ImportError: No module named py31compat".  Otherwise you may want to address this message.

What Is the Build Process?

Question
In programming (or software development) you read or hear about the build process.  There are different tools to help speed up the build process or aid the SDLC.  What is the build process?

Answer
It is the process of creating byte code from source code.  A build process can be referred to as a compilation process.  The byte code file is also called a binary file.  When software is built it is compiled.  Some languages refer to the compilation process of creating machine code from source code as "translating" -- not compiling.  

The source of this answer was this Red Hat page. You may want to view this posting which defines the term "build."

How Do You Get around the Error ‘no program or library has “hello” as canonical name’?

Problem scenario
You are running "autoreconf --install" but you get this type of error:

"Makefile.am:2: warning: variable 'hello_SOURCES' is defined but no program or
Makefile.am:2: library has 'hello' as canonical name (possible typo)
autoreconf: automake failed with exit status: 1"

How do you modify Makefile.am to not have this error when running "autoreconf --install"?

Solution
In the Makefile.am file, remove the "hello_" from the stanza "hello_SOURCES".  

For example, use this stanza (with no "hello"):

SOURCES = main.c

Some examples online have different naming conventions for this stanza.  It can be called just "SOURCES".

How Do You Find the Number of Processors or the Amount of RAM on a Linux Server?

Problem scenario
You want to know the number of processors your Linux server has.  What do you do?

Solution #1
Run this command:  grep -c ^processor /proc/cpuinfo

Solution #2
Run this command: nproc


Problem scenario
You want to know how much memory your Linux server has.  How do you find the amount of RAM (in gigabytes) on a Linux server?

Solution
Run this command:  free -g | grep Mem | awk '{print $2}'

For megabytes, run this command:  free -m | grep Mem | awk '{print $2}'

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

Problem scenario
You want to use Python Eve to test it out.  You also want to create a RESTful endpoint on an Ubuntu Linux server.  How do you do this?

Solution
1.  Install Eve on the Ubuntu server.  Here is one way:

sudo apt-get -y update
sudo apt-get -y install python python-pip
sudo pip install eve

An alternative way to install it is given here.

2.  Run these five commands:

python
contint = {'MONGO_HOST': 'localhost', 'MONGO_PORT': 27017, 'MONGO_DBNAME': 'the_db_name', 'DOMAIN': {'contacts': {}}}
from eve import Eve
app = Eve(settings=contint)
app.run()

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.

How Do You Install python-snappy on an Ubuntu/Debian Linux Server?

Problem scenario
You are trying to install python-snappy on Ubuntu (or a Debian distribution of) Linux.  You go here and find no obvious dependencies or prerequisites:
https://pypi.python.org/pypi/python-snappy

But when you try to install it, you run "python setup.py build" and get an error like this:

"/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
running build
running build_py
package init file '__init__.py' not found (or not a regular file)
package init file '__init__.py' not found (or not a regular file)
running build_ext
building '_snappy' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time - D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c  snappymodule.cc -o build/temp.linux-x86_64-2.7/snappymodule.o
x86_64-linux-gnu-gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1"

or an error like this:

"x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time - D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c  snappymodule.cc -o build/temp.linux-x86_64-2.7/snappymodule.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
snappymodule.cc:28:20: fatal error: Python.h: No such file or directory
compilation terminated."

What should you do to install snappy for Python?

Solution
Run these four commands:

sudo apt-get -y install python-pip

sudo su -

pip install snappy

exit

#If you are not allowed to leave pip installed, run this command: "sudo apt-get -y remove python-pip" with no quotes

You Cannot Connect To One IP-Enabled Device to Your WiFi Router Wirelessly. What Do You Do?

Problem scenario
You can connect the device with a network cable (in a wired fashion) to your network including the WiFi router's physical ports.  The wired connection works.  You can connect other devices to the WiFi router wirelessly.  You can even connect  the IP-enabled device with the problem to other wireless routers.  What is wrong?

Possible Solution #1
See if the incompatibility comes from the WiFi router having an access control list enabled.  If it is enabled, it may not allow your IP-enabled device to connect.  The devices that can connect wirelessly may be on the ACL (access control list).  Once (and if) you disable the ACL in the WiFi, you may need to restart the IP-enabled device (e.g., reboot the laptop).  If your IP-enabled device's wireless adapter's MAC address changed, that may cause it to be blocked by the ACL.  Make sure the ACL is not stopping your IP-enabled device.

Possible Solution #2
If your WiFi does not have an access control list that is enabled, the WiFi adapter on the IP-enabled device may be defective.

How Do You Check if snappy Is Installed?

Problem scenario
You are not sure if snappy (the Python development tool) is installed.  You try these two commands:

python
>>> import snappy

You see this:

"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "snappy.py", line 50, in <module>
    from snappy_cffi import UncompressError, compress, decompress, \
  File "snappy_cffi.py", line 3, in <module>
    from cffi import FFI
ImportError: No module named cffi
"

The above means snappy is not installed or if you recently installed it, the environment variables are not updated.  

Potential root cause
You installed it but the environment variables have not been updated and refreshed. 

Solution
Log off as the current user and log back in.

Then use option 1 if you have pip installed:

pip list | grep -i snappy

Then use option 2 if you do not have pip installed:

Run these two commands:

python
>>> import snappy #where ">>>" is not something that you type in

# If you see no errors in the above, then snappy has been installed

What Do You Do When You Get “Permission Denied” in FTP?

Problem scenario
You are trying to transfer a file named foobar.txt via FTP.  But you get this error:

local: foobar.txt remote: foobar.txt
local: foobar.txt: Permission denied

What do you do with this "Permission denied" error?

Solution
The above error would not happen if the problem was on the remote server.  (You would get "550 Failed to open file" if the problem was a lack of read permissions on the source of the FTP file transfer.)

Make sure that the destination of the FTP file transfer (that is the local directory) is one where your user has access to write to.  You must have write permissions in the local directory.  If the server was recently set up or changed, the permissions in the local directory may prevent the user from writing to it.  You may want to change to the /tmp directory to initiate the FTP session from there.

How Do You Remotely Connect with a GUI Interface into a Raspberry Pi 3 from a Windows Computer That Is on the Same Network?

Problem scenario
You want to connect to your Raspberry Pi 3 with a Windows machine (e.g., Windows 7 or Windows 10 laptop).  Both are on the same network.  You want more than the command line interface.  You want a desktop GUI connection beyond just a character prompt.  What do you do?

Solution
On the Raspberry Pi do these three steps:
1.  Change password for the pi user or create a new user.
2.  Find the IP address by using "ifconfig" with no quotes in a command terminal.  (Use "ip addr show" if you prefer.)
3.  Go to the Raspberry button in the upper left hand corner, go to Preferences -> Raspberry Pi Configuration.  For VNC choose "Enabled."

On the Windows workstation, do the following four steps:
4.  Download and install VNC Viewer.
5.  Open VNC Viewer.
6.  Type in the IP address of the Raspberry Pi and press enter.
7.  Enter the username and password and press enter.