The title says that this article will give you the easiest way to install golang-migrate program.
Somebody might have different opinion because they were lucky to install it from the first attempt just by pasting couple of commands into the console.
But I was not so lucky. While trying to install this program by the official instruction from the GitHub repository of "golang-migrate" I faced a lot of errors.
https://github.com/golang-migrate/migrate
Like everyone I was looking why this errors occured and how to solve them. And I found that a lot of people have simillar issues and solutions are quite complicated.
But I found they way of installation that will help you to avoid all these errors and will save you hours! That is why I believe that this way is the easiest one :)
We need to download the source code of the program from the GitHub, create an executable file of the program and place it in your Linux OS:
- Open the terminal
- Choose the directory where you want to download it or create a new one where you want. This is not very important, since we will create a binary file and then move it to another place.
- When you inside the directory of your choise, run the command:
git clone https://github.com/golang-migrate/migrate.git
- Then go inside the downloaded directory with the command:
cd migrate
- Create an executable file by running:
make build
- Move the executable (binary) file to the directory where all your binary files live. This directory path might be ./usr/bin or /bin. Depending on the /bin directory location run one of this commands:
mv ./migrate ./usr/bin
or
mv ./migrate /bin
Chances are that your OS might request for admin permission. In this case just use the magic word :)
sudo mv ./migrate ./usr/bin
or
sudo mv ./migrate /bin
And that's about it! =)
Thank you a lot for reading this guide. I really hope it will save you hours that I spent before finding this solution.