我在 Linux 上的第一步

这篇文章是英文的,你可以用谷歌翻译它点击这里

If you are getting started on tech or have been in the industry for years, you may be thinking to try Linux as your development environment. Or even just out of curiosity. As the joke says, clouds are mostly built of Linux servers. And not only the cloud, there is so much software that is optimized to run on Linux first.

Many developers work on Windows and stay there for the rest of their careers. There is nothing wrong with that, Windows supports many development tools. It is the natural choice when developing C# or .Net software. The OS (operating system) is also not an issue most of the time when developing for the JVM.

Other reasons I have heard before for programming in Windows include playing videogames on PC, and refusing to change to avoid any extra setup. Or it could just be that is a hassle to learn from scratch how to do basic operations on the computer, let alone having the same proficiency.

Statistically Windows is the OS used the least as a programming platform for all the team members I have worked with during my career. However that doesn't reflect global market data, where Windows is cited to be used the most. Funny enough, I used Windows for a few years not long ago, although only as the host for a Linux virtual machine, more on that later.

By far, the favorite OS in the companies I have worked for has been macOS. This is the OS I use professionally at the time of writing this article, again as a host of a Linux machine. When created, macOS was based on Unix, so it has a lot more similarities to Linux than Windows does. But that doesn't mean they are the same, the OS is proprietary software and it runs on specialized hardware.

Apple and macOS have been on the news recently due to the new M1 processor with their change to ARM. The performance seems to be astounding, and I am quite excited to try it at some point. Sadly this has created several problems for virtualization of Linux VMs (virtual machines) using Virtualbox. At least it is possible to use Docker but that doesn't cut it for me as a Linux development platform.

In my experience macOS is also a fantastic OS to work on. Its UI is very appealing - the company is supposed to be run by designers, and is battle-tested by many users and programmers. So then, why on earth would you want to work on Linux when the two competitor OS are clearly on the mainstream? Of course, it is not that simple.

The first reason that comes to mind is convenience. If you are a developer and you pass the learning-barrier, most of the software for developers will support Linux as a platform. Also programming languages, except the ones that target Windows only. Not only that, many of the software running on production is on a Linux environment, which would become a lot easier to configure and understand.

Linux has many flavors, you probably already heard some of them even if you don't have any experience working on it. It is not an operating system but a kernel (or core functionality), and all the Linux-based operating systems share it. One of the most popular names is Ubuntu Linux, a distribution that many of the cloud providers offer as the first option. This is also the distribution I first used so I have a fond memory of it.

My particular background is quite common among many of the peers I have had and talked with. I used Windows for most of my early life and teenager years. I could play games there, and that is what most of the PCs out there brought installed inside. During university is when I first ever considered trying out Linux.

I heard about Linux many times before researching anything about it. I always had the mental model that it was a niche operating system without any real interest for developers except for maybe embedded systems. It is clear now how wrong I was, but sadly that says something about how common users perceive Linux if they don't actively look into it.

My first steps in development were on Visual Basic when I was quite young, but for many years I hadn't write a single line of code. At university I began to practice programming again.

My return to coding was with the hand of PHP. At that time Wordpress and Drupal were critical tools in the web space, and they still have a very important role. The stack is commonly referred to as WAMP: Windows, Apache, MySQL, and PHP.

The setup was quite easy, even installing each tool separately. This was after learning some HTML and CSS, so I clearly was heading to the web industry from the start.

It was then that I read so many people praising Linux, and some of the related ideals of free and open-source software. So I tried it out, read about a software called Virtualbox where I could install it without removing Windows, and there you have it. The Ubuntu wizard installer is quite simple to follow through so it was not difficult to finally get it running on my machine.

Unfortunately the Virtualbox configuration was not great, and the performance on my laptop was extremely slow. In hindsight that is not surprising as even today I would avoid running UI on Virtualbox unless it was a lightweight desktop environment like LXDE.

After trying the Ubuntu virtual machine for a few weeks, it didn't look that complex. It was easy to download and use packages and I hardly needed to use the command line, which I hated due to ignorance. So in order to enjoy better performance, I decided to install it as host.

At this point, I didn't know yet that dual-boot was possible, although it didn't take me too long to find out. The first time it was a plain installation, just Ubuntu as host. After a few days, it was clear that I was missing Windows. The jump between them was bigger than expected, and the free software that I could find for Linux was not as similar as initially thought: LibreOffice, Gimp, all my Windows knowledge was barely useful with those.

And not only that, the installation and configuration of the WAMP stack was way more difficult than it was on Windows. Well, of course this is because of not understanding the basics of how to configure and debug on Linux.

I had many doubts at that point, and I installed Windows along with Linux which gave me a lot of leverage. That was the time to break the learning curve, which took at least a few months.

After so many years, if I could give my past self a piece of advice it would be to learn faster how to use the command line. When knowing the tips and tricks of using a terminal and basic bash, Linux just becomes a lot more interesting. The moment you realize that many of the daily tasks can be automated way easier than in Windows, some of the benefits appear more clearly.

And I guess that would be the takeaway of this story. Linux is a bit of a pain at the beginning, but once you learn how to automate tasks, create aliases, autocomplete, then the ROI starts to shine. From then on I continued using Linux for development and I still do.

However, after my first couple of long-term jobs, I have been using Linux more in VMs than as a host OS. VMs have a bit of a performance cost, but if set up correctly, it is really not important. I reserve the host system for the UI work: browser, UI clients, emulators, company chat, and a little more.

The rest is done in a VM, either via SSH, which is very fast when in the local computer or directly in a basic but fast UI. Most of the time in the terminal app. I've ended up getting so used to the terminal that sometimes I consider switching to a TUI application for some tasks like using Jira.

In later articles I will talk about more technical aspects of the learnings, and what points I found useful when making Linux a productive environment. For the basics just installing it and learning how to perform common tasks will be enough. For more advanced learning, A Cloud Guru (previously Linux Academy) is a great platform.

Although the experience will be different for each developer, I hope you try Linux if you have some curiosity. Once you pass the initial learning barrier, if you keep going on, you may decide to use it in the future!

返回帖子列表
Loading ...