SyntaxHighlighter

2015年6月21日星期日

Arch Linux install procedure

2015-6-20
https://wiki.archlinux.org/

Pre-installation
fdisk
mkfs.ext4 -j /dev/sda1
mount /dev/sda1 /mnt
wifi-menu #connect to internet

Installation
# cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
# sed -i 's/^#Server/Server/' /etc/pacman.d/mirrorlist.backup
# rankmirrors -n 6 /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist
pacstrap /mnt base

Configure the system
genfstab -p /mnt >> /mnt/etc/fstab
arch-chroot /mnt
echo computer_name > /etc/hostname
ln -sf /usr/share/zoneinfo/Asia/Chongqing /etc/localtime
vi /etc/locale.gen # uncomment en_US.UTF-8
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
mkinitcpio -p linux
pacman -S grub
grub-install --target=i386-pc --recheck --debug /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
passwd
pacman -S openssh
pacman -S wpa_actiond ifplugd wpa_supplicant dhcpcd dialog ppp #wifi-menu need
exit
umount -R /mnt
shutdown -r now

Configure after Arch install
systemctl enable sshd
wifi-menu -o #setup wifi after reboot
systemctl enable netctl
pacman -S net-tools #ifconfig netstat
systemctl enable systemd-timesyncd

Audio
pacman -S alsa-utils
useradd -m jejer
usermod -aG audio jejer
#alsamixer

X
pacman -S xorg-server # reinstall if you add user after xorg-server install
pacman -S ttf-droid # Chinese font
pacman -S tigervnc # for VNC server
vi ~/.vnc/xstartup
#!/bin/sh
export XKL_XMODMAP_DISABLE=1
exec startxfce4

xfce
pacman -S xfce4
startxfce4 #start X with xfce window manager manually

fcitx pinyin
pacman -S fcitx-im
pacman -S fcitx-configtool #configure for GTK
pacman -S fcitx-googlepinyin


PS:
setup proxy for some applications:
export ALL_PROXY="socks5://192.168.88.3:8080"

FIX Problem with pacman update - Signature is unknown trust
rm -R /etc/pacman.d/gnupg
pacman-key --init
pacman-key --populate archlinux


2015年6月5日星期五

Enable UTF-8 support for linkstation

Add LANG=en_US.UTF-8 in /root/.bashrc

-------------------
proftpd fix

1. create /root/ftpd.sh according to /etc/init.d/ftpd.sh
add function
force_utf8()
{
        if [ -f /etc/proftpd/proftpd.conf ]; then
                cp /etc/proftpd/proftpd.conf /etc/proftpd/proftpd.conf.original
                sed -i -e 's/CP936/UTF-8/g' /etc/proftpd/proftpd.conf
        fi
        sync
        sleep 1
}

add force_utf8 call in start()

#! /bin/sh
#

KIND="FTPD"
FTPDOPTIONS=
RETVAL=0

if [ -f /etc/melco/info ]; then
        . /etc/melco/info
fi

configure()
{
        if [ -f /etc/linkstation_release ]; then
                ## configure files from Buffalo parameters.
                echo "configure ftpd"
                /usr/local/sbin/nas_configgen -c proftpd
                if [ $? -ne 0 ]; then
                        echo "$0 configure fail"
                        exit 1
                fi
        fi
        sync
        sleep 1
}

force_utf8()
{
        if [ -f /etc/proftpd/proftpd.conf ]; then
                cp /etc/proftpd/proftpd.conf /etc/proftpd/proftpd.conf.original
                sed -i -e 's/CP936/UTF-8/g' /etc/proftpd/proftpd.conf
        fi
        sync
        sleep 1
}

start()
{
        if [ "$ftp" != "on" ] ; then
                echo "ftp is OFF"
                exit 0
        fi
        configure
        force_utf8
        echo -n $"Starting $KIND services: "
        /usr/local/sbin/proftpd $FTPDOPTIONS
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ftpd || \
           RETVAL=1
        return $RETVAL
}

stop() {
        echo -n $"Shutting down $KIND services: "
        killall proftpd
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ftpd
        echo ""
        return $RETVAL
}

restart() {
        stop
        start
}

reload() {
        echo -n $"Reloading proftpd.conf file: "
        killall -HUP proftpd
        RETVAL=$?
        echo
        return $RETVAL
}

#
# Usage statement.
#

case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart)
                restart
                ;;
        reload)
                reload
                ;;
        *)
                echo "usage: $0 {start|stop|restart|reload}"
                exit 1
                ;;
esac



2. create S99_fix_ftp.sh in /etc/rc.d/extensions.d
and chmod +x S99_fix_ftp.sh
root@ls-qvl:/etc/rc.d/extensions.d# cat S99_fix_ftp.sh
#! /bin/sh
#

/bin/cp /root/ftpd.sh /etc/init.d/ftpd.sh
/etc/init.d/ftpd.sh restart