Showing posts with label archlinux. Show all posts
Showing posts with label archlinux. Show all posts

2016-11-28

Installing AeroSpike on ArchLinux

As benchmarked previously (more than half year ago since this blog post written), AeroSpike has awesome search/retrieval performance. In this tutorial we will learn how to install AeroSpike on ArchLinux

wget -O aerospike.tgz 'http://aerospike.com/download/server/latest/artifact/tgz'
tar -xvfz aerospike.tgz
cd aerospike-server
./bin/aerospike init

Configure the etc/aerospike.conf into something like this:

service {
  user YOUR_USERNAME
  group YOUR_GROUP
  run-as-daemon
  paxos-single-replica-limit 1 
  pidfile /home/YOUR_USERNAME/aerospike-server/var/run/aerospike.pid
  transaction-queues 8
  transaction-threads-per-queue 8
  transaction-pending-limit 255 # HOT KEY ERROR WORKAROUND FOR INCREMENT
  proto-fd-max 15000
  work-directory /home/YOUR_USERNAME/aerospike-server/var
}

logging {
  file /home/YOUR_USERNAME/aerospike-server/var/log/aerospike.log {
    context any info
  }
}

mod-lua {
  system-path /home/YOUR_USERNAME/aerospike-server/share/udf/lua
  user-path /home/YOUR_USERNAME/aerospike-server/var/udf/lua
}

network {
  service {
    address any
    port 3333 # USE DIFFERENT PORT IF CONFLICT 
    #reuse-address # COMMENT/REMOVE THIS PART
  }
  heartbeat {
    mode multicast
    multicast-group 239.1.99.222 # CHANGE address INTO multicast-group
    port 9918
    interval 150
    timeout 10
  }
  fabric {
    port 3331 # USE DIFFERENT PORT IF CONFLICT 
  }
  info {
    port 3332 # USE DIFFERENT PORT IF CONFLICT 
  }
}

namespace test {
  replication-factor 2
  memory-size 4G # CHANGE DEPENDS ON YOUR RAM
  default-ttl 0 # CHANGE 30 days, use 0 to never expire/evict.
  storage-engine device {
    file /home/YOUR_USERNAME/aerospike-server/data
    filesize 128M # MAX SIZE OF EACH FILE
  }
}

Then start the server:

./bin/aerospike restart
tail -f var/log/aerospike.log &
./bin/aerospike status

First and last command should show something like this:

info: stopped
info: started
info: process running

Done, now you can test your aerospike server using any client :3

2016-11-25

How to become AUR package adopter?

AUR is ArchLinux User Repository, similar to Ubuntu's Launchpad.
To adopt an orphaned package it's easier than you think! adopt now :3


What you need to do is register, find an orphaned package, then click on the "Adopt Package" link.


Don't forget to set your public key on your "My Account" menu.


After that you can clone the repository, see "Git Clone URL" on the first line of the package, edit and reupload:

git clone ssh://aur@aur.archlinux.org/bla.git
# do some changes on PKGBUILD
git add .
git commit -m 'updated bla package to version X'
git push origin master

Done :3 you have successfully adopt and maintain a package :3

2015-05-09

My ArchLinux's ~/.bashrc

Usually after installing new PC with ArchLinux or Manjaro, I always replace ~/.bashrc with my own version, something like this (just some part of it, I use this on servers):

[ -z "$PS1" ] && return
HISTCONTROL=ignoreboth
shopt -s histappend
HISTSIZE=1000
HISTFILESIZE=2000
shopt -s checkwinsize

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\t\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ '
alias pullpush='git pull && git push origin master'
alias pacInstall='yaourt --needed --noconfirm -S --force'
alias pacManualInstall='yaourt --needed -S'
alias pacFileInstall='sudo pacman -U'
alias pacReinstall='sudo pacman -S'
alias pacDownloadOnly='yaourt --needed --noconfirm -Syuw'
alias pacUpdate='yaourt --needed --noconfirm -Syu'alias pacUpdateAur='yaourt --needed --noconfirm -Syu --aur'
alias pacPurge='yaourt -R'
alias pacPurgeSingle='sudo pacman -Rdd'
alias pacList='pacman -Q'
alias pacListFiles='pacman -Ql'
alias pacShow='pacman -Si'
alias pacMirrors='sudo pacman-mirrors -d /etc/pacman.d/mirrors/ -o /etc/pacman.d/mirrorlist -m rank -g'
alias pacMirrorsUpgrade='sudo pacman-mirrors -g && sudo pacman -Syyuu'
alias pacBelongs='pacman -Qo'
alias pacUnlock='sudo rm /var/lib/pacman/db.lck'
alias scp='rsync -avzP'
alias mv_rsync='rsync -avl --remove-source-files --progress'
alias cp_rsync='rsync -arvl –progress'
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi
export TERM=xterm-256color
export EDITOR=/usr/bin/vim
export PAGER=/usr/bin/most

But of course, make sure that your /etc/pacman.conf already has these lines:

[core]
Include = /etc/pacman.d/mirrorlist

[extra]
Include = /etc/pacman.d/mirrorlist

[community]
Include = /etc/pacman.d/mirrorlist

[multilib]
Include = /etc/pacman.d/mirrorlist

[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch

and you'll need to restart bash, update the repository then install certain dependencies:

sudo pacman -Syu
sudo pacman -Sy yaourt 
pacInstall most vim rsync git

That's it, now your bash has been supercharged :3

2015-02-16

How to reinstall all Linux package

Sometimes when you have a bad electricity in your company/place where you live, your computer may lose some files when blackout happened. Sometimes icons are missing or some program just stopped working. To solve this issue you may reinstall your Linux distribution or alternatively you can just reinstall whole package. In ArchLinux you can type this command to reinstall all native package:

pacman -Qnq | sudo pacman -S - 

In Ubuntu, you can type this command to find for corrupted and missing files on installed package:

sudo apt-get install --reinstall $(sudo dpkg -S $(sudo debsums -c 2>&1 | cut -d " " -f 4 | sort -u) | cut -d : -f 1 | sort -u)

Or if you want to reinstall whole package, you can follow the commands on this link. Your Linux installation now should work correctly.

2014-11-15

How to Prevent ISP's DNS Poisoning

The case was, my fourth ISP redirect every DNS request to their own DNS servers, and the poison certain domain names (for example: Manga sites) to their own server (114.127.223.16). How to prevent this? first of all you'll need to install dnscrypt, this program could encrypt DNS requests, so it's become harder to poison.

pacman -Sy dnscrpyt-proxy

then you'll need to start the service:

sudo systemctl enable dnscrypt-proxy
sudo systemctl start dnscrypt-proxy

then, change your /etc/resolv.conf to localhost:

nameserver 127.0.0.1

voila, now your DNS resolving not poisoned anymore :3 yayy~

2014-07-28

ArchLinux Installation Tutorial

ArchLinux is top 10 major Linux binary-based distribution, but in my opinion, it has the easiest source-based installation process. Here's my past experience of minimal installation process:

First, download latest .iso from https://www.archlinux.org/download/
You may want to burn it or dump to USB flashdrive using this command:

dd bs=4M if=/path/to/archlinux-yyyy.mm.dd-dual.iso of=/dev/your_usb_disk

the /dev/your_usb_disk could be found using dmesg or lsblk or gparted command, for example /dev/sdg

Things to do after preparing the boot CD/USB:

1. Boot your PC using that USB or CD/DVD.

2. Find out which partition or disk to be the installation target, normally I only create 1 or 2 partition that is / (root) for software and /home.

lsblk # find disk name
disk=/dev/vda

Create partition using cfdisk command, set bootable, set partition type (83), write and quit.

cfdisk $disk 

Format partitions and mount it:

part=/dev/vda1
mkfs.ext4 $part
mount $part /mnt

3. Update repository, bootstrap and chroot, this process requires internet, make sure you're connected to the internet using DHCP cable connection.

pacman -Syy
pacstrap -i /mnt base base-devel vim bash openssh curl
genfstab -U -p /mnt >> /mnt/etc/fstab
arch-chroot /mnt

4. Configure language, I always prefer Canada and Indonesia, not US.

bash
loadkeys us

Uncomment en_CA.UTF-8 and id_ID.UTF-8, using vim or nano

vim /etc/locale.gen 
locale-gen
export LANG=en_CA.UTF-8

5. Configure time, for example: Jakarta, Indonesia

location=/usr/share/zoneinfo/Asia/Jakarta
ln -s $location /etc/localtime
hwclock --systohc --utc

Clock correction:

current="2014-07-28 21:15:00"
date -s "$current"

6. Change name, use Google DNS, configure network and enable SSH

echo 'your_hostname' > /etc/hostname
echo nameserver 8.8.8.8 > /etc/resolv.conf
systemctl enable sshd

Uncomment PermitRootLogin yes:

vim /etc/ssh/sshd_config 

Check your network device name, could be eno11, eth0, enp1s0, wlp2s1, or anything else.

ip link
dev=eno1

6a. For permanent DHCP

systemctl enable dhcpcd@$dev

6b. For static address

addr=192.168.20.41
nmask=24
bcast=192.168.20.255
gw=192.168.20.1

6b1. for permanent static address

echo "address=$ipaddr
netmask=$nmask
broadcast=$bcast
gateway=$gw
" > /etc/conf.d/network@interface
curl -L 'http://goo.gl/X8d8k9' > /etc/systemd/system/network@.service
systemctl enable network@$dev

6b2. For temporary static address (gone when reboot)

ip link set dev $dev up
ip addr add $addr/$nmask broadcast $bcast dev $dev
ip route add default via $gw

7. Enable 32-bit repository and set password

vim /etc/pacman.conf # uncomment multilib section
pacman -Sy
passwd # remember!

8. Install and configure bootloader, this part really complicated when you're using UEFI BIOS

pacman -S grub-bios os-prober
grub-install --recheck /dev/vda
grub-mkconfig -o /boot/grub/grub.cfg

9. reboot

exit
exit
reboot


Things to do after reboot:

1. Install yaourt, easy way to use AUR

echo '
[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch
' >> /etc/pacman.conf
pacman -Syy
pacman -Sy yaourt

2. Install desktop environment, one of the lightest DE is Xfce4

pacman -S xfce4 xfce4-goodies gvim gnome-tweak-tool xfwm4 metacity firefox yakuake

3. Install graphic card drivers, this part not required when using intel

# for Nvidia
pacman -Sy xf86-video-nouveau nouveau-dri lib32-nouveau-dri
modprobe nouveau 

# for AMD/ATI
yaourt -Sy catalyst-hook catalyst-libgl catalyst-utils lib32-catalyst-utils lib32-opencl-catalyst opencl-catalyst 

For intel graphic cards mostly you don't need to install additional things other than xorg.
Then reboot or try to start Xserver, see the /var/log/Xorg.0.log file when error

echo exec startxfce4 > ~/.xinitrc
startx

4. Add another admin user

usrnm=your_username
useradd -m -g users -G wheel -s /bin/bash $usrnm
passwd your_username
echo "
%wheel ALL=(ALL) ALL
Defaults:$usrnm timestamp_timeout=86400
" >> /etc/sudoers

5. Install browsers, tools, etc

yaourt --needed --noconfirm -S --force google-chrome chromium traceroute net-tools vlc smplayer sshfs meld gedit bash-completion htop

And so on~ :3