The first couple of blog posts were aimed at giving you some essential basic skills, building up your confidence to explore a Linux installation before you get your teeth into the actual day-to-day stuff.
As a DevOps engineer, one of the key things that you will be doing includes installing / deploying software and configuring it - so, it’s important that you understand how these tasks are achieved.
At this stage, I could introduce you to some DevOps tooling that you would typically use, but I’m not. Mostly because I need you to feel the pain that I went through so that you can appreciate the benefits of tools like puppet, ansible and even containerisation (Docker).
What’s your flavour?
There are an abundance of Linux flavours (
distributions) from Alpine, to Ubuntu, to RedHat. Which do you use? In my opinion, it’s not that important at this stage. The differences between the various Linux distributions will be very subtle to you at this point.
What is important is that you are aware that different distributions of Linux have different package repositories, and different commands to install, but they essentially do the same thing:
- Pull down packaged software from a central source
- Install it and any supplementary files such as start/shutdown & management scripts as well documentation
“What is a package repository?” I hear you say. Package repositories are essentially a centralised store of pre-compiled, pre-built and pre-tested software which optionally may include such things as configuration files, management & start-up/shutdown scripts and documentation - basically, everything that you need to start using the desired software.
Benefits of using a Package Manager
As a rule of thumb, always install software from a reputable source using your chosen OS’s default package manager. Package managers are your client(s) to package repositories, they understand where to look for software, how to install it, upgrade it, and remove it.
Installing software using the default package manager will make your life easier as they are:
- Tried and tested
- Repeatable and consistent
- Easily maintainable
- Standardised installation and configuration
- Have dependency management built-in; if software “a” requires software “x, y and z” then the package manager will install the required software and appropriate versions
If you can avoid it, do not build and install from source as this will give you a maintenance nightmare further down the line. For example (using Ubuntu’s apt
package manager) which would you prefer to perform:
- sudo apt upgrade nginx, or
- Find and download nginx source files, unpack it, read the instructions to build, configure the build, build and install it
Thought you might prefer the first option! If you prefer the latter, then imagine doing this for tens of machines! Still prefer option b?
Let the Package Manager do the hard work for you
Using package managers to install software is quick and reliable, you can install an application in seconds and have it configured, up and running in minutes.
On a Ubuntu system, you can have nginx up and running with essentially two commands:
$ sudo apt install nginx
$ sudo systemctl nginx start
To upgrade it,
$ apt upgrade nginx
$ sudo systemctl nginx restart
To remove it,
$ sudo systemctl nginx stop
$ sudo apt remove nginx
How simple is that? Whichever OS you use, its package manager will allow you to install software as easily as this.
The package manager client application will generally allow you to:
- Search for packages to install
- Install specific versions of software
- List what other applications have also been installed by it
- Lookup information, such as dependencies as well as where files are installed
The latter is particularly useful post-install, as in some cases, you will want to know where files have been installed to and where the application’s configuration files are.
So, don’t forget to RTFM (man) your package manager client software :-)
Configuring applications
Following an installation of an application, you may want to configure it. Each application will have its own specific configuration to it so there isn’t really one magic rule other than to RTFM.
It’s a time consuming activity, but reading the manual can prove fruitful and potentially save you lots of time further down the line.
Be armed with:
As a DevOps engineer, one of the many things you’ll be doing is installing and configuring software so it’s important to get to grips with the tools that will enable you to do this quickly, accurately and consistently - and using a package manager certainly simplifies this task. Shy away from installing software from source wherever you can as quite often, it is not available as it’s not supported on your particular OS and/or hardware configuration.
The only scenario where you will have to consider installing software from source is with software developed by you and/or your organisation. How this scenario can be tackled is beyond the scope of this blog, however it will be covered in a future blog where I discuss containerisation, so keep an eye out for that post :-)