How to install Arch Linux

Today I’m going to instruct you through the steps of installing your own Arch Linux system.

Download the ISO

You can find the downloads for Arch Linux by clicking here.

1. Partition the drive

Determine your drive name by running lsblk. Run the following command to start the partitioning (with /dev/sda replaced by your drive):

1
# fdisk /dev/sda
  1. Enter n to create a new partition.
  2. Press Enter on the following prompts to accept the defaults.
  3. Enter w to write your changes to the disk.

2. Create the File System and mount it

Next, you need to create a filesystem on the partition that you’ve made. After you’ve created the filesystem, you can mount it.

1
2
# mkfs.ext4 /dev/sda1
# mount -t ext4 /dev/sda1 /mnt

3. Install Arch Linux system

This is maybe the most important step in the progress. This is the step where you are actually installing the system. For that, you need to run pacstrap followed by the packages you want to install. In this case, we’ll install base and grub for the bootloader.

1
# pacstrap -i /mnt base grub

4. Generate File System Tab

The file fstab contains descriptive information about the filesystems the system can mount.

1
# genfstab -U -p /mnt >> /mnt/etc/fstab

5. Enter the system via chroot

Now, we’re ready to set up the system by going inside it. For this, we’ll be running arch-chroot. Do NOT reboot at this stage!

1
# arch-chroot /mnt /bin/bash

6. Setting up locales

Locales are basically the language files your system will be using.

1
2
3
# nano /etc/locale.gen
Uncomment line en_US.UTF-8 UTF-8
Uncomment line en_US ISO-8859-1

(uncomment by removing the # in front)

After that, you have to generate the locale files.

1
# locale-gen

And then put them into effect on the system.

1
2
# echo LANG=en_US.UTF-8 > /etc/locale.conf
# export LANG=en_US.UTF-8

7. Setting the timezone

All timezone files can be found in /usr/share/zoneinfo/. You need to create a link to /etc/localtime with the timezone you want.

1
# ln -s /usr/share/zoneinfo/LOCATION/CITY /etc/localtime

8. Set the hardware clock

This command sets the hardware clock from system time. --utc implies that your hardware clock is in the UTC timezone. More information here

1
# hwclock --systohc --utc

9. Set your system’s hostname

This can be anything you want.

1
# echo "my-computer" > /etc/hostname

10. Set up simple networking

Before you do the following, please run ip a to determine your interface. It’s generally called eth0, but it may be different on some machines.

  1. Copy the example

    1
    # cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/my_network
  2. Modify the interface name

    1
    2
    # nano /etc/netctl/my_network
    Replace the "Interface=eth0" line with the one shown by the "ip a" command.
  3. Enable the network

    1
    # netctl enable my_network

Setting a password on your root user is highly recommended. You can do that now by running passwd

12. Install the boot loader (grub)

You can find information on how to install GRUB on various systems on the Arch Linux Wiki. The following is a simple installation on a system with a BIOS (not UEFI). You can find more boot loaders here.

1
2
# grub-install --recheck /dev/sda
# grub-mkconfig -o /boot/grub/grub.cfg

13. Reboot the machine

You are now ready to boot into your new system.

1
2
3
# exit
# umount /mnt
# shutdown

After shutting down, remove the disk image and boot the system again. You can now use your newly installed system!

More things to do

Creating an user account

The first user you create should also be added to the wheel group. This will be kind of like an administrator.

1
2
# useradd -m -G wheel -s /bin/bash usernamehere
# passwd usernamehere

For creating other users, you should omit the -G wheel part unless you want them to be able to use sudo.

Enabling sudo

  1. Install sudo - # pacman -S sudo
  2. Create a file in /etc/sudoers.d/99-wheel with the following lines:
    1
    %wheel ALL=(ALL) ALL

If you want the wheel group to be able to use sudo without password, you can replace the last ALL with NOPASSWD: ALL.

Installing a Desktop Environment

Firstly, you should install xorg packages.

1
# pacman -S xorg-server xorg-xinit xorg-server-utils mesa xterm

For graphics drivers, you can look at the wiki: Intel, ATI, AMD and NVIDIA.

You can find packages for various desktop environments here.

Install lightdm

Some desktop environments don’t have a system to log you in to a session. This is where lightdm comes to play.

1
2
# pacman -S lightdm lightdm-gtk-greeter
# systemctl enable lightdm.service

You can find lightdm configuration at /etc/lightdm/lightdm.conf.

After you’ve installed what you want, you can reboot the system and it should either load up the desktop environment or the lightdm-gtk-greeter, which will allow you to select a desktop environment to log in to.

Keeping your system up-to-date

You should keep your system up-to-date to get the latest packages and security patches. Arch Linux is a rolling release distribution, meaning that you don’t have to reinstall the entire system and package updates are rolled separately instead of in bundles.

1
# pacman -Syu

This command synchronizes your system with the latest repositories and installs all available updates.

That’s it!

This should be your basic Arch Linux system ready to go! Always remember that the Arch Linux Wiki is a great place to find help for all things Linux, not just Arch!

Giving a shot at making a game using Godot Engine 3.0

Hello!
In the past week, I’ve been working on a simple 3D game using Godot Engine 3.0 (go-doh). In this article, I will show off some of the features and discuss how it all works. Here’s a quick demo of the gameplay:

Mechanics

Block breaking

Blocks can be broken by just clicking on a tile of the chunk. The speed of the breaking and the damage dealt to the tile depend on the current pickaxe. Pickaxes can be upgraded in the Shop GUI. Pickaxes also have a durability value, which will always be kept at maximum when you’re on the surface. The current pickaxe along with it’s durability is displayed in the bottom right corner of the screen. When your pickaxe “breaks”, you will stop mining and you won’t be able to start mining until you repair it or return to the surface.

Bombing

Blocks can also be broken using bombs. By placing a bomb, it takes approximately 3 seconds to detonate and it damages blocks in a 4 tile radius. Tougher blocks located deeper in the mine wont be broken by a bomb, instead made softer and thus they will take less time to mine with a pickaxe. When a bomb blows up tiles, you won’t get them in your inventory.

Shop

In the shop GUI, you can sell your mined blocks for money or buy items like torches, bombs and better pickaxes. Money can only be earned by selling the blocks you’ve mined.

Minerals

This is the list of minerals currently generated in the chunk and their yield when sold:

  • Copper - $15
  • Iron - $20
  • Silver - $50
  • Gold - $100
  • Amethyst - $250
  • Emerald - $300
  • Sapphire - $400
  • Ruby - $500
  • Diamond - $1000
  • Flawless Diamond - $2500 (rarest)

Note that all of these are not guaranteed to generate. It depends on the random seed and the y value.

Scenes

Godot uses Scenes, which can be easily instanced. The following image is the Godot editor, in it I have opened the root scene, which will be the point where the game runs.
Root Scene
On the right, you can see the scene tree.
Instances

  • Root - This is the first node in the scene, containing everything.
  • WorldEnvironment - Controls the overall look of the scene. I have configured it to give me a completely black scene without a background.
  • All of my other custom scenes follow these.

The Chunk


The Chunk is a MeshInstance which I use to generate a random mine with. I’ve attached a script to this node which generates a mesh and assigns it to the MeshInstance.
Using SurfaceTool, you can create geometry by specifying the vertices individually.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Create a new SurfaceTool instance
var st = SurfaceTool.new()

# Begin specifying your vertices using primitive type of triangles. Every 3 vertices is a triangle.
st.begin(Mesh.PRIMITIVE_TRIANGLES)

# Half of a quad
st.add_uv(Vector2(1,1))
st.add_vertex(Vector3(0,0,1))

st.add_uv(Vector2(1,0))
st.add_vertex(Vector3(0,1,1))

st.add_uv(Vector2(0,1))
st.add_vertex(Vector3(1,0,1))

# Output the mesh
var mesh = st.commit()

This is just a basic example of what you can do with SurfaceTool, but as you can see, it’s a great way to create procedural geometry. Alongside this I use some code to decide which material to use for which tile and the ability to regenerate the mesh when a tile is changed.

The Player

The player is currently just a simple CapsuleMesh with a camera, a light, some raycasts and some sounds attached to it.

Player Scene
The script attached to it deals with KinematicBody movement and the block break animation. The RayCasts are used to determine whether the player is colliding with the chunk or not. The RayCast pointing up is used to cancel the jump when player hits a tile from below.

The GUI

GUI Scene
GUI in Godot is created using the Control class and it’s inherited classes.
In the GUI scene I have a simple ItemList inventory and a few other items. The main thing the GUI does is the shop: buy and sell system.

The Shop Dialog

On the righthand side, there are two image buttons that spawn an instance of another scene and translate it to the player’s current position. These two buttons are Bomb and Torch, which “place” their respective item.

1
2
3
4
5
6
7
8
9
10
11
# Load the scene
var scene = load("res://scene/props/bomb.tscn")

# Get the root instance of the scene, in this case it's a Spatial
var node = scene.instance()

# Translate the Spatial
node.set_translation(Vector3(x, y, z))

# Add it to the Root scene
get_node("../").add_child(node)

SideSupport

This scene generates 4 quads that cover the chunk. These prevent the player from walking off of the chunk or falling out the bottom.

CrackBox

This scene generates a quad that has a variable texture. This scene is used to display the breaking animation of a tile, by translating it to the currently “broken” tile and setting the Texture of the material to one of the 6 crack textures.
The 6 textures used to represent the tile breaking

The Source

The source of this project is available on my GitHub account. I’ve laid out the scenes, scripts, etc. into a nice folder structure so you can easily see where the things are located. I recommend you do the same when you’re making a game in Godot. If you want to try the game yourself, you can clone or download the repository onto your computer and Import it in the project list of the editor. Downloads are not currently available as the game is still in development, but you can easily export them in the editor.

Conclusion

I think that Godot is a really great game engine. It lets you do amazing things quite easily. The community is also very helpful and the documentation is good enough for you to get started. This game still needs work for it to be enjoyable, but it’s been quite fun getting this far and I thought I’d share it with you.

Welcome to my blog!

So, I’ve decided to start a new blog using Hexo.
I’ll probably be using this to share my projects and write some tutorials.

Current projects

I’m currently taking a break from writing code due to personal reasons, but I’m mainly working on my network, Icy Network. The main project in the works is Episodes.Community, which is basically a site where people can watch and share links to their favorite TV shows and cartoons.