ArchLinux Useage Record

ArchLinux Useage Record

1. Download ArchLinux ISO

2. Install ArchLinux on VirtualBox

  • Open VirtulBox and new virtual machine

  • Boot Arch Linux (x86_64)

    • Ping test
      ping baidu.com
      If ping test is failed, Stop and end !
  • Create 10GB Hard disk partition
    Three partition

    • root partition
      cfdisk
      Select dos chance, Clik New option to change 20GB to 10GB, select primary option and press Enter. Select Bootable option and write, enter yes.
  • Create 2GB SWAP partition
    The same as above steps to partition Swap partition except RAM is 2048M.

  • Create 8GB Logcial partition
    Reference to Create 10GB Hard disk partition. RAM is 8GB.
    final select Quit option to quit.

  • Format the three partition

    mkfs.ext4 /dev/sda1   // sda1 is name of Root partition
    mkfs.ext4 /dev/sda3  // sda3 is name of Logical partition
    
    mkswap /dev/sda2   // Format the swap partition with mkswap
    
  • Activate swap partition
    swapon /dev/sda2

  • Mount the sda1 partition to install the system

    mount /dev/sda1 /mnt  /* /dev/sda1 and /mnt are two directories */
    
  • Booting Arch Linux to startup
    pacstrap /mnt base base-devel

  • generating /etc/fstab
    genfstab /mnt>> /mnt/etc/fstab

  • The configuration of region, time and root password
    Enter the following command to change the root directory of the system to the installation directory of Arch Linux.
    arch-chroot /mnt /bin/bash

    • Language configuration
      nano /etc/local.gen
      If there is nothing in the open file, Add en_US.UTF-8 UTF-8 to file. Press Control + X , y to save it. Press Enter.
      If there is en_US.UTF-8 UTF-8 in the open file, Delete # symbol at head and save.
    • Activating
      Enter the following command to activate it
      locale-gen
  • Create the /etc/locale.conf configuration file
    nano /etc/locale.conf
    Add LANG=en_US.UTF-8 to open file and save.

  • Synchronous time zone (X)
    ls user/share/zoneinfo
    No such a file or directory, There is a trouble.

  • passwd

    • Enter root password
    • Retype the root password
  • Set up hostname and network
    nano /etc/hostname
    Enter you hostname and save it.

  • Activate dhcpcd
    systemctl enable dhcpcd
    This will cause dhcp to start automatically the next time the system starts and automatically obtain an IP address.

  • Install the boot loader

    pacman -S grub os-rober     // If prompted incorrectly use the following command
    pacman -S grub os-prober    
    
    • Install the boot loader to hard disk
      grub-install /dev/sda
    • Configuration
      grub-mkconfig -o /boot/grub/grub.cfg
  • Reboot

    • Exit chroot mode
      Control + D
    • Reboot
      reboot

3. Boot existing OS

    Enter Robot Logic: root
    Password: 

Arch Linux installed successfully !

4. Install Vim

  • Install Vim
    pacman -S vim
  • Configuration Vim
    vim /etc/profile and add following command to the end of open file
    export LS_OPTIONS="--color=auto -N -T 0"
    alias ls="ls $LS_OPTIONS"
    alias ll="ls -l"
    alias lf="ls -F"
    alias la="ls -a"
    alias lt="ls -t"
    alias lx="ls -X"
    alias l="ls -lA"
    alias l.="ls -d .*"
    
    
    vim /etc/vimrc and add following command to the end of open file
    set nocp
    set ru
    set background=dark
    "set columns=80
    set nobk
    set is
    syn on
    set backspace=indent,eol,start
    set whichwrap=b,s,<,>,[,]
    set sw=4
    set ts=4
    set lbr
    set sm
    set cin
    set softtabstop=4
    set autoindent
    set number
    set hls
    set fo+=mB
    set vb t_vb=
    set nobackup
    

5. Compile the first C program in ArchLinux

  • cd /home
  • Vim a.c
    #include<stdio.h>
    int main(void)
    {
        printf("hello world\n");
        return 0;
    }
    
    save and exit
  • gcc a.c
  • ./a.out

if the terminal appears hello world, it means success. Congratulations.

6. End

This article is organized by Chanmo.
因为自己英文不好,想通过这种写英文技术文档的方式来提高自己的英语水平

posted @ 2019-09-16 05:20  Chanmoo  阅读(277)  评论(0编辑  收藏  举报