PR

FreeBSD Application Maintenance Part 1

FreeBSD
記事内に広告が含まれています。

The original Japanese version is available here.

The very lazy Golden Week in Japan has passed as if it never existed, and we are back to our usual routine tasks. Before we have Golden Week in Japan, Western people already had Easter holidays before our golden week. Every evening I have a short meeting with my European colleagues in their morning, and I can tell what day it is by the tone of their voices.

On Monday ….

  • Japan: How are you doing today ?
  • Europe: So so… everything is blue…. 🙁 How are you then ?
  • J: So so too.
  • E: That’s good. I have no idea where to start …. Good luck !
  • J: You too..

On Friday….

  • J: How are you doing today ?
  • E: Ah, everything is fine with me 🙂 How are you then ?
  • J: So so..
  • E: Ah, OK. You are already in your weekend earlier than us, right ? That’s so nice. Just let us know if you have something you want us to do.. Have a nice weekend. Talk to you next week then !
  • J: Ah, all right. You too then.

It seems that all they think about is taking holidays. Still, IT keeps up and running well 🙂

Well, it has already past several weeks since we installed our FreeBSD, and there are probably newer versions of the packages available in the community. So, let’s try to maintain our software.

There are two main types of applications available on FreeBSD. They are packages and ports. Packages are software that is compiled by package maintainers and placed on the server as a package. Therefore, you can use the software simply by downloading it and extracting it onto your file system. Ports, on the other hand, copy a ports tree, which is the source of the packages, to your local system and make the source code compiled and available on your system. Basically, the software available in packages and ports is the same, but ports are much more flexible than packages. This is because packages are basically available as binary files with default compile options or combinations of typical compile options, while Ports can be compiled from source code by changing the compile options to suit your own preferences and needs. Therefore, it is possible to create an application by adding functionality that is missing in a package or by removing unnecessary functionality in a package. Also, while packages are basically unavailable until a maintainer makes them available, new versions of Ports are sometimes available earlier than packages. This may sound like you can use either packages or ports without any problems. but with Ports, you need to do what the people who create the packages for you are doing. With a package, all you need to do is install the application to run, but with Ports, you need to create the tools necessary to compile it from the source code. Well, we can say it is hassle too much. If you don’t read the source code or don’t care much about being up-to-date with the latest version, you can just use the package. Here, We will try to maintain our systems with packages and with ports.

Packages

Do you remember we installed many packages when we installed our FreeBSD ? Packages are handled by the pkg command, which is present as /usr/sbin/pkg immediately after the OS installation. However, if you try to install other packages with the pkg command, the package version of the pkg command will be installed first. Then, when the packaged pkg is installed, there will be two pkg commands on the file system.

It seems they are the same except fle size.

/usr/sbin/pkg is neither a hard link nor a symbolic link. What it does, then, is to determine if /usr/local/sbin/pkg is present, and if not, then install the packaged version of the pkg command, and if present, to do the same as the pkg version of pkg does. Let’s try a little experiment. Rename the package version of pkg command to a different name. If you then run /usr/sbin/pkg, it will try to download the packaged version of pkg. If you want to know how exactly it works, you can find the source code for the /usr/sbin/pkg command in the /usr/src/usr.sbin/pkg directory.

Do you remember we have installed the “src” when we install the operating syste, ? It is the source code of the operating system.

First, let’s check up the package version of pkg command. pkg command with the “version” option will output a list.

pkg version

If you look at the output, you will see the package name followed by “=”. This means that it is the latest version. Are they all up-to-date? Actually, there is a way to find out, by adding a match condition to the pkg version.

which one is old ?

If we add a condition and run it, it will tell us that only one of the packages is out of date. Let’s replace the package that is considered out-of-date with a newer package. “pkg upgrade” will replace it with the newer package.

It is super easy.

So is this update complete? First, let’s find out what “lmdb” is.

What is it ?

This information indicates that it is an openldap shared library. If it is a shared library, there must be a program that loads and executes it. Let’s try to remove this package. The pkg command attempt to remove other packages which can’t work without it too.

Too primitive?

The lmdb package appears to be used for samba. What? You mean this is the only way to do it? The correct way to do it is like this..

This command lists packages that use this shared library liblmdb.so.0. As a result, it seems that samba is still using it. So, we need restart samba to load the new version of library file correctly.

Restarting samba service.

This is done. But is everything up to date? Actually, /etc/pkg/FreeBSD.conf gives you a hint.

quarterly ? Once every 3 months.

The “url” specified is quarterly. So, these packages are created every three months. What the most company money is spent on IT these days is security.And three months is far too long to wait for a security hole to be plugged. Take a look at this pkg.FreeBSD.org site.

If you look at this site, you will see four directories. One of them is the directory specified in this file. release_0 and release_1 are supposed to be packages at some point. The most notable one is the “latest” directory. It seems to contain the latest packages. Let’s modify the file and check it out.

We want the latest version !

Now let’s get the packages up-to-date again. You’ll find more new packages than before.

Updating …

Delete items that have been updated or installed as dependencies but are no longer needed or outdated.

Removing …

I finally updated a ports tree locally and saw the difference between it and the package…

That’s all !

I checked the total number of packages installed and found there are 83 packages installed. I guess the question is how to look at the fact that only one out of these 83 packages was not up-to-date. Maybe this package will be up-to-date in the next few days. Next time, let’s try maintenance by ports system. Sorry that this is not something related to software maintenance. VMware player does not have an option to take a snapshot anywhere in the menu. That’s true. We can’t take snapshots in VMware Player. Hypervisors such as vSphere can easily take a snapshot and then we can revert the virtual machine to the point in time of the snapshot very easily. So what does VMware Player do? Simple, just copy the virtual machine’s folder in Windows and you’re good to go. This is not a company service, so on a personal level it is more than enough 🙂

Advertisement below


コメント