The other day I got a new laptop and needed to generate ssh key pair. Sometimes you forget basic commands when you don’t run them on a daily basis. So, I took a short walk in Brooklyn, New York City before I started working on my new laptop setup.
To generate ssh key pair in Linux is quite simple. Use the ssh-keygen command. Open your Terminal and type:
ssh-keygen -t rsa
Next, you will need to specify the location of the file where you want to save the key such as for example:
Enter file in which to save the key (/home/youruser/.ssh/id_rsa):
Don’t type anything to leave your key at the default location with the default name /home/youruser/.ssh/id_rsa. If you want to you can specify a different name. I do this when I need to ssh to different servers, this helps me keep organized.
Finally, you will need to type a password if you like:
Enter passphrase (empty for no passphrase):
I usually leave it empty, but this is really up to you.
This will create a private key written to: /home/youruser/.ssh/id_rsa
and a public key written /home/youruser/.ssh/id_rsa.pub
Copy the contents of your .pub file into your server’s .ssh/authorized_keys
Now you should be able to SSH to your server without using a password. Give it a try and Contact me if you have any questions.
The other day I got a new Apple M1 processor chip (I really don’t like there’s only two ‘USB-4’ ports and the ‘Magic bar’ bothers me!). But, anyways when I opened my terminal i noticed the below message and wanted to change default shell to bash for this macOS Bir Sur.
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
I got used to bash on my nice old friend macOS High Sierra. So, I found a way to change default shell to bash for it. Before changing this I brewed one of my favorite Latin America coffees from Honduras.
How Change Default Shell to bash macOS Big
This is very easy to do:
Open your terminal
List available shells by typing: cat /etc/shells
To change your account to use bash type: chsh -s /bin/bash
Close your terminal
Open your terminal and verify that bash is your default shell running: echo "$SHELL" or printf "%s\n" "$SHELL"
While building my own Flask application for learning purposes. I was not sure how it was being served on the web. I did not install Apache of any other web server, but it is running on my Digital Ocean test server. The I found out about Python’s built-in HTTP server.
This final purpose of this app is to keep track of your blood pressure at home. I will keep you posted about the progress. You can also see my Github repo and offer any suggestions if you like.
Anyways, after having a great cup of Latin America coffee I discovered that Python has an standard HTTP server built into the standard library. So, when I run my CMD python run.py at the end of my Dockerfile it starts the Python standard HTTP build-in server for me.
If you like to run it alone for other testing purposes you can do the below.
For Python 3.x:
python3 -m http.server
For Python 2.x
python -m SimpleHTTPServer 8000
This will serve the current directory at your http://localhost:8000 or http://127.0.0.1:8000
Python’s built-in HTTP server is a useful standard library that I was not aware or did not occur to think about it until today. Don’t know why.
I invite you to check my other posts about setting up Ubuntu server static IP. Thanks and let me know if you have any questions.
The other day one of my friends who is a Windows user asked me to basic Linux commands because he wanted to improve his IT skills. I helped him out and also decided to put together a brief list of basic Linux commands for newbies while having fantastic Latin America coffee at home.
Basic Linux Files and Navigation Commands
List of files/directories in current directory
Formatted listing including hidden files
Change directory to <dir>(<dir> is directory name)
I usually work on Debian based Linux distros, but the other day while sorting some NYC street photos I took a friend contacted me asking me how to list installed packages in Red Hat, CentOS and Fedora.
Using RPM Package Manager
Using YUM Package Manager
Using RPM Package Manager
The RPM package manager is an open source, low level package manager which runs on Red Hat based Linux distros. You can list installed Packages in Red Hat very easy with rpm.
The following command will print a list of all installed packages on your Linux box, the flag -q means query and the flag -a means to list all installed packages:
Using YUM Package Manager
YUM stands for Yellowdog Updater Modified is an interactive, front-end rpm based package manager.
Using the command below will list all installed packages on your Linux box. One cool thing about this Linux package manager is that it lists the repository from which a package was installed:
yum list installed
Yum-utils is an assortment of tools and programs for managing yum repositories in your Linux box. Using this tool you can install debug packages, source packages and you can view extended information from repositories. You might need to install it using yum:
yum update && yum install yum-utils
Once you have Yum-Utils installed run the following command in your Linux terminal to list all installed packages:
To run Docker without sudo in Linux is quite simple. Using your terminal in Linux and a couple simple commands shown below. You don’t need to be an expert Linux guru software developer to go thru these steps.
If you don’t want to preface the docker command with sudo, create a Linux group called docker and add users to it. When the Docker daemon starts, it creates a Unix socket accessible by members of the docker group.
Create the docker group:
sudo groupadd docker
Add your user to the docker group:
sudo usermod -aG docker $USER
Log out and log back to activate the group membership in Linux or you can run:
Stop words SEO are words such as ‘at’, ‘any’, ‘before’, ‘which’. While having putting together some New York City pictures for my NYC Moments website I took the other day I found myself learning more about SEO. I put together a little list of stop words in SEO. Using them in your permalink is therefore a waste of valuable space.
List of SEO stop words
Removing stop words from your permalink will give you more space for keywords.
If you like this small post and feeling generous get one of my T-Shirts and coffee mugs designs below. Thanks!
I have never seen this Docker error: Cannot start service while using docker-compose in the short time I have been using Docker.
While having amazing Latin America coffee from Honduras I decided to jump back into my personal Flask project. This project is mainly to keep track of your blood pressure by taking daily readings and keeping a record. This record can then be shared with your doctor by email, PDF printout or by giving your doctor access to your profile.
Using Docker with docker-compose I got this “Docker error: Cannot start service…..”
Docker error: Cannot start service …: network 5f9226bdb324e31fa4e4bff6777b18b329dc7e6c55e7a2dca5c72601ff10927c not found
Doing a little research I found out that I did not properly stopped my running containers. I lost track of this project and then did not remember what was the last thing I did. This is not good! Always keep track of your projects specially with learning something new. I use Trello to keep a bit more organized and know what was the last thing I did.
To fix the above error I simply ran this two commands in my working project directory:
docker-compose up -d <or without the -d>
It was all fixed and I got to go for a walk in NYC! Happy learning!