Skip to content

Installing ArchLinux – using ‘pacstrap’ and static IP (wired connection)

November 23, 2012

1) Download the installation media here: https://www.archlinux.org/download/

2) Boot ArchLinux – for 32 bit systems use i686, for 64-bit systems use x86_64.

3) Once logged in to the console you can start partitioning your hard drive. To do that type cfdisk /dev/sda and hit enter. Using cfdisk is pretty easy so I won’t go in detail of how to use it.

4) Once you are done with partitioning your hard drive you can format the partitions. Assuming you created /dev/sda1 to be used as / and /dev/sda2 as swap you should execute the following commands (DO NOT forget to substitute sda1 and sda2 with the partitions you prepared!):

mkfs.ext4 /dev/sda1 (assuming you want to format it with ext4). If you want to see the other options type mkfs and hit tab key. Next activate your swap partition:
swapon /dev/sda2

5) Mount your newly created partition to a temporary directory:

mount /dev/sda1 /mnt

6) Connect to the internet (static IP). Execute:

ifconfig eth0 your-ip-address-here
ifconfig eth0 netmask your-netmask-here
ifconfig eth0 broadcast your-breadcast-here

route add default gw your-default-gateway-here
nano /etc/resolv.conf and add your nameservers. Save the file when ready.
ping google.com. If it still does not work try:
ifconfig eth0 down
ifconfig eth0 up

Please note: if you restarted the network with the last two commands above you will need to edit /etc/resolv.conf and put your DNS servers again.

OR alternatively:

ip addr add your-ip-address-here/your-subnet-mask-here dev eth0

ip route add default via your-default-gateway-here

nano /etc/resolv.conf and add your nameservers. Save the file when ready.
ping google.com.

7) Install the base system by executing:

pacstrap /mnt base base-devel

8) Install grub loader by executing:

pacstrap /mnt grub-bios (for EFI pacstrap /mnt grub-efi-i386)

9) Generate fstab:

genfstab -p /mnt >> /mnt/etc/fstab

10) chroot to your new system, by executing

arch-chroot /mnt

11) Set the timezone. Go to:

/usr/share/zoneinfo/ and find where you are ;). For me I cd to Europe (full path /usr/share/zoneinfo/Europe) and then I see Sofia. So next I need to execute this in order to setup the timezone:
ln -sf /usr/share/zoneinfo/Europe/Sofia /etc/localtime
Do the similar using your timezone.

12) Set locale:

nano /etc/locale.gen
Uncomment the two lines corresponding to your locale and save the file.
For example I use:
en_US.UTF-8 UTF-8
en_US ISO-8859-1

13) Edit /etc/locale.conf, type inside it:

LANG=”your-locale-here” //for example LANG=”en_US.UTF-8″
LC_COLLATE=”C”

14) Generate the locales you set by executing:

locale-gen

15) Edit /etc/rc.conf (if it does not exist create it). I do not go into detail about this. If the file does not existed find some on the internet and add the necessary information of his model.

16) Execute:

mkinitcpio -p linux

17) Install the bootloader:

grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/sda

18) Set root password by executing:

passwd and set the password.

19) Reboot your system, remove installation media, boot the new system (grub-menu should appear) and login.

20) Set-up your network configuration on the installed system (static IP)

– create file: /etc/conf.d/network and type this inside it:

interface=eth0 (assuming you will use eth0 network interface)
address=”your-ip-address-here”
netmask=”your-netmask-here”
broadcast=”your-broadcast-address-here”
gateway=”your-gateway-here”

Save the file.

– next create file: /etc/systemd/system/network.service and type this inside it:

[Unit]
Description=Static IP Connectivity
Wants=network.target
Before=network.target

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/conf.d/network
ExecStart=/sbin/ip link set dev ${interface} up
ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev ${interface}
ExecStart=/sbin/ip route add default via ${gateway}

ExecStop=/sbin/ip addr flush dev ${interface}
ExecStop=/sbin/ip link set dev ${interface} down

[Install]
WantedBy=multi-user.target

Save the file.

– (if needed) edit your /etc/resolv.conf and put there your nameservers. Then activate the network by executing:
systemctl enable network
systemctl start network

You should be now connected to the internet.

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: