In this article, I will be sharing how I set up my Arch Linux environment for coding.
A brief backstory. I have some experience with Linux. I have used Ubuntu and Linux Mint to a great extent and even played around with Kali Linux before. But Windows has always done the basic things for me. So I got a new laptop and I decided to play around with Linux more and get more familiar with it. So I installed Arch Linux and set up my environment for coding.
Installing Arch Linux
Installing Arch Linux can be pretty rigorous for beginners. But now there are many installation libraries that could help you get the job done. One of them is archinstall.
archinstall is a program that can be run directly from the boot medium you are making use of.
All you need is to run the command below and follow the query the program throws to you.
$ archinstall
Read more about archinstall here.
Updating Arch Linux
After installing the latest Arch Linux release, it made sense for me to check for any new updates available and update my system. So to update my system, I ran this command.
$ sudo pacman -Syu
If you want to know more about pacman. I wrote an article on introduction to pacman as a beginner here.
Installing Git
To install Git, I ran the command.
$ sudo pacman -S git
Then, I set up some of my Git global configs using the commands below.
$ git config --global --user.name "username"
$ git config --global --user.email "user@email.com"
Installing a Package Manager for the AUR
AUR stands for Arch User Repository. It’s a community-managed repository where users can contribute their own package build, vote for packages, etc.
Often, packages from the AUR make it to the Official Repository. It is recommended to avoid the AUR as a beginner but as a programmer. I am pretty sure they are programs I need that are still in the AUR so I installed a package manager for the AUR called Yay.
To install yay. Move to the /opt
directory and clone yay git repository.
$ cd /opt
$ sudo git clone https://aur.archlinux.org/yay-git.git
Change the file permissions using.
$ sudo chown -R tecmint:tecmint ./yay-git
Navigate into the yay directory and build the package making use of the makepkg command.
$ cd yay-git
$ makepkg -si
Now that you have yay installed.
To install a package from yay you can make use of this simple command.
$ yay -S package-name
See this article for more reference using yay.
Installing and Setting up a Code Editor
One of the most important tools for a developer to have is a code editor. They are multiple options to choose from ranging from Vim, NeoVim, WebStorm, Visual Studio Code, Sublime Text Editor, Atom etc.
I am quite familiar with Visual Studio Code and I love the flexibility and integrations it provides so I chose to install Visual Studio Code.
Using Yay, you can install visual studio code by running the command.
$ yay -S visual-studio-code-bin
Then I did some Visual Code specific settings and added some extensions to make it suitable for me.
Installing Node.js and NPM
I write a good deal of TypeScript and JavaScript daily and I also make use of packages from NPM so I needed to have these programs installed.
To install Node and npm, run the command.
$ sudo pacman -S nodejs npm
Then verify the version of the packages by running:
$ node --version
$ npm --version
The version of node or npm installed may be old versions so you may have to update the packages.
To update npm, run the command.
$ npm install -g npm
Then to update Node, we can make use of nvm (Node Version Manager):
First, install nvm using the command.
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.35.2/install.sh | bash
Then make use of nvm to install the latest version of Node available run the command below
$ nvm install node
Installing Yarn (optional)
Just like npm, yarn is also a package manager that doubles as a project manager.
To install yarn, we can make use of Corepack to manage Yarn. Corepack is, by default, shipped with node version 16.10 or later versions.
If Corepack is not included, install it globally running using npm.
$ npm install -g corepack
The enable Corepack by running the command.
corepack enable
You can confirm the version by running the command.
$ yarn --version
Creating Shortcuts with Bash Aliases
Since I would mostly spend my time on the terminal, I needed to create shortcuts for some commands so setting up aliases is a good solution for me.
To create aliases, open the ~/.bashrc
file using.
$ nano ~/.bashrc
Add in some aliases as such:
# ~/.bashrc
alias myip = 'curl ipinfo.io'
alias gl = 'git log'
alias gs = 'git status'
# to add arguments to the alias, make use of functions
function gcp () {
git commit -m "$1"
}
Once the file is saved and closed. I make the aliases available to by current session by running.
$ source ~/.bashrc
Some other programs I use (You may like them)
- Notion: used for taking notes and keeping track of my tasks
- Flameshot - For taking screenshots
- Snapcraft - Another package I use sometimes
So I guess my system environment is at its barest minimum setup right now.
Kindly share how you have your Arch Linux setup so share some recommendations or tips you think I may find helpful.