You are on page 1of 14

ArchLinux

Installation Guide
Table of Contents
Installation Guide ArchLinux.........................................................................................................................3
Keyboard layout.......................................................................................................................................... 3
Partition disks.............................................................................................................................................. 3
DOS........................................................................................................................................................... 3
Format the partitions................................................................................................................................. 3
Mount the partitions..................................................................................................................................3
Install the base system..............................................................................................................................3
Configure the system................................................................................................................................. 3
Sudo............................................................................................................................................................... 4
Install and configure a bootloader..........................................................................................................4
Unmount and reboot................................................................................................................................. 4
Post-installation............................................................................................................................................... 5
Network Configuration..............................................................................................................................5
Pacman......................................................................................................................................................... 5
git.................................................................................................................................................................... 5
Mercurial....................................................................................................................................................... 6
Virtualbox-guest-utils................................................................................................................................. 6
Pacstrap........................................................................................................................................................ 6
ChrootJail...................................................................................................................................................... 6
SSH................................................................................................................................................................. 6
FTP.................................................................................................................................................................. 7
LAMP or LNMP............................................................................................................................................ 7
Apache 2.4............................................................................................................................................... 7
Nginx......................................................................................................................................................... 9
PHP + PHP-FPM................................................................................................................................... 11
MariaDB (MySQL).................................................................................................................................12
Node.js........................................................................................................................................................ 12
MongoDB................................................................................................................................................... 12
GUI.................................................................................................................................................................... 13
Xorg............................................................................................................................................................. 13
Video driver................................................................................................................................................ 13
Gnome........................................................................................................................................................ 13
Alsa-utils..................................................................................................................................................... 13
Gnome Tweak Tool................................................................................................................................... 13
Antialiasing, Hinting, Subpixel Rendering............................................................................................13

2
Installation Guide ArchLinux
Keyboard layout
# loadkeys us

Partition disks
DOS
# cfdisk

Name Flags Part Type FS Type [Label] Size (MB)


------------------------------------------------------------------------------
sda1 Boot Logical ext4 [boot] 98.68*
sda5 Logical swap [swap] 2048.10
sda6 Logical ext4 [root] 13959.33*

Format the partitions


# mkfs.ext4 -L boot /dev/sda1
# mkfs.ext4 -L root /dev/sda6
# mkswap -L swap /dev/sda5

Mount the partitions


# mount /dev/sda6 /mnt
# mkdir /mnt/boot
# mount /dev/sda1 /mnt/boot
# swapon /dev/sda5

Install the base system


# wget -O /etc/pacman.d/mirrorlist https://www.archlinux.org/mirrorlist/all/
# nano /etc/pacman.d/mirrorlist
# pacstrap /mnt base base-devel grub-bios os-prober bash-completion sudo wget

Configure the system


# genfstab -p /mnt >> /mnt/etc/fstab
# arch-chroot /mnt /bin/bash
# echo archlinux >> /etc/hostname
# ln -s /usr/share/zoneinfo/Europe/Kiev /etc/localtime
# nano /etc/locale.gen
# locale-gen
# locale >> /etc/locale.conf
# nano /etc/vconsole.conf

3
===========================
KEYMAP=us
FONT=UniCyr_8x16
FONT_MAP=
===========================
# mkinitcpio -p linux
# passwd -l root
# useradd -m -g users -G wheel -s /bin/bash webdev
# passwd webdev

Sudo
# nano /etc/sudoers
===========================
%wheel ALL=(ALL) ALL
===========================

Install and configure a bootloader


# grub-install /dev/sda
# grub-mkconfig –o /boot/grub/grub.cfg
# cp -v /boot/grub/locale/en@quot.mo /boot/grub/locale/en.mo

Unmount and reboot


# exit
# umount /mnt/boot
# umount /mnt
# reboot

4
Post-installation
Network Configuration
$ sudo cp -v /etc/netctl/examples/ethernet-static /etc/netctl/ethernet-static
$ sudo nano /etc/netctl/ethernet-static
===========================
Description='A basic static ethernet connection'
# If the virtualbox, then define Interface=enp0s3
Interface=eth0
Connection=ethernet
IP=static
Address=('192.168.17.11/24')
#Routes=('192.168.0.0/24 via 192.168.1.2')
Gateway='192.168.17.1'
DNS=('192.168.17.1')

## For IPv6 autoconfiguration


#IP6=stateless
## For IPv6 static address configuration
#IP6=static
#Address6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#Routes6=('abcd::1234')
#Gateway6='1234:0:123::abcd'
===========================
$ sudo netctl enable ethernet-static

Pacman
$ sudo nano /etc/pacman.conf
===========================
[multilib]
Include = /etc/pacman.d/mirrorlist
===========================

git
$ sudo pacman -S git
$ git config –-global user.name "Your Name"
$ git config –-global user.email "your.name@gmail.com"
$ git config –-global core.autocrlf input
$ git config –-global core.safecrlf true
$ git config --global push.default simple
$ git config --global alias.hist 'log --pretty=format:"%h %ad | %s%d [%an]" --graph
--date=short'

5
Mercurial
$ sudo pacman -S mercurial
$ nano ~/.hgrc
===========================
[ui]
username = Your Name
===========================

Virtualbox-guest-utils
$ sudo pacman -S virtualbox-guest-utils
$ sudo modprobe -a vboxguest vboxsf vboxvideo
$ sudo nano /etc/modules-load.d/virtualbox.conf
===========================
vboxguest
vboxsf
vboxvideo
===========================

Pacstrap
$ sudo pacman -S arch-install-scripts

ChrootJail
$ git clone git@github.com:alexriz/chrootjail.git
$ cd chrootjail
$ sudo make install

SSH
$ sudo pacman -S openssh
$ sudo nano /etc/ssh/sshd_config
========(uncomment)========
Protocol 2
PermitRootLogin no
Banner none
===(If you need chroot, then add this)===
Match User testuser
ChrootDirectory /path/to/jail
AllowTCPForwarding no
X11Forwarding no
===========================
$ sudo systemctl enable sshd

6
FTP
$ sudo pacman -S vsftpd
$ sudo mkdir /etc/vsftpd
$ sudo mkdir /etc/vsftpd/users
$ sudo sh -c "echo >> /etc/vsftpd/chroot_list"
$ sudo nano /etc/vsftpd.conf
===========================
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
idle_session_timeout=600
ftpd_banner=Welcome to unknown FTP service
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
guest_enable=YES
guest_username=webdev
user_sub_token=$USER
#local_root=/srv/ftp/$USER
local_root=/srv/ftp
virtual_use_local_privs=YES
user_config_dir=/etc/vsftpd/users
pam_service_name=vsftpd
seccomp_sandbox=NO
# If enabled, all user and group information in directory listings
# will be displayed as "ftp".
hide_ids=YES
===========================
$ sudo nano /etc/vsftpd/users/webdev
===========================
guest_username=webdev
local_root=/srv/http
===========================
$ sudo systemctl enable vsftpd

LAMP or LNMP
Apache 2.4
$ sudo pacman -S apache mod_itk
$ sudo nano /etc/httpd/conf/httpd.conf
===========================
#LoadModule mpm_event_module modules/mod_mpm_event.so

7
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule mpm_itk_module modules/mpm_itk.so

<Directory />
Options None
AllowOverride None
Require all denied
</Directory>
<Directory "/srv/http">
# Options Indexes FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
# User home directories
# Include conf/extra/httpd-userdir.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
ServerTokens Prod
ServerSignature Off
===========================
$ sudo nano /etc/httpd/conf/extra/httpd-vhosts.conf
===========================
<VirtualHost *:80>
ServerAdmin your.name@gmail.com
DocumentRoot "/srv/http/test/testarch.loc/www"
ServerName testarch.loc
ServerAlias www.testarch.loc
ErrorLog "/srv/http/test/testarch.loc/logs/error.log"
CustomLog "/srv/http/test/testarch.loc/logs/access.log" common
ErrorDocument 404 /404.php
ErrorDocument 403 /403.php
<IfModule mpm_itk_module>
AssignUserId test users
</IfModule>
<IfModule rewrite_module>
RewriteEngine On
RewriteCond /srv/http/test/testarch.loc/www/%{REQUEST_FILENAME} -f
RewriteRule ^(.*\.php(/.*)?)$
fcgi://localhost:9000/srv/http/test/testarch.loc/www/$1 [L,P]
</IfModule>

8
<Directory /srv/http/test/testarch.loc/www>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
===========================
$ sudo systemctl restart httpd
$ sudo systemctl enable httpd

Nginx
$ sudo pacman -S nginx
$ sudo mkdir /etc/nginx/server_blocks
$ sudo nano /etc/nginx/nginx.conf
===========================
user http http;

worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/javascript application/json
application/x-font-ttf application/font-woff image/svg+xml image/x-icon;
include server_blocks/*.conf
}

9
===========================
$ sudo nano /etc/nginx/fastcgi_params
===========================
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
===========================

$ sudo nano /etc/nginx/server_blocks/test.conf


===========================
server {
listen 80;
server_name testarch.loc;
root /srv/http/test/testarch.loc/www;
error_page 404 /404.php;
access_log /srv/http/test/testarch.loc/logs/access.log;
error_log /srv/http/test/testarch.loc/logs/error.log;
index index.html index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ .*.php$ {
include fastcgi_params;
fastcgi_pass localhost:9000;
#fastcgi_pass unix:/run/php-fpm/php-fpm-testarch.loc.sock;
fastcgi_index index.php;
}
location ~*\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
location ~*\.(?:css|js|woff|ttf)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";
}
location ~ /\.ht {
deny all;
}
}
===========================

PHP + PHP-FPM
$ sudo pacman -S php php-fpm php-gd php-mcrypt
$ sudo nano /etc/php/php.ini

10
===========================
user_ini.filename =
extension=exif.so
extension=ftp.so
extension=gd.so
extension=iconv.so
extension=mcrypt.so
extension=mysql.so
extension=mysqli.so
extension=openssl.so
extension=pdo_mysql.so
extension=phar.so
extension=sockets.so
date.timezone="Europe/Kiev"
===========================
$ sudo systemctl enable nginx

$ sudo nano /etc/php/php-fpm.conf


===========================
include=/etc/php/fpm.d/*.conf
===========================

$ sudo nano /etc/php/fpm.d/test.conf


===========================
[testarch.loc]
user = webdev
group = users

;listen = /run/php-fpm/php-fpm-testarch.loc.sock
listen = 127.0.0.1:9000

listen.owner = http
listen.group = http
listen.mode = 0660

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

php_admin_value[open_basedir] = /srv/http/test/testarch.loc/www/:/tmp/
===========================
$ sudo systemctl restart php-fpm

11
$ sudo systemctl enable php-fpm

MariaDB (MySQL)
$ sudo pacman -S mariadb
$ sudo systemctl start mysqld
$ sudo mysql_secure_installation
$ sudo systemctl restart mysqld
$ sudo systemctl enable mysqld

Node.js
$ sudo pacman -S nodejs

MongoDB
$ sudo pacman -S mongodb
$ sudo systemctl enable mongodb
$ sudo systemctl restart mongodb

12
GUI
Xorg
$ sudo pacman -S xorg-server xorg-xinit

Video driver
$ sudo pacman -S nvidia

Gnome
$ sudo pacman -S gnome gnome-extra
$ sudo systemctl enable gdm.service

Alsa-utils
$ sudo pacman -S alsa-utils

Gnome Tweak Tool


$ sudo pacman -S gnome-tweak-tool

Antialiasing, Hinting, Subpixel Rendering


$ sudo nano /etc/fonts/fonts.conf
===========================
<!-- Antialiasing, Hinting, Subpixel Rendering -->
<match target="font">
<edit name="autohint" mode="assign">
<bool>true</bool>
</edit>
</match>
<match target="font">
<edit name="hinting" mode="assign">
<bool>true</bool>
</edit>
</match>
<match target="font">
<edit name="hintstyle" mode="assign">
<const>hintslight</const>
</edit>
</match>
<match target="font">
<edit name="lcdfilter" mode="assign">
<const>lcddefault</const>

13
</edit>
</match>
<match target="font">
<edit name="rgba" mode="assign">
<const>rgb</const>
</edit>
</match>
===========================

14

You might also like