Windows guy learns linux How to telnet/ssh

So far I have used the VirtualBox console to connect to my virtual machine running Linux (CentOS 7).  This is fine and good for one session, but if you want to run multiple terminals you have to install a Telnet/SSH client.

I will be using a client called “Putty” which is free and very widely used.  Download Putty.exe to your desktop.

Now we have Putty now but it’s useless until we make some changes on our local virtual machine.  (If you’ve installed Linux on a real physical machine or had Linux installed on a server VM then this next steps might not apply)

We need to know which IP address our Linux server is running on.  In your VM console run “#ifconfig”.  This is very similar to running ipconfig on Windows command line.  My results are below.

Linux IFConfig

Note, the IP address of the virtual machine is 10.0.2.15.  Now that we know that we go to VirtualBox, select the VM in question and click on Settings and then select “Network”.

Expand the “Advanced” tab if it is not already showing and click on “Port Forwarding”.

Virtual Box Linux SSH Port Setup

Here, click the +Plus sign and add a new rule.  It can be called whatever, I called mine SSH.  Add the line as shown.  If you have a different VM IP than 10.0.2.15 then you will want to use that.

Virtual Box Linux SSH Port Forward Setup

At this point you can run that Putty.exe that you downloaded earlier.  Enter 127.0.0.1 as your IP address and click “Open”.

Putty SSH Linux VirtualBox

At this point you should get a “login as:” prompt.  Enter your username and password and you should be connected.

Putty CentOS 7 VirtualBox

Now you can open up multiple terminal windows and run multiple programs at once.

If your terminal keeps timing out too early for you, you can change it so that it “stays alive” for a much longer time by doing something like this.

Open the sshd_config file.

# nano /etc/ssh/sshd_config

Add/change the following lines

ClientAliveInterval 30
TCPKeepAlive yes 
ClientAliveCountMax 99999

3/2/2015 Edit: Despite my changes, my terminal sessions were still getting disconnected.  For me the problem was with VirtualBox.  I had to download the beta version (4.3.23 r98674).  Then I could not launch any VMs because I would get a STATUS_OBJECT_NAME_NOT_FOUND error having to do with \Device\VBoxDrvStub.  I then uninstalled Windows Update KB3004394 and then reinstalled VirtualBox.  Now things seem better.  Hope that anybody having this problem finds this update helpful.

Windows guy learns linux centos network issues

So it was mandated by the “Linux Dudes” at work that they don’t really want Ubuntu installed in production.  RedHat is what they use.  The free version of RedHat is called CentOS.  CentOS is what I will be using going forward.  I don’t know enough to debate the pros and cons of one version of Linux over another but I am sure going to miss the nice graphic interface of Ubuntu.  For reflection, this is the CentOS interface.

CentOS Terminal

The first thing to note for CentOS other than the lack of graphical interface is that you manually have to setup a network adapter in the setup or it the OS won’t have any way of accessing the network/internet.

It was a super easy fix once I knew what I had left out.  Here’s some quick screenshots of how simple it is to install a network adapter in CentOS.

CentOS 7 Language Selection

CentOS 7 Add Network Adapter

CentOS 7 Enable Ethernet

CentOS 7 Network Connected

Windows guy learns linux hosts files

The hosts file is like a local DNS that takes priority over the real DNS.

The average person won’t understand what that means.  In other terms, the hosts file is a local map of “domain name” to an “IP address”.  For example, normally Google.com would resolve to something like 216.58.216.238.  If you go to http://216.58.216.238 you would see Google.  http://www.Google.com is the same as http://216.58.216.238

Now if you went into your host file and put an entry like…
    Google.com    204.79.197.200
Then Google would point to Bing instead.

If you set Google.com to point to 127.0.0.1 then in that case it would point to your local Apache server.

To create a map, we enter the URL and IP address in the hosts file that lives in the /etc directory.  (ie. /etc/hosts)

To modify the file we will use a text editor called nano.  It is much easier than some of the other options.   The hosts file is protected so we need to run as SUDO.  So get to a terminal (Ctrl+Alt+T in Ubuntu) and run the following command.

#sudo nano /etc/hosts

You then enter your root password and can then add the line.
    127.0.0.1 [TAB] Google.com

[TAB] is the tab key, not actually the word “[TAB]”

image

Hit Ctrl+O to save the file and then Ctrl+X to exit.

Now if you go to “http://google.com” (not http://www.google.com because we did not create an entry for that) you should see something like this…

image

Boom, all done.  Now you’re a hosts file expert.  Make sure to delete that line if you want to use Google again normally.

WINDOWS GUY take on LINUX webserver and mail server

Note: This article is using Ubuntu 14.04 but most will apply to other Linux versions.

So, we have learned how to install packages on Debian Linux and now want to configure mail and websites for this server.

Launch Terminal (Press Ctrl-Alt-T)

#sudo apt-get update
(This updates our local package list)

#sudo apt-get install lamp-server^
(This installs Apache, MySQL and PHP)
(Mind the caret (^) at the end.)

#sudo apt-get install mailutils
(This is for mailx)

#sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/default
(This copies the default Apache config file to a new file that will be used by Apache)

By running those 4 commands you have Apache, MySQL, PHP and Mailx installed.  To test apache you can open up your web browser and go to http://localhost to see this…
Ubuntu Apache Test

There are more things that go into setting up the mail server if you want to have it reside on the internet.  However if you are on a small work network, you can start sending test email immediately by running.

#mail –s “Some Subject” SomeWorkingEmail@Example.com

Some message…
Ctrl+D

Like this…
Test Linux mailx

If you try this above example on a home network, or if you aren’t setup to relay mail on your work network, this test won’t work.  There’s a lot more to setting up email but this is the most basic of installs.

windows guy take on linux root user and packages

Note: This post mentions Ubuntu root access but most of it is about Linux in general.

Linux and Windows differ when it comes to login accounts that have full access to the system.  In Windows,  when you add a user to the local “Administrators” group, that user has complete access to all files and settings.  For good or bad.  Linux doesn’t really do it that way.

In Linux there is a “Root” user.  This root user has full access to everything.  However, every Linux admin will yell that you shouldn’t log into a computer as “Root”.   Instead you login as your self, then run a program called “sudo”.  Sudo runs the next command as root.   If I run..
#sudo ls
I will first get a prompt for “Root” password.  I type that, hit enter and then ls runs.

image

Tangent: In Linux you run “Terminal” in Windows you run “Command” or “Command Line”.  Terminal command start with a pound sign, ie “#”.  So if you see… #sudo blahblahblah it means run “sudo blahblahblah” from the terminal/command line.

The next thing to note is that there are “packages” for a type of Linux called “Debian”.  Everything that gets installed in a “Debian Linux” is a package.  Ubuntu is built on top of Debian so software in Ubuntu is installed from packages.

Q: How do you install packages on Debian Linux?
A: You use APT (Advanced Package Tool)

APT, in simplest terms, lets you install, remove and update packages.

ex.
#sudo apt-get update

The above command runs “apt-get update” with “root” rights.
“apt-get update” downloads a list of all packages and updates the local lists.  So when you want to know what new packages are available or if there are updates to your existing packages, just run sudo apt-get update.

More examples of how to install packages to follow.

windows guy initial take on ubuntu

Ubuntu was super easy to install.  It was all graphical.  It had very little options and networking worked right out of the box.  I was impressed that Firefox even worked because I installed Ubuntu in VirtualBox at work which is behind a proxy server.  The only problem was this…

SNAGHTML8cf022d0

No, I did not shrink the image.  That is the only screen resolution available to me.  I had to do some searching to find out how to change that.  Here are the 2 options of changing adding more resolutions to Ubuntu on VirtualBox. 

Note: To “Search” you simply press the “Windows” key on your keyboard then start typing.

Add More Resolutions to Ubuntu on VirtualBox

Search and run “xdiagnose”
Enable
- Extra Graphics Debug Messages
- Display boot messages
- Enable automatic crash bug reporting
- Restart

or..
Search and run Software & Updates
Click “Additional Drivers” tab
Select “Using x86 virtualization solution…”
Apply Changes

I did “both” of the above options.  According the my searches either would have worked.  Regardless I now have more resolutions to play with.

It is worth noting that Linux guys and Windows guys have a point of contention with issues like this.  Windows guys want this “Basic” stuff just to work right out of the box.  Linux guys don’t seem to mind searching for the answers for a few minutes.  It’s interesting to note, that while this is a minor issue, it is very disheartening to Windows people.  This is probably because there’s so much “good stuff” to learn in Linux that they give up when walls are thrown up at them even before they get into the real guts.

windows guy Learns Linux

The last time I really played around with Linux was back in college.  I wasn’t remotely dangerous with it.  Fast forward to present day where I have a new obsession with getting Request Tracker up and running.

The internet community believes that Request Tracker (or RT) is the hands down best issue tracking system for the money.  (It is free)  However RT runs only on Linux and Perl.  If it was Linux and PHP or Windows and Perl then I probably wouldn’t feel the need to learn Linux.  Unfortunately for me that is not the case and I am going to have to beat-up my brain cells and come to terms with figuring out how to get things done in Linux. 

There’s going to be back tracking, skipping around and general “whining”, but this is going to serve me well in learning the overall process.

Going forward, the only thing that might stay the same is my use of VirtualBox (running on Windows) to host things.   Virtual box is free software that lets you run virtual computers called Virtual Machines or VM’s on your computer.  It’s like having one or more computers running inside your computer.

I probably won’t get into describing how to create VM’s or download (or install) Linux from ISO’s.   This will be more about figuring out how to do “Setup” after Linux is installed.

Cheers!

Stolen Chase Card Drama

Stolen Chase Credit Card

Chase really needs to stop the advertising push and work on security and customer service.  Let me explain…

Last Wednesday I receive a 7:58 am text message from Chase asking me if I charge $1.00 to a “Specialty Retailer”.  I respond to it stating “No”.  They respond.  “We will call you ASAP”.  Chase’s “ASAP” is 1,445 minutes later (Over 24 hours).  I can’t pick up at the time but they are nice enough to automatically call  me back 55 minutes after that.  After me asking several times “If anybody is there” an automated message comes on the line and asks me to hold for an available person.  5 minutes later, they disconnect me stating “Nobody is available to talk”.  Odd… you called me Chase!  Why would you call somebody when you can’t talk?

They have never since used this number but have called my work phone numerous times during the weekend when nobody is in the building much less in my cubicle.

So today I call Chase back, they want to know your credit card number, mother’s maiden name, last 4 digits of my social security number and my date of birth.  I gave them everything but my DOB.  This seems sketchy.  I start telling the above drama to a women, Lindsey I think was the name, who is taken aback that I am not playing according to the script she is reading.

At this point, utter panic must have stricken Chase and some big executive hits the panic button disconnecting me.  Luckily another automated message comes on saying “If you were disconnected in error go F yourself call back.”  Oh thanks Chase.

Just called back.  Got a women named “Sugar”.  This should be just great…

Stolen Chase Credit Card Number

Shoemoney throwback

Just a fun note… over 8 years ago ShoeMoney had a contest to see if anybody could outrank a site for “ShoeMoney”.  I totally forgot that I came in 5th for MSN.  The blog page is still there http://shoemoney-contest.blogspot.com/

It wasn’t a big thing.  I won $65.  The methods I used probably don’t work that well any more but it was fun.

You can follow the contest here…

http://www.shoemoney.com/2006/05/21/can-you-outrank-me-for-shoemoney-i-got-1000-that-says-you-cant

http://www.shoemoney.com/2006/06/01/shoemoney-contest-really-getting-interesting

http://www.shoemoney.com/2006/06/01/ok-i-was-trying-to-play-it-off

http://www.shoemoney.com/2006/06/02/mini-seo-contests-end-today

http://www.shoemoney.com/2006/06/02/shoemoney-winners-are

Geiger, you don't know me! (Yet)

Web Analytics