My Arch Linux setup for coding
Tags: beginners, linux, archlinux, programming
Published: 2022-04-22 21:46:07

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](https://wiki.archlinux.org/title/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. 

```bash
$ archinstall
```

Read more about archinstall [here](https://wiki.archlinux.org/title/Archinstall).

## 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.

```bash
 $ sudo pacman -Syu
```

If you want to know more about pacman. I wrote an article on introduction to pacman as a beginner [here](https://blog.zt4ff.dev/a-beginner-introduction-to-arch-linux-pacman).

## Installing Git

To install Git, I ran the command.

```bash
$ sudo pacman -S git
```

Then, I  set up some of my Git global configs using the commands below.

```bash
$ 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.

```bash
$ cd /opt
$ sudo git clone https://aur.archlinux.org/yay-git.git
```

Change the file permissions using.

```bash
$ sudo chown -R tecmint:tecmint ./yay-git
```

Navigate into the **yay** directory and build the package making use of the **makepkg** command.

```bash
$ 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.

```bash
$ yay -S package-name
```

See this [article](https://www.tecmint.com/install-yay-aur-helper-in-arch-linux-and-manjaro/) 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.

```bash
$ 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.

```bash
$ sudo pacman -S nodejs npm
```

Then verify the version of the packages by running:

```bash
$ 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.

```bash
$ npm install -g npm
```

Then to update Node, we can make use of **nvm** (Node Version Manager):

First, install nvm using the command.

```bash
$ 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

```bash
$ 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.

```bash
$ npm install -g corepack 
```

The enable Corepack by running the command.

```bash
corepack enable
```

You can confirm the version by running the command.

```bash
$ 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.

```bash
$ nano ~/.bashrc
```

Add in some aliases as such:

```bash
# ~/.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.

```bash
$ 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.