Saturday 19 October 2013

Using Haskell in Arch Linux (virtualbox machine under ubuntu 13.04)

1. Install U13.04
2. Install virtualbox
3. Install Arch 13.10 under virtual box
guide: https://wiki.archlinux.org/index.php/Official_Arch_Linux_Install_Guide
guide2: https://wiki.archlinux.org/index.php/Beginners%27_Guide

once arch.live is loaded,
# loadkeys us
# setfont Lat2-Terminus16
# nano /etc/locale.gen
uncomment en_US.UTF-8 UTF-8
# locale-gen
# export LANG=en_US.UTF-8
run dhcp service to get ip
# systemctl enable dhcpcd.service
# ping www.google.com -c 3
check if ip is received
GPT did not work smoothly, so using MBR
# fdisk /dev/sda
enter o
enter p
enter 1
enter 2048
enter xxxxxxxx length of partition
    and so on until all partitions created
enter p to preview
type w to write
enter q to quit
# mkfs.ext4 /dev/sda1
# lsblk /dev/sda
shows partition
# mount /dev/sda1 /mnt
# nano /etc/pacman.d/mirrorlist
find an appropriate mirror, Alt+6 to copy line, Ctrl+U to paste line, Ctrl+X, save and exit
# pacstrap -i /mnt base
# genfstab -U -p /mnt >> /mnt/etc/fstab
# nano /mnt/etc/fstab
check if the last field is 1

# arch-chroot /mnt
or arch-chroot /mnt /bin/bash
# nano /etc/locale.gen
uncomment en_US.UTF-8 UTF-8
# locale-gen
# echo LANG=en_US.UTF8 UTF-8 > /etc/locale.conf
# export LANG=en_US.UTF8
# loadkeys us
# setfont Lat2-Terminus16
# nano /etc/vconsole.conf
 KEYMAP=us
 FONT=Lat2-Terminus16
# ln -s /usr/share/zoneinfo/America/Toronto /etc/localtime
# hwclock --systohc --utc
# echo archTest > /etc/hostname
# systemctl enable dhcpcd.service
# cd /etc/netctl
# cp examples/ethernet-dhcp my_network
# nano my_network
configure accordingly
# netctl enable my_network
for wireless, AFTER reboot not as a chroot, OR just configure as above
# pacman -S iw wpa_supplicant
# pacman -S dialog
# wifi-menu  wlan0
# mkinitcpio -p linux
# nano /etc/mkinitcipo.conf
 MODULES="virtio virtio_blk virtio_pci virtio_net"
# passwd
set root passwd
# pacman -S grub
# grub-install --target=i386-pc --recheck /dev/sda
# grub-mkconfig -o /boot/grub/grub.cfg
# exit

# umount -R /mnt
# reboot

4. Install Haskell
guide:https://wiki.archlinux.org/index.php/Haskell_package_guidelines

# nano /etc/pacman.conf
add following lines before [extra]
 [haskell-core]
 Server = http://xsounds.org/~haskell/core/$arch
 [haskell-happstack]
 Server = ftp://noaxiom.org/$repo/$arch
 [haskell-web]
 Server = http://archhaskell.mynerdside.com/$repo/$arch
save and exit to add keys
# pacman-key -r 4209170B
# pacman-key --lsign-key 4209170B
# pacman-key -r B0544167
# pacman-key --lsign-key B0544167
# pacman -Syy
force refresh all package list



Monday 7 October 2013

Set up raspberry pi wifi dongle wireless manually command line

Ralink RT5370 on Raspberry Pi wheezy linux

On terminal;

uname -a
3.6.11+

sudo dmesg
 Error - Invalid RF chipset / Error - Failed to allocate device -> go to "svay.com" link
sudo nano /etc/modprobe.d/blacklist.conf (check here on error)
sudo nano /etc/modprobe.d/raspi-blacklist.conf
then comment out(#) blacklist rt5370, blacklist rt2x00usb



 New USB device found, idVendor=xxxx
 usb 1-1.2.6: Product: 802.11 n WLAN -> good

lsusb
Bus 001 Device 006: ID 148f:5370 Ralink Technology, Corp. RT 5370 Wireless Adapter

check if the wifi usb dongle is recognized.

 ----------/etc/network/interfaces-----------------
auto lo
 
iface lo inet loopback
iface eth0 inet dhcp

#auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

------------------------------------------------------------------

---------/etc/wpa_supplicant/wpa_supplicant.conf-----------
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
 
network={
        ssid="SSID"
        psk="password"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP WEP104 WEP40
        auth_alg=OPEN
} 

network={
        ssid="SSID"

        key_mgmt=NONE


        auth_alg=OPEN
        wep_key0=1234509876 

} 

 
network={
        ssid="YOURSSID"
        scan_ssid=1
        key_mgmt=WPA-PSK
        proto=WPA
        psk="YOURPASSWORD"
}

--------------------------------------------------------------------------------------

Now enable the modem.
sudo ifup wlan0

On boot connection ------------- /etc/rc.local-------------add--
echo "Starting Wifi.."
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
sleep .5s
dhclient wlan0
echo "Wifi started.."

exit 0
--------------------------------------------------------------------------------------
**file names used exactly, it may vary
Disable power management of usb wifi dongle -- /etc/modprobe.d/*8192cu.conf
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

Ping router every minute on cron
crontab -e ---------------------add
*/1 * * * * ping -c 1 192.168.0.1 #modify this address to router address
--------------------------------------------

------------------to skip rc.local---------- plastikman 20130216---------
auto lo wlan0

iface lo inet loopback
iface eth0 inet dhcp

#auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
-----------------------------------------------------------------------------------------------


Sources: raspberrypi.org/phpBB3/viewtopic.php?f=28&t=47830
http://svay.com/blog/setting-up-a-wifi-connection-on-the-raspberrypi/
above are direct sources (i.e. copy+paste)

http://www.raspberrypi.org/phpBB3/viewtopic.php?t=6256&p=189260
 this is supplementary