2017-02-04

Python / Linux / VMware 2: Expanding CentOS's Minimal Install

I'm trying to expand my knowledge of Linux and Python. I'm taking a "start from scratch" approach, building some virtual environments at home, and documenting every step along the way. This is the second of five posts capturing those steps; the end-state is PyCharm IDE, Python 3.6, CentOS 7.3, VMware Workstation Pro 12 running on Windows 10.

Part 1: Installing VMware and CentOS
This is Part 2: Expanding CentOS's Minimal Install
Part 3: Installing Python 3.6
Part 4: Linking PyCharm to Github via SSH
Part 5: Running through Git-It again, this time with PyCharm

At this point, I'm working with a CentOS 7 virtual machine based on a Minimal Install. I have Internet connectivity, and have used yum update to make sure that all currently installed packages are at their latest versions.

Today I'm going to install the things I need to get started working in Python 3.6 in a graphical IDE. I could have taken care of all of this by using something other than the Minimal Install when I installed CentOS, but where's the fun in that?

Linux-based systems use a Package Manager to find and install software. CentOS uses yum so that's what I'll be playing with today. On Debian and Ubuntu, apt or apt-get are more common; here is a good reference if you're more familiar with those than with yum.

Note that the next few sections explain my thought process as I figured out what I'd need to install (so it's easier for folks to tell me where I went wrong, if they spot something). If you want to skip straight to the actual install steps, then go to the Putting it all together section, further down the page.

Figuring out what to install: nslookup is inside of package bind-utils

When I had finished the preliminary installation of CentOS, before I tried to ping an IP address, I had first tried to use nslookup - and discovered that it is not included in the Minimal Install. That's a tool I will want to have available, but I want to find out a little bit more.

First I'm going to see what package contains nslookup by using yum provides nslookup.
$ yum provides nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.lax.hugeserver.com
 * extras: centos.eecs.wsu.edu
 * updates: mirror.web-ster.com
base/7/x86_64/filelists_db
extras/7/x86_64/filelists_db
updates/7/x86_64/filelists_db
32:bind-utils-9.9.4-37.el7.x86_64 : Utilities for querying DNS name servers
Repo        : base
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.9.4-38.el7_3.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.9.4-37.el7_3.1.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup
$

Okay, so it's inside of bind-utils.

Figuring out what to install: package bind-utils is inside of group base

I should decide whether to install only bind-utils, or perhaps the entire group that contains it; so I need to figure out what group contains it. To do that I need to install the list-data plugin for yum (which will come in handy later, too).
$ sudo yum -y install yum-plugin-list-data

$ yum -C list-groups bind-utils
Loaded plugins: fastestmirror, list-data
==================== Available Packages ===================
Base      1 (100%)
list-groups done
$

Interesting - so it's in the group called Base. With a name like that I would have expected it to be part of the Minimal Install. I wonder what groups were installed as part of the Minimal Install? I wonder what other things are included in the Base group, that I might be missing?

Okay, let's see what was packages were included as part of the base image.
$ yum group list installed hidden
Loaded plugins: fastestmirror, list-data
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
 * base: mirror.lax.hugeserver.com
 * extras: centos.eecs.wsu.edu
 * updates: mirror.web-ster.com
Warning: no environments/groups match: installed, hidden
$

Oops. I got no meaningful results, but I did get an error. After a bit of research, it looks like this is a known issue. It was listed as a bug for years and then killed very recently as "not a bug" - but that's fine, at least I know that this doesn't mean there's something wrong with my system yet.

I'm going to use sudo, follow the suggestion in the error, and run yum groups mark convert
$ sudo yum groups mark convert
Loaded plugins: fastestmirror, list-data
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
 * base: mirror.lax.hugeserver.com
 * extras: centos.eecs.wsu.edu
 * updates: cendos.gbeservers.com
Converted old style groups to objects.
$

Well that's better. Now let's try looking at currently installed groups again.
$ yum group list installed hidden
Loaded plugins: fastestmirror, list-data
Loading mirror speeds from cached hostfile
 * base: mirror.lax.hugeserver.com
 * extras: centos.eecs.wsu.edu
 * updates: mirror.web-ster.com
Installed Groups:
   Common NetworkManager submodules
   Core
   E-mail Server
   Network Infrastructure Server
   Security Tools
   System Administration Tools
Done
$

So I've confirmed that the Base group really wasn't installed as part of CentOS's Minimal Install. Now I want to see, apart from bind-utils (which provides nslookup) what other packages are included in the Base group?

I'll get this with yum group info base, but a quick note. the plus sign ('+') in front of packages in the list below indicates, according to man yum, that the "package isn't installed, but will be the next time you run 'yum upgrade' or 'yum group upgrade foo'". In the list below, then, everything with a plus sign is currently missing, and would be added if the Base group were installed. I could filter this to show only the packages that are currently missing (making the list shorter) by using yum group info base | egrep '\+|\:', but I'm interested in the entire output so I'll leave that out.
$ yum group info base
Loaded plugins: fastestmirror, list-data
Loading mirror speeds from cached hostfile
 * base: mirrors.sonic.net
 * extras: repos.lax.quadranet.com
 * updates: repos.forethought.net

Group: Base
 Group-Id: base
 Description: The basic installation of CentOS Linux.
 Mandatory Packages:
    acl
   +at
   +attr
    authconfig
   +bc
   +bind-utils
   +centos-indexhtml
    cpio
   +crda
    crontabs
   +cyrus-sasl-plain
    dbus
   +ed
    file
    logrotate
   +lsof
    man-db
   +net-tools
   +ntsysv
    pciutils
   +psacct
   +quota
   +setserial
   +traceroute
   +usb_modeswitch
 Default Packages:
   +abrt-addon-ccpp
   +abrt-addon-python
   +abrt-cli
   +abrt-console-notification
   +bash-completion
   +blktrace
   +bridge-utils
   +bzip2
    chrony
   +cryptsetup
   +dmraid
   +dosfstools
    ethtool
   +fprintd-pam
    gnupg2
   +hunspell
   +hunspell-en
   +kpatch
   +ledmon
    libaio
   +libreport-plugin-mailx
   +libstoragemgmt
    lvm2
   +man-pages
   +man-pages-overrides
   +mdadm
   +mlocate
   +mtr
   +nano
   +ntpdate
   +pinfo
    plymouth
   +pm-utils
   +rdate
   +rfkill
   +rng-tools
   +rsync
   +scl-utils
   +setuptool
   +smartmontools
   +sos
   +sssd-client
   +strace
   +sysstat
   +systemtap-runtime
   +tcpdump
   +tcsh
    teamd
   +rng-tools
   +rsync
   +scl-utils
   +setuptool
   +smartmontools
   +sos
   +sssd-client
   +strace
   +sysstat
   +systemtap-runtime
   +tcpdump
   +tcsh
    teamd
   +time
   +unzip
   +usbutils
   +vim-enhanced
    virt-what
   +wget
    which
   +words
   +xfsdump
    xz
   +yum-langpacks
   +yum-utils
   +zip
 Optional Packages:
   PyPAM
   acpid
   audispd-plugins
   augeas
   brltty
   ceph-common
   cryptsetup-reencrypt
   device-mapper-persistent-data
   dos2unix
   dumpet
   genisoimage
   gpm
   i2c-tools
   kabi-yum-plugins
   libatomic
   libcgroup
   libcgroup-tools
   libitm
   libstoragemgmt-netapp-plugin
   libstoragemgmt-nstor-plugin
   libstoragemgmt-smis-plugin
   libstoragemgmt-targetd-plugin
   libstoragemgmt-udev
   linuxptp
   logwatch
   mkbootdisk
   mtools
   ncurses-term
   ntp
   oddjob
   pax
   prelink
   python-volume_key
   redhat-lsb-core
   redhat-upgrade-dracut
   redhat-upgrade-tool
   rsyslog-gnutls
   rsyslog-gssapi
   rsyslog-relp
   sgpio
   sox
   squashfs-tools
   star
   tmpwatch
   udftools
   uuidd
   volume_key
   wodim
   x86info
   yum-plugin-aliases
   yum-plugin-changelog
   yum-plugin-tmprepo
   yum-plugin-verify
   yum-plugin-versionlock
   zsh
 Conditional Packages:
   +rubygem-abrt
$

Looking through this list, there are quite a few packages that I'm going to want to have installed, so I'm going to want to install this group.

Figuring out what to install: group base is inside of environment group GNOME Desktop

Before I do that, though - I wonder which Environment Groups include this group? The Minimal Install that I selected in the installation GUI was just a way of specifying the Environment Group that I wanted to install. I'm going to see which Environment Groups actually do include the Base group as a default.
$ yum group info '*' | egrep -B 1 'Environment Group|\+base' | egrep '\:|base'
Environment Group: Compute Node
 Mandatory Groups:
   +base
Environment Group: GNOME Desktop
 Mandatory Groups:
   +base
Environment Group: File and Print Server
 Mandatory Groups:
   +base
Environment Group: Infrastructure Server
 Mandatory Groups:
   +base
Environment Group: Development and Creative Workstation
 Mandatory Groups:
   +base
Environment Group: Basic Web Server
 Mandatory Groups:
   +base
Environment Group: Server with GUI
 Mandatory Groups:
   +base
Environment Group: KDE Plasma Workspaces
 Mandatory Groups:
   +base
Environment Group: Virtualization Host
 Mandatory Groups:
   +base
Environment Group: Minimal Install
$

Well, okay. One of the things I want to do anyhow is install GNOME. Since the GNOME Desktop Environment Group includes the base group anyway, I'll just install that Environment Group.

Figuring out what to install: VMware tools - package or group?

The next thing I'll want to think about is VMware tools. A frequent reminder that I received during installation, and am still receiving now as I use the virtual machine, is to install VMware Tools which "enables many features and improves mouse movement, video and performance." Google tells me that VMware Tools itself has been open-sourced, and now the package is called open-vm-tools. Again, I'd like to know if that's part of a group, so:
$ yum -C list-groups open-vm-tools
Loaded plugins: fastestmirror, list-data
==================== Available Packages ====================
Guest Agents                           1 ( 50%)
VMware platform specific packages      1 ( 50%)
list-groups done
$

Isn't that convenient - and I'm running VMware! What else is in that group?
$ yum group info "VMware platform specific packages"
Loaded plugins: fastestmirror, list-data
Loading mirror speeds from cached hostfile
 * base: mirrors.sonic.net
 * extras: repos.lax.quadranet.com
 * updates: repos.forethought.net

Group: VMware platform specific packages
 Group-Id: platform-vmware
 Description: Virtualization utilities and drivers for VMware
 Default Packages:
   +open-vm-tools
   +open-vm-tools-desktop
$

Reading online about open-vm-tools-desktop, it looks like I'm going to want that too - copy/paste between my virtual machines and my host, for example, is something I'd like to have. So, I'll want to install the platform-vmware group.

Figuring out what to install: group Development Tools and other packages

Finally, I wanted to first do a bit of research to see if there are any tips or avoidable pitfalls that smarter folks have already discovered - in particular because there isn't an easy installation via yum of Python 3.6.

The Python site itself has some useful information in general, but nothing that speaks to other potential dependencies or tips. However, just about everything else I found pretty much agreed that the group Development Tools is a must-have, and that it should be in place before installing Python - so I'll add that to my list.

There are quite a few other packages that are mentioned elsewhere as "install this before you install Python". Only a few of these, though, appear to make nearly every list - so I'm going to install those, even though I'm not entirely sure if/when/how I'll need them. Here are those packages, and what yum info <package> has to say about them:
  • zlib-develThe zlib-devel package contains the header files and libraries needed to develop programs that use the zlib compression and decompression library.
  • bzip2-develHeader files and a library of bzip2 functions, for developing apps which will use the library.
  • openssl-develOpenSSL is a toolkit for supporting cryptography. The openssl-devel package contains include files needed to develop applications which support various cryptographic algorithms and protocols.
  • sqlite-develThis package contains the header files and development documentation for sqlite. If you like to develop programs using sqlite, you will need to install sqlite-devel.
  • readline-develThe Readline library provides a set of functions that allow users to edit typed command lines. If you want to develop programs that will use the readline library, you need to have the readline-devel package installed. You also need to have the readline package installed.
  • tk-develWhen paired with the Tcl scripting language, Tk provides a fast and powerful way to create cross-platform GUI applications.

One last thing: GNOME Shell Extensions

There's one more package that is worth installing now (I discovered this later on).

At https://extensions.gnome.org there are lots of different extensions that can be used to make tweaks to the behavior of the GNOME desktop. A couple of these, in fact, I'll want to have included in my snapshot of a base Linux GUI. These won't work, though - you can't install them through the site, nor can you add them through the GUI - unless you've installed the base-level GNOME plugin to support them.

This plugin is called gnome-shell-browser-plugin and is available via yum.

Putting it all together: installing the software

Before you install the packages we've identified, let's take a quick step to resolve a known bug in yum. This fix isn't something that will impact you immediately, but it's quick and easy.
$ sudo yum groups mark convert
Loaded plugins: fastestmirror, list-data
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
 * base: mirror.lax.hugeserver.com
 * extras: centos.eecs.wsu.edu
 * updates: cendos.gbeservers.com
Converted old style groups to objects.
$
Now it's time to install all of the packages and groups that we've discovered along the way. With yum install, you can represent groups by beginning their name with @ (like @development), and environment groups by beginning their name with @^ (like @^gnome-desktop-environment). This is convenient because it means you can use one single command line for all installations, instead of needing to separate the installations of groups from regular packages.
$ sudo yum -y install yum-plugin-list-data zlib-devel bzip2-devel openssl-devel sqlite-devel readline-devel tk-devel gnome-shell-browser-plugin @platform-vmware @development @^gnome-desktop-environment
 ## lots of data will display here. Yum will first resolve all dependencies,
 ## then it will download all packages required directly and those required
 ## indirectly (because of dependencies). Then it will install them all,
 ## verify them all, and then finally spit out a list of everything it did.

Complete!
$

Once these installations have completed, change the default systemd target so that it boots into the graphical interface (what used to be called runlevel 5), so that GNOME will load by default on startup.
$ sudo systemctl set-default graphical.target
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target.
$

Reboot the machine.
$ shutdown -r now

You'll need to accept a license agreement the first time the graphical interface comes up, and then you'll be presented with the login screen.

As a one-time event after this first login, you'll answer a few questions about your language and keyboard preferences, and then have the option to link your operating system with online accounts such as Google. Once you've worked through these, you'll be presented with the "Getting Started" screen of GNOME Help, but at this point you're essentially at your desktop.

One last bit of housekeeping before we call this complete. On the desktop, you might see an icon for the installation source media - this is the ISO that you provided from which Linux was installed. If you do, right-click on this and select Eject from the context menu which appears.

And that's it! You now have a Linux host with a graphical desktop environment, ready to install and start using Python (the next section).

Add GNOME extensions

The last thing we're going to do is add a pair of extensions to GNOME. They are individually helpful, but this is also about getting familiar with GNOME extensions in general.

On your CentOS desktop, in the Top Bar, select Applications / Utilities / Tweak Tool. In the application that launches, select Extensions on the left, and then click the Get more extensions link on the right.

This will launch your default web browser and take you to the GNOME Shell Extensions site. Use the search box to locate system-monitor by Cerin, and select it.

On the following page, click on the slider in the upper right to change it from OFF to ON. In the window that immediately appears, select Install to enable the extension.

At this point you should see system-monitor running in your Top Bar. You can click on any part of it for an expanded window of information about the performance of your virtual machine.

Use this same approach to install the extension Dash to Dock by michele_g, then close Firefox and return to the Extensions window that you should already have open (from Tweak Tool).

Click on the gear icon next to the now-active Dash to Dock extension to bring up its configuration options. Click on the gear icon next to Intelligent autohide. On the screen that follows, clear the checkbox for Push to show, and then close the window.

Now that you've added a pair of useful extensions, and have changed a configuration setting on one of them, take a moment to look through the rest of their settings. This will help you familiarize yourself a bit more with what those two extensions can do. See if there is anything else you'd like to tune about those two extensions. For me, I like to to tune Dash to Dock a bit further by shrinking the dash, and by turning opacity down to about 40%.

Take another snapshot

Back in the VMware browser, right-click on the Virtual Machine to save another snapshot. Don't forget this step!

As you continue to play with the operating system and with your Python installation, this will give you a place to come back to if things get too far sideways.

"Save early, save often" works for video games and word processor documents - it's great for virtual machines too.

Part 1: Installing VMware and CentOS
That was Part 2: Expanding CentOS's Minimal Install
Part 3: Installing Python 3.6
Part 4: Linking PyCharm to Github via SSH
Part 5: Running through Git-It again, this time with PyCharm

No comments:

Post a Comment