CentOS 7 – Minimal to GUI

I’ve been working on tutorials for Chef and Maven and I’ve been using AWS EC2 instances.  The problem is, port 22 (SSH) is blocked at my work.  So I decided to create a local virtual machine and put CentOS 7 on it to mimic what I was doing in AWS.  I’ve been looking for a reason to get more hands-on with Linux anyway, so why not.

I am using CentOS 7 because it is a clone of Red Hat and I was using the Red Hat instance in AWS.

My internet connection is a little on the slow side at work.  I decided to download the Minimal ISO for CentOS 7.  After installing it on a virtual machine, I logged in and went down an alternate path.

I started by executing some commands that I remember from studying for the Linux+ certification (which I’ve only scratch the surface of), such as ‘yum update’…And that’s when I realized I don’t have an internet connection.

I first checked my VirtualBox settings and there was a network connection attached to the VM.  I attempted to run ifconfig and I learned that it is not part of the minimal version of CentOS 7.  A quick Google search revealed the command ip addr, but that still doesn’t setup my network connection.

So back to Google and I found this handy article.  Basically,

  • Run nmcli d to get a list of network interfaces. 
  • Run nmtui, edit the appropriate network interface
  • Make sure IPv4 is set to ‘Automatic’ and tick ‘Automatically connect’
  • Exit nmtui
  • Run service network restart

Now with my Ethernet adapter connected, I could do some damage.  I executed yum update again and this time it worked!  

Then I decided I wanted to install a GUI just to do it.

yum groupinstall "GNOME Desktop" "Graphical Administration Tools"

After a reboot, I was back at the login prompt.  No GUI.  I was getting ready to log in and remembered from my studying that after installing GUI, you have tell Linux that is what you want use when you boot up the machine.  You do that by specifying the runlevel (or target) you want to use.  I want to use runlevel5, which is runlevel3 (Multi-User Mode with Networking) with a display manager (X11).  This command will set the runlevel (target) for us:

ln -sf /lib/systemd/system/runlevel.target /etc/systemd/system/default.target

After that, reboot and the system will come up in graphical mode.  

Now, I’m sure there are other things missing due to this initially being a minimal installation.  But I’m going to try to setup either something for Chef or Maven and find out what else I have to do to get this working.  

It’s been a while…again

Once again, it’s been a while since the last time it’s been a while.

A lot has happened since the last time I tried to start blogging again.  I have (again) realized that I want to capture the things that I have learned so I can reference them later.  That, and of course share with others that may be interested.

Here recently, however, I have also been thinking about how I can use this site as a way to document some of the things my kids and I do as well.  I mean, how cool/embarrassing would it be to look back on things we’ve posted here 1…2…5…10+ years later?

So a few things I have rattling around in my head right now…

Cooking and recipes
Model Rockets with my son
Getting a GoPro and strapping it to the Model Rockets
Getting a nice Drone and going exploring

Those are just a few idea.  But the main thing is getting back on here to blog about it.  We’ll see what happens this time around, but I think I have a better motivator.

Linux From Scratch – Video Walkthrough by SudoTech

Either the LinuxFromScratch book is making some aggressive assumptions about my basic Linux knowledge, or my Linux abilities aren’t quite as good as I thought.  Unfortunately, its probably the latter.

Long story short, I came across this video series on YouTube put together by user SudoTech.

He walks through the LFS  7.10 book pretty much step-by-step.  The videos also fill in some of the assumption gaps made by the book.  In my case, reminded me that “oh yeah, I knew that.”

the videos are a little dated, but still applicable.  As stated, SudoTech is using version 7.10 of the LFS book in his videos.  I’m following along with version 8.1.  The only differences so far are package versions and a few additional packages.

Pretty good set of videos that have helped me fill the knowledge gaps in my basic Linux while creating my own version of Linux.

Linux From Scratch


Source: Welcome to Linux From Scratch!

While searching for tutorials for brushing up on my Linux skills, I stumbled upon this site.  LinuxFromScratch.org is a site that publishes a (pretty much) step-by-step guide for creating your own version of Linux.

Why would someone want to create their own version of Linux from scratch?  Well, the site does a pretty good job of answering that.
From the site:

Why would I want an LFS system?

Many wonder why they should go through the hassle of building a Linux system from scratch when they could just download an existing Linux distribution. However, there are several benefits of building LFS. Consider the following:

LFS teaches people how a Linux system works internally
Building LFS teaches you about all that makes Linux tick, how things work together and depend on each other. And most importantly, how to customize it to your own tastes and needs.

Building LFS produces a very compact Linux system
When you install a regular distribution, you often end up installing a lot of programs that you would probably never use. They’re just sitting there taking up (precious) disk space. It’s not hard to get an LFS system installed under 100 MB. Does that still sound like a lot? A few of us have been working on creating a very small embedded LFS system. We installed a system that was just enough to run the Apache web server; total disk space usage was approximately 8 MB. With further stripping, that can be brought down to 5 MB or less. Try that with a regular distribution.

LFS is extremely flexible
Building LFS could be compared to a finished house. LFS will give you the skeleton of a house, but it’s up to you to install plumbing, electrical outlets, kitchen, bath, wallpaper, etc. You have the ability to turn it into whatever type of system you need it to be, customized completely for you.

LFS offers you added security
You will compile the entire system from source, thus allowing you to audit everything, if you wish to do so, and apply all the security patches you want or need to apply. You don’t have to wait for someone else to provide a new binary package that (hopefully) fixes a security hole. Often, you never truly know whether a security hole is fixed or not unless you do it yourself.

 

I am currently on my second try of creating an LFS system.  The first time through, I initiated a ‘make’ command instead of a ‘mkdir’ and the system ran the make…but I had no idea what it created, nor could I figure out how to recover from it.  So, I reformatted the partition and scrolled back to the beginning of the guide.

While it is a lengthy process, I would recommend trying this yourself if you really want to learn about Linux.  If you actually read the guide and look up the things you don’t know, you can learn a lot.  Oh, and the guide makes some assumptions on your basic knowledge of Linux.  So you have to come to the table with a little up front knowledge or do a little homework on your end just to get going.  But I don’t view that as a deterrent, just more incentive to really learn about Linux!

 

RegEx101: Online regex tester and debugger

Regex101 allows you to create, debug, test and have your expressions explained for PHP, PCRE, Python, Golang and JavaScript. The website also features a community where you can share useful expressions.

Source: Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript

Found this handy tool a while back when I was trying to create a .runsettings file for defining Code Coverage analysis of builds.

In TFS2015, a .runsettings is used to define what is included/excluded in the code coverage analysis.  You can specify assembly file paths, names of functions, attributes on code elements, etc.  The way you specify those things is by using regular expressions.

Until that day, I had only heard about regular expressions.
I had no idea how to use them…nor how to create one properly.

Then I find RegEx101.  This site not only helped me to create the regular expressions I needed, but explained them along the way.  On top of that, I was able to create test cases for my expressions right on the same page.  So as I wrote a more complex expression, I could test it often and make sure I wasn’t regressing while adding complexity.

Great tool with lots of great information to quickly get you up to speed on creating regular expressions.