As a Windows user I wondered how hard or easy it will be to switch to Ubuntu for daily work. As a week passed here is my conclusion. I hope it will help you to prepare for your transition if you are in a similar situation.
The Windows Side
In the past 4 years as a web developer I was using mainly Windows stack. It means Visual Studio, ASP.NET MVC and its brothers. It is a really standard stack, but a really big thing to note is that you are rarely have to touch the Command Prompt or PowerShell script. Ok, you can go really advanced and fiddle with them but it is not common. Most of the times Control Panel and Visual Studio is all you need. To be honest whenever I had to touch a Command Interface it was all for the Git Bash or for npm with Nodejs. Rarely for Windows stuff. Usually you just have to click things together. The only exception I found is migrating with Entity Framework. But it is not a complicated job either to be honest.
The Ubuntu Side
On Ubuntu things are changing quickly. Now I am moving to a PHP stack with Symfony. On Ubuntu you have to take care about permissions as well, also to attach network images are a bit more involved than on Windows. I mean at the first time. When you start solving the upcoming problems, it becomes quite straightforward and your fingers somehow will just remember the commands you need to run. As of my first week I didn’t really had to write extremely complicated commands but even if you had to most of the times those are already written for you and you only need to copy paste them. Most likely you only have to change the username in the command to yours for permissions and you are good to go to use them.
Now I am not going to teach you how to use Ubuntu. There are tons of blogs and courses for that but I still want to show you the pains I was facing as a Windows user and the solutions for them in a few steps.
Installing The Latest Version of Node.js
To install anything on Ubuntu, so far I discovered 4 + 1 ways to do it.
The Ubuntu Store
The apt-get and apt-get install commands
Installing from a built package (downloaded from a website)
Building it from source (A little bit advanced way)
Here is the catch. Interested ?
1. The Ubuntu Store
For Node js the first option is not an option. It is not built for devs. You can still try to install things from there. For example you can install Slack and you also can install Visual Studio Code. Unfortunately it is an edge case to install software like that from there. Quite a few times it fails. I experienced it with Slack and I ended up installing it through its website.
2. The apt-get Command
Roughly apt-get of Ubuntu is the NuGet of Visual Studio. I know it is an ugly and unfair comparison (an OS vs IDE), but I bet most of us are devs here. Let me know in the comments if not and welcome among us.
So I tried to install Nodejs with
sudo apt-get nodejs
command. Unfortunately it wasn’t a wise move. It only installed Node version 4 while currently it is at 8. Not an up-to-date version right? If you can try to avoid this method.
3. Installing From Built Package
You can download similar installers from websites just as for Windows. Download a package and you install it with a double click.
Nope. I couldn’t find one in this case to do it. Keep reading 🙂
4. Building It From Source
I wish I didn’t try it. I teard blood (Hungarian expression, what would you say normally ?). I read a lot of docs and “readme”s. I spent so much time here. Try not to do it.
5. The right solution
Ok, so we talked through all of the options I was aware of. It was my fault, because it is clearly written in the Node.js documentation how to do it the right for Ubuntu and other Linux based systems. Here it is if you are interested.
That is right. You can download a package from a url with curl like in step 3, just from bash (the command window of Ubuntu) rather than using a Download button on a website and then using step 2, you can install it with apt-get.
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs
Cool right ? I hope it helps you in the future. I learned my lesson here, the hard way.
Solving Permission Issues
In Ubuntu, just like on Windows you have permissions. But somehow on Windows when you use a peace of software it has the same rights as you do especially if you start it with admin rights. No problem here.
Now, if you are on Ubuntu, you can be an admin, and you can run a software with your permissions, but still, sometimes it is not enough. Here is my story:
I installed the vue-cli. A command line interface for Vue.js. Here it is its GitHub repo.
When I installed it, I installed it with sudo. Sudo runs a command with root rights. It is not your admin permission, it is the Goddess permission in your system. It has higher privileges then your admin Majesty. When I asked vue-cli to create a project for me, it created it, but all generated file had root rights “only”. So for example VSCode wasn’t able to edit those files. On each change I had to give my sudo password. Not a good way to work efficiently and quickly.
Fortunately there is a solution. You have to tell the Goddess that you are the Man in your house and you want to Own Those Files.
The only thing you have to do now is to shout:
sudo chown -R [yourname] folderName
Of course you need sudo, since you aren’t talking to just anybody 😀
Using Docker, trying to cheat 😀
Now that was and is kind of a pain. Since all of he projects I have to work with are in docker images, I could’ve prevent using Ubuntu if I am smart enough. Although everyone using some kind of Linux distribution at this company. Easy there. Because it is a long story and because I am still trying to work it out it will come in another post or series of posts, since there is so much to tell. And it will be more of a how to than like this story telling. It might will contain a GitHub repo with my hack if I won’t find an existing solution. Anyway it is coming and subscribe to my email list to know when it is released.
Thank You For Reading It
I hope you liked my post. If you read this post that far I would appreciate if you would say a hello in the comments below. Also I could use your advice and opinion, to form this blog’s style. Did you like the way it was written? Do you have any advice for me?
Please come back later again and tell your story of your first encounter with Linux.