GhaSShee


Arch Linux


# OS Installation ## Make an Installation USB Media ~~~sh sudo diskutil list ## lsblk @Linux sudo dd if=arch.img of=/dev/rdiskx bs=100m ## change 'x' of /dev/rdiskx ~~~ ## Boot the Installation USB Media 1. Insert USB and POWER ON. 2. PRESS F2 (or other keys) to enter BIOS. 3. confirm UEFI mode and Boot Order, then SAVE&EXIT (F10). ## Precondition ~~~sh ## loadkeys jp106 ## IF JP Keyboard wifi-menu ## connect Wifi ls /sys/firmware/efi/efivars ## see if efi-variables exist # ls /sys/firmware/ ## see if efi exists ~~~ ## Minimal Installation ~~~sh lsblk ## Find Install Destination Device DISK="/dev/sdx" ## Maybe /dev/sda or /dev/sdb gdisk /dev/$DISK ## Partitioning ## o => y => ## '=>' denotes 'Enter key' ## n => => => +512M => ef00 => ## UEFI: ef00 ## n => => => +16G => 8200 => ## SWAP: 8200 ## n => => => => => ## Default: 8300 ## w => y => mkfs.fat -F32 ${DISK}1 mkswap ${DISK}2 && swapon ${DISK}2 mkfs.btrfs -f ${DISK}3 ## OPTION [ mkfs.xfs mkfs.ext4 ] mount ${DISK}3 /mnt mkdir /mnt/boot && mount ${DISK}1 /mnt/boot timedatectl set-ntp true ## set systemclock vim /etc/pacman.d/mirrorlist ## choose Mirror Server pacstrap /mnt base linux linux-firmware genfstab -U -p /mnt >> /mnt/etc/fstab ## -p excludes pseudofs mounts arch-chroot /mnt /bin/bash pacman -S vim tmux zsh curl wget git openssh zsh YOURHOSTNAME="ghasshee" echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen echo "ja_JP.UTF-8 UTF-8" >> /etc/locale.gen echo "ru_RU.UTF-8 UTF-8" >> /etc/locale.gen locale-gen echo LANG=en_US.UTF-8 > /etc/locale.conf ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime hwclock --systohc --utc echo $YOURHOSTNAME > /etc/hostname echo "127.0.0.1 localhost" >> /etc/hosts pacman -S btrfs-progs ## IF(BTRFS(a file system)) ## mkinitcpio -p linux passwd ## Root Password pacman -S grub dosfstools efibootmgr grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub --recheck --debug mkdir /boot/EFI/boot && cp /boot/EFI/arch_grub/grubx64.efi /boot/EFI/boot/bootx64.efi grub-mkconfig -o /boot/grub/grub.cfg pacman -S networkmanager ## IF(wifi) systemctl enable NetworkManager exit reboot ## remove install media ######################################### ## IF(WIFI) nmcli dev wifi connect $WIFINAME password $WIFIPASSWORD ## IF(LAN cable) ## systemctl enable dhcpcd.service && systemctl start dhcpcd.service ## systemctl enable netctl && systemctl start netctl ~~~ ## Hibernate / Deep Sleep Hibernate is a shutdown before which stores memory state into some swap region and shutdown. The next wakeup will resume the machine state precisely. ~~~sh ## add this to kernel parameter `resume=/dev/sda2` thruough grub sudo vim /etc/default/grub #--vim GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=/dev/sda2" #--vim :wq! grub-mkconfig -o /boot/grub/grub.cfg ## Regenerate grub ## then edit /etc/mkinitcpio.conf to add 'resume' sudo vim /etc/mkinitcpio.conf #--vim HOOKS=(base udev autodetect keyboard modconf block filesystems resume fsck) #--vim :wq mkinitcpio -p linux ~~~ # X and GUI Installation ~~~sh ## create user and login useradd -m -g wheel ghasshee pacman -S sudo visudo # decomment Defaults env_keep += "HOME" //set $HOME # decomment %wheel ALL=(ALL) all # :wq! passwd ghasshee ## set password for ghasshee su ghasshee ## X sudo pacman -S xorg-server xorg-apps xorg-xinit xorg-xclock xterm sudo pacman -S xfce4 xfce4-goodies gamin ## YAOURT sudo echo "[archlinuxfr]" >> /etc/pacman.conf sudo echo "SigLevel = Never" >> /etc/pacman.conf sudo echo "Server = http://repo.archlinux.fr/\$arch" >> /etc/pacman.conf sudo pacman -Sy yaourt yaourt -Syua #### if CA is not valid error ## sudo trust extract-compat ## instead of $ update-ca-certificates ## Speed Up Yaourt sudo echo 'MAKEFLAGS="-j8"' >> /etc/makepkg.conf ## install Graphic Driver lspci | grep VGA sudo pacman -Ss xf86-video ## find your driver sudo pacman -S xf86-video-intel ## sudo pacman -S nvidia ## sudo pacman -S nvidia-dkms ## IF(super-new nvidia video card) ## man dkms ## dkms := Dynamic Kernel Module System ## dkms status ## nvidia xxx.xxx installed yaourt -S ttf-ricty ttf-mona otf-takao otf-ipaexfont --noconfirm ## yaourt -S ttf-sazanami --noconfirm ## X11 Keyboard Layout ~~~ localctl list-x11-keymap-models ## list models localctl list-x11-keymap-layouts ## list layouts localctl list-x11-keymap- setxkbmap -print -verbose 10 sudo echo 'LANG=ja_JP.UTF-8' >> /etc/locale.conf ~~~
~~~sh ## Display Manager (Login Manager) sudo pacman -S slim archlinux-themes-slim slim-themes sudo vim /etc/slim.conf # login_cmd exec /usr/bin/zsh -l ~/.xinitrc %session # daemon yes # current_theme archlinux-simplyblack # default_user $YOUTHOSTNAME sudo systemctl enable slim.service ## TEXT sudo pacman -S fcitx-im fcitx-anthy fcitx-configtool ## xinitrc echo 'export GTK_IM_MODULE=fcitx' > ~/.xinitrc echo 'export QT_IM_MODULE=fcitx' >> ~/.xinitrc echo 'export XMODIFIERS="@imi-fcitx"' >> ~/.xinitrc echo 'exec startxfce4' >> ~/.xinitrc ## Russian & Japanese Input2ch sudo pacman -S ibus ibus-anthy ibus-m17n ## Install Dotfiles git clone http://github.com/your/dotfiles ## Apperrance yaourt -S numix-themes-green numix-circle-icon-theme-git ## Sound sudo pacman -S alsa-utils sudo alsactl store ## sudo alsactl init ## ## when Sound not work ## aplay -l ## see which card you want to use ## vim ~/.asoundrc ## or $ vim /etc/asound.conf ## pcm.!default { ## type hw ## card 1 ## } ## ctl.!default { ## type hw ## card 1 ## } sudo pacman -S pulseaudio ## Mouse Driver sudo pacman -S xf86-input-synaptics ## trackpads sudo pacman -S xf86-input-mouse ## Network Time Protocol sudo pacman -S ntp && systemctl enable ntpd ## reboot and login as ghasshee and go ## 1. Application menu > setting > Apperrance ## * style tab : Numix ## * icon tab : Numix Circle ## * font tab : Ritchy ## 2. Application menu > setting > windowManager ## * style tab's theme : Numix ## * style tab's title's font : Ritchy ## Bluetooth sudo pacman -S bluez bluez-utils modprobe btusb sudo systemctl enable bluetooth && sudo systemctl start bluetooth ## conect bluetooth mouse ## $ bluetoothctl ## [bluetooth] list ## Controller ... ## [bluetooth] select ## [bluetooth] power on ## [bluetooth] scan on ## [bluetooth] agent on ## [bluetooth] devices ## push connect button on mouse ## Device ... ## [bluetooth] pair ## [bluetooth] trust ## [bluetooth] connect ## Thunar Supplements sudo pacman -S thunar thunar-volman thunar-media-tags-plugin thunar-archive-plugin file-roller exo-preffered-application ## CLICKING MOUNT TOOL sudo pacman -S gvfs gvfs-afc gvfs-smb gvfs-afp gvfs-gphoto2 gvfs-mtp gvfs-goa ## OH MY ZSH curl -L http://install.ohmyz.sh | sh chsh -s /usr/bin/zsh ## PASSWORDS/USERNAMES MANAGE TOOL FOR FTP/SMB sudo pacman -S seahorse gnome-keyring ## Dropbox yaourt -S dropbox thunar-dropbox ## Install Dotfiles ## Browser sudo pacman -S chromium firefox yaourt -S pepper-flash --noconfirm ## yaourt -S vivaldi vivaldi-ffmpeg-codecs --noconfirm ## this takes much compile time sudo gem install jekyll mechanize ## Tools sudo pacman -S okular ffmpeg atom sshfs expect bc cowsay sl sdcv xsel tree \ arp-scan perl-rename mlocate bc cowsay sl gnuplot sudo updatedb yaourt -S xcalib talking-clock-git festival festival-english festival-us espeak \ vokoscreen cheese --noconfirm espeak --stdout "This is a test." | paplay echo "This is a test." | festival --tts yaourt -S pacaur ## OCaml Haskell Rust sudo pacman -S opam && opam init && opam install utop sudo pacman -S stack && stack install ghci --install-ghc curl https://sh.rustup.rs -sSf | sh ## Music tips sudo pacman -S sox sudo pacman -S libid3tag libmad ## optional library for mp3 sudo pacman -S youtube-dl ## Video Editor (with GUI) sudo pacman -S openshot ## Ethereum mkdir $HOME/ethereum && cd $HOME/ethereum git clone http://www.github.com/paritytech/parity cd parity && cargo build --release sudo pacman -S geth ## HFS / HFS+ (Apple File System) sudo pacman -S hfsprogs ## DVD / mplayer sudo pacman -S dvdauthor sudo pacman -S dvd+rw-tools sudo pacman -S mplayer ## Crontab sudo pacman -S cronie edit cron systemctl enable cronie && systemctl start cronie install_lts_kernel(){ #?? yaourt -S linux-xps13 linux-xps13-headers #?? pgp --keyserver keys.gnupg.net --recv-keys sudo pacman -S linux-lts sudo pacman -R linux sudo rename 's/linux-lts/linux/' /boot/* sudo mkinitcpio -p linux } yaourtlog() {yaourt -S $1 | tee /var/log/yaourt.log} alias yaourt=yaourtlog ~~~ ## etc * guake (install & press F12 ) * vlc (play movies) * launchy (command lancher) * python-pip # XDG https://wiki.archlinux.org/index.php/XDG_Autostart The XDG Autostart specification defines a method for autostarting ordinary desktop entries on desktop environment startup and removable medium mounting, by placing them in specific #Directories. Prerequisites You need to use either a desktop environment that supports it, or a dedicated implementation, like dex, dapperAUR, or fbautostartAUR. Directories The Autostart directories in order of preference are: - user-specific: $XDG_CONFIG_HOME/autostart (~/.config/autostart by default) - system-wide: $XDG_CONFIG_DIRS/autostart (/etc/xdg/autostart by default)[1] System-wide desktop entries can be overridden by user-specific entries with the same filename. To disable a system-wide entry, create an overriding entry containing Hidden=true. For more details, read the specification. # An Old Installation Guide Arch Linux on OLD Laptops - FileSystem : `ext4` - BootLoader : BIOS/GPT ## Make an Install USB Media ~~~sh ## hdiutil convert -format UDRW -o arch.img arch.iso ## IF(VERY OLD .iso) ## mv archl.img.dmg arch.img sudo diskutil list ## lsblk @Linux sudo dd if=arch.img of=/dev/rdiskx bs=100m ~~~ ## Booting USB ~~~ Insert USB => BIOS Setting => turn off UEFI => Save&Exit => choose `i686` ~~~ *************************************** * * * * * .---+------. +-----+ * * |sda1| /boot | |/boot| * * +----+-------+ |sda1 | * * |sda2| swap | +-----+ * * +----+-------+ +-----+/ * * |sda3| /home | | / + * * +----+-------+ |sda4 |\ * * |sda4| / | +-----+ +-----+ * * '---+------' |/home| * * |sda3 | * * '-----+ * * * *************************************** ~~~sh lsblk gdisk /dev/sda ## or use `parted` ## o => y => ## '=>' denotes 'Enter key' ## n => => => +1M => ef02 => ## n => => => +8G => 8200 => ## n => => => +64G => => ## n => => => => => ## w => y => ## determine filesystem mkfs.ext2 /dev/sda1 mkfs.ext4 /dev/sda3 mkfs.ext4 /dev/sda4 mkswap /dev/sda2 && swapon /dev/sda2 ## DO NOT MOUNT /dev/sda1 IF(BIOS/GPT) mount /dev/sda3 /mnt mount /dev/sda4 /mnt/home ~~~
...
~~~ ## IF(BIOS/GPT) pacman -S grub-bios lsblk DISK=/dev/sdx grub-install --recheck ${DISK} grub-mkconfig -o /boot/grub/grub.cfg ~~~ ## wifi tips ### WPA2 Enterprize WPA2 Enterprise is a mode of Wi-Fi Protected Access. It provides better security and key management than WPA2 Personal, and supports other enterprise-type functionality, such as VLANs and NAP. However, it requires an external authentication server, called "RADIUS" server to handle the authentication of users. This is in contrast to Personal mode which does not require anything beyond the wireless router or access points (APs), and uses a single passphrase or password for all users. The Enterprise mode enables users to log onto the Wi-Fi network with a username and password and/or a digital certificate. Since each user has a dynamic and unique encryption key, it also helps to prevent user-to-user snooping on the wireless network, and improves encryption strength. This section describes the configuration of network clients to connect to a wireless access point with WPA2 Enterprise mode. See Software access point#RADIUS for information on setting up an access point itself. # After Instalation ## /var * `/var partition >= 4-8 GB ` will suit * `/var/cache/pacman/pkg` : installed packages if `/var` is full, use ~~~sh fduparch.sh ## mv compressed files into HOME dir. ~~~ ## AUR * AUR is not secure. * when AUR is installed, check `PKGBUIKLD`. * when you changed 'mirror server', do `pacman -Syu` ## linux-lts (syslinux) 1. ` pacman -S linux-lts ` 2. edit /boot/grub/grub.cfg * vmlinuz-linux => vmlinuz-linux-lts * initramfs-linux.img => initramfs-linux-lts.img ## update Every two weeks, do ~~~sh pacman -Syu ## system update ~~~ Read `Arch News` in system update ## config files * `.pacnew` : used when the updated software has new config * `.pacsave` : when software is uninstalled, the config file will get this file extention. * `.pacorig` : special cases * edit ` config ` files only after copy it; ` cp config config.bak ` ## Tools ~~~sh pacdiff ## a useful tool pacmatic ## pacman wrapper which will automate the confirmation process of Arch News. pacmatic ## warns when configs are unused or updated. pacmatic ## can be an alias of `pacman` ~~~ ## DO NOT * DO NOT USE `pacman` with `-f` option. * DO NOT USE `pacman -Rdd` : `-d` flag ignores dependencies. * DO NOT USE `pacman -Scc` : old packages are needed. intead `pacman -Sc` ## Revert Unstable Upgrades ~~~ pacman -U /var/cache/pacman/pkg/PKGNAME.pkg.tar.gz ~~~ ## Backup BackUp the Installed List ~~~sh pacman -Qqne > /path/to/dir/pkg.list ~~~ Recovery ~~~sh pacman -S --needed $(< /path/to/dir/pkg.list) ~~~ Backup these dir once a month * `/etc` * `/home` * `/srv` : * `/var` Backup `/etc` ~~~sh tar -cjf /path/to/dir/etc-backup.tar.bz /etc ~~~ Recover `/etc` ~~~sh cd / tar -xvjf etc-backup.tar.bz2 ~~~ ## Security News * READ `Common Vulnerabilities and Exposure` from `National Vulnerability Database` * Arch News ? # Linux Kernel Compilation ## Prerequisity ~~~sh sudo pacman -S base-devel sudo pacman -S xmlto docbook-xsl ## recommend ~~~ ## Download Kernel Src ~~~sh mkdir ~/kernelbuild cd ~/kernelbuild wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.8.6.tar.xz tar -xvJf linux-4.8.6.tar.xz cd linux-4.8.6/ make clean && make mrproper ~~~ ## Configuration ~~~sh pwd ## ~/kernelbuild/linux-4.8.6 zcat /proc/config.gz > .config ## ensure that all devices are connected make localmodconfig ## Advanced Configuration # make menuconfig ## commandLine ncurses interface # make nconfig ## Newer ncurses interface # make xconfig ## User-friendly graphical interface that requires packageki-qt4 # make gconfig ## Graphical configuration similar to xconfig using gtk # lspci -k ## (from LiveCD) lists names of kernel modules in use ~~~ ## Compile the kernel ~~~sh make ~~~ ## Compile Modules ~~~sh sudo make modules_install ~~~ ## Copy the kernel to /boot dir ~~~sh ## 32 bit (i686) kernel sudo cp -v arch/x86/boot/bzImage /boot/vmlinux-linux48 ## 64 bit (x86_64) kernel sudo cp -v arch/x86_64/boot/bzImage /boot/vmlinux-linux48 ~~~ ## Make Initial RAM disk ~~~sh sudo cp /etc/mkinitcpio.d/linux.preset /etc/mkinitcpio.d/linux48.preset sudo vim /etc/mkinitcpio.d/linux48.preset --- ALL_kver="/boot/vmlinuz-linux48" default_image="/boot/initramfs-linux48.img" fallback_image="/boot/initramfs-linux48-fallback.img" --- :wq! mkinitcpio -p linux48 ~~~ or ~~~sh mkinitcpio -k linux-4.8.6 -g /boot/initramfs-linux48.img ~~~