pancakelizard

set up a HP Microserver with Ubuntu and everything you need

Posted on February 17, 2012

this isnt the final version of this, but it has been sat here for a while, so figured i should at least share my initial progress on it

So i bought a HP microserver. loaded it full of drives and stuck ubuntu server on it. below is a bit of a HOWTO/build script. DO NOT RUN IT AS A SCRIPT. it will not work. instead read through it and do it by hand in chunks. you WILL need to change some stuff.

but it should give you a good start into building your own with sabnzbd, sick beard, squeezebox server, and loads more. Since doing this, i have moved from greyhole to GLUSTER as my JBOD filesystem as well as installing AFP as samba performance on my mac was poor. I'll get round to finishing it off at some point...

enjoy!

 

################################################ ubuntu 11.04 server setup:

select region/keyboard settings as needed
enter servername. in this case i am using "microserver"
disk setup as appropriate (i used guided with lvm) and
set up username/password (in my case i used "wanye" and dont encrypt your home folder
enter proxy information if necessary
select "install security updates automatically"
select "OpenSSH server" from the list of server modules to install (we will install the rest later as we need them)
remove cd/usb and reboot when completed
log in and find the ip address of the server (in my case 192.168.1.238)
config files needed:
/etc/lighttpd/lighttpd.conf
/root/.rtorrent.rc
/var/www/rutorrent/conf/config.php
/etc/default/sabnzbdplus
/home/wanye/rtorrentInit.sh

(optional) binary files needed:
squeezeboxserver_7.6.1_all.deb (or latest version from mysqueezebox.com)

(optional) web server frontend link page:
index.html
icon-webmin.png
pixel.png
rtorrent.png
rutorrent.png
sabnzbd.png
sickbeard.png
squeezebox.png
(to be copied to /var/www once completed)
################################################ network config and initial setup

#set up static IP address instead of DHCP and add hosts entries
sudo nano /etc/hosts
-------------------
127.0.0.1 localhost microserver
192.168.1.250 microserver
192.168.1.10 nas #This is optional and depends on your personal setup
-------------------

sudo nano /etc/network/interfaces
-------------------
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.250
netmask 255.255.255.0
gateway 192.168.1.1

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

sudo nano /etc/resolv.conf
-------------------
### ensure your DNS servers are listed
192.168.1.1
194.168.4.100
194.168.8.100
-------------------

################################################ reboot
sudo shutdown -r now
################################################ install additional modules needed for things
sudo apt-get install git-core python smbfs subversion libncurses5-dev libsigc++-2.0-dev libcurl4-openssl-dev build-essential screen wget unzip unrar php5 pkg-config libperl-dev libterm-readline-gnu-perl php5-cgi php5-curl php5-cli ffmpeg

################################################ mount samba share on NAS/server
sudo mkdir /mnt/nas
sudo nano /etc/fstab

##### add in the following
//nas/share /mnt/nas cifs guest,uid=1000,iocharset=utf8,codepage=unicode,unicode 0 0

sudo mount -a
################################################ install webmin
sudo nano /etc/apt/sources.list

add the following to the bottom:
-------------------
deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
-------------------

wget http://www.webmin.com/jcameron-key.asc

sudo apt-key add jcameron-key.asc
sudo apt-get update
sudo apt-get install webmin

sudo nano /etc/webmin/miniserv.users
##### add your username to list
sudo /etc/init.d/webmin restart

try logging into https://192.168.1.250:10000/ as your user

################################################ install rtorrent and gui
sudo apt-get install lighttpd
sudo nano /etc/lighttpd/lighttpd.conf
OR
sudo cp /home/wanye/lighttpd.conf /etc/lighttpd/lighttpd.conf
sudo /etc/init.d/lighttpd restart
##### add settings as required for rtorrent

# create download directory for rtorrent
sudo mkdir /data /data/torrentdownloads /data/torrentdownloads/.session

### compile libtorrent from source
cd /tmp
sudo wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.12.9.tar.gz
sudo tar zxfv libtorrent-0.12.9.tar.gz
cd libtorrent-0.12.9
sudo ./configure
sudo make
sudo make install
### compile xmlrpc-c from source
cd /tmp
sudo svn checkout http://xmlrpc-c.svn.sourceforge.net/svnroot/xmlrpc-c/stable xmlrpc-c
cd xmlrpc-c/
sudo ./configure
sudo make
sudo make install
### compile rtorrent from source
cd /tmp
sudo wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.8.9.tar.gz
sudo tar zxfv rtorrent-0.8.9.tar.gz
cd rtorrent-0.8.9
sudo ./configure --with-xmlrpc-c
sudo make
sudo make install

sudo ldconfig

### install rutorrent and plugins from svn

cd /var/www/
sudo svn co http://rutorrent.googlecode.com/svn/trunk/rutorrent
sudo svn up
### plugins dl
cd /var/www/rutorrent/
sudo rm -rf plugins/
sudo svn co http://rutorrent.googlecode.com/svn/trunk/plugins/
sudo svn up

### configure rtorrent
sudo nano /root/.rtorrent.rc
OR
sudo cp /home/wanye/.rtorrent.rc /root/.rtorrent.rc

sudo nano /var/www/rutorrent/conf/config.php
OR
sudo cp /home/wanye/config.php /var/www/rutorrent/conf/config.php
sudo chmod -R 747 /var/www/rutorrent/
sudo chown -R www-data:www-data /var/www/rutorrent/share/
sudo /etc/init.d/lighttpd restart

#### set it to autostart on reboot
sudo cp /home/wanye/rtorrentInit.sh /etc/init.d/rtorrent
sudo chmod +rx /etc/init.d/rtorrent
sudo update-rc.d rtorrent defaults

#### install mediainfo module for rutorrent plugin
sudo apt-get install --reinstall python-software-properties && sudo dpkg-reconfigure python-software-properties
sudo add-apt-repository ppa:shiki/mediainfo
sudo apt-get update
sudo apt-get install mediainfo

################################################ reboot and test rtorrent autostarts ok
sudo shutdown -r now
################################################ install sabnzbd, sickbeard, couchpotato and usenet tools

# install sabnzbd
echo "deb http://ppa.launchpad.net/jcfp/ppa/ubuntu $(lsb_release -c -s) main" | sudo tee -a /etc/apt/sources.list && sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:11371 --recv-keys 0x98703123E0F52B2BE16D586EF13930B14BB9F05F
sudo apt-get update
sudo apt-get install sabnzbdplus
sudo nano /etc/default/sabnzbdplus
##### set up sab config

/etc/init.d/sabnzbdplus start

------------------------------
# [required] user or uid of account to run the program as:
USER=wanye

# [optional] full path to the configuration file of your choice;
# otherwise, the default location (in $USER's home
# directory) is used:
CONFIG=

# [optional] hostname/ip and port number to listen on:
HOST=192.168.1.250
PORT=8080
-------------------------------

####### point your web browser at http://192.168.1.250:8080 and follow setup instructions
# install couchpotato movie grabber
cd /usr/local/sbin
sudo git clone http://github.com/RuudBurger/CouchPotato.git
sudo mv CouchPotato couchpotato
cd couchpotato
sudo python CouchPotato.py -d
cd /usr/local/sbin/couchpotato
sudo cp initd /etc/init.d/couchpotato
sudo chmod a+x /etc/init.d/couchpotato
sudo update-rc.d couchpotato defaults
sudo /etc/init.d/couchpotato start

####### point your web browser at http://192.168.1.250:5001 and follow setup instructions

# install sickbeard tv grabber
sudo apt-get install python-cheetah
git clone git://github.com/midgetspy/Sick-Beard.git my-sickbeard-install
python SickBeard.py

################################################ install squeezebox server
sudo dpkg -i squeezeboxserver_7.6.1_all.deb

####### point your web browser at http://192.168.1.250:9000 and follow setup instructions
################################################ install greyhole for later use
wget https://github.com/downloads/gboudreau/Greyhole/greyhole-0.9.12-1.amd64.deb
sudo apt-get install samba
sudo apt-get -f install
sudo dpkg -i greyhole-0.9.12-1.amd64.deb

################################################ reboot
sudo shutdown -r now

copy web frontend links to /var/www - index.html and shortcut icons
point web browser at http://192.168.1.250 and ensure tall the links work ok.

removing line numbers from the bash history

Posted on September 15, 2011

i set up a server recently, but something got messed up and i had to reinstall, so instead of building it all again by hand, i simply took the contents of the bash history and edited it down to a script that will autoinstall everything in future.

history | sed 's/^ *[0-9]* *//' > serverinstallscript.sh

is the commend needed to remove the lines in front so you can easily create your own bash script...

Filed under: geek, HOWTO No Comments

ubuntu 10.10 network icon disappearing overnight and losing wireless connection.

Posted on August 19, 2011

I started having this problem a couple of days ago, my work laptop (usually on 24/7)would lose its network connections in ubuntu 10.10 overnight, however, any virtualbox machines would still keep whatever (wired) connection they were using. this has been happening the last two nights for some reason.

anyway, after checking various logs, i came across the "cfg80211: All devices are disconnected, going to restore regulatory settings" error, and googling brought me to http://azitech.wordpress.com/2010/02/22/deauthenticating-reason3/

All the posts helped, but after killing the single instance of wpa_supplicant, it still wasnt working.

in my case, the network-manager applet icon had also disappeared from my menubar. after running "nm-applet" my connections all came back to life. job done!

wanye@mylaptop:~$ tail /var/log/messages
Aug 18 16:11:07 mylaptop kernel: [28937.420256] usb 2-1.2: USB disconnect, address 5
Aug 18 22:00:22 mylaptop kernel: [49850.084038] cfg80211: Calling CRDA to update world regulatory domain
Aug 18 22:00:33 mylaptop kernel: [49862.749263] cfg80211: World regulatory domain updated:
Aug 18 22:00:33 mylaptop kernel: [49862.749268] (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
Aug 18 22:00:33 mylaptop kernel: [49862.749270] (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
Aug 18 22:00:33 mylaptop kernel: [49862.749273] (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
Aug 18 22:00:33 mylaptop kernel: [49862.749280] (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
Aug 18 22:00:33 mylaptop kernel: [49862.749283] (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
Aug 18 22:00:33 mylaptop kernel: [49862.749286] (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
Aug 19 07:41:16 mylaptop rsyslogd: [origin software="rsyslogd" swVersion="4.2.0" x-pid="1079" x-info="http://www.rsyslog.com"] rsyslogd was HUPed, type 'lightweight'.

wanye@mylaptop:~$ dmesg
[49850.003854] iwlagn 0000:02:00.0: ACTIVATE a non DRIVER active station id 0 addr 00:xx:xx:xx:xx:31
[49850.046225] wlan0: deauthenticating from 00:xx:xx:xx:xx:31 by local choice (reason=3)
[49850.084028] cfg80211: All devices are disconnected, going to restore regulatory settings
[49850.084035] cfg80211: Restoring regulatory settings
[49850.084038] cfg80211: Calling CRDA to update world regulatory domain
[49862.749263] cfg80211: World regulatory domain updated:
[49862.749268] (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[49862.749270] (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[49862.749273] (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[49862.749280] (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[49862.749283] (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[49862.749286] (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)

wanye@mylaptop:~$ tail -40 /var/log/daemon.log
Aug 18 16:24:16 mylaptop NetworkManager[1109]: (wlan0): supplicant connection state: group handshake -> complete
Aug 18 16:24:35 mylaptop wpa_supplicant[1324]: WPA: Group rekeying completed with 00:xx:xx:xx:xx:31 [GTK=TKIP]
Aug 18 16:24:35 mylaptop NetworkManager[1109]: (wlan0): supplicant connection state: completed -> group handshake
Aug 18 16:24:35 mylaptop NetworkManager[1109]: (wlan0): supplicant connection state: group handshake -> completed
Aug 18 17:08:11 mylaptop NetworkManager[1109]: (wlan0): supplicant connection state: completed -> group handshake
Aug 18 17:08:11 mylaptop wpa_supplicant[1324]: WPA: Group rekeying completed with 00:xx:xx:xx:xx:31 [GTK=TKIP]
Aug 18 17:08:11 mylaptop NetworkManager[1109]: (wlan0): supplicant connection state: group handshake -> completed
Aug 18 17:23:48 mylaptop dhclient: DHCPREQUEST of 192.168.2.30 on wlan0 to 192.168.2.1 port 67
Aug 18 17:23:48 mylaptop dhclient: DHCPACK of 192.168.2.30 from 192.168.2.1
Aug 18 17:23:48 mylaptop NetworkManager[1109]: (wlan0): DHCPv4 state changed reboot -> renew
Aug 18 17:23:48 mylaptop NetworkManager[1109]: address 192.168.2.30
Aug 18 17:23:48 mylaptop NetworkManager[1109]: prefix 24 (255.255.255.0)
Aug 18 17:23:48 mylaptop NetworkManager[1109]: gateway 192.168.2.1
Aug 18 17:23:48 mylaptop NetworkManager[1109]: nameserver '192.168.2.1'
Aug 18 17:23:48 mylaptop NetworkManager[1109]: domain name 'Belkin'
Aug 18 17:23:48 mylaptop dhclient: bound to 192.168.2.30 -- renewal in 37383 seconds.
Aug 18 17:38:21 mylaptop wpa_supplicant[1324]: WPA: Group rekeying completed with 00:xx:xx:xx:xx:31 [GTK=TKIP]
Aug 18 17:38:21 mylaptop NetworkManager[1109]: (wlan0): supplicant connection state: completed -> group handshake
Aug 18 17:38:21 mylaptop NetworkManager[1109]: (wlan0): supplicant connection state: group handshake -> completed
Aug 18 17:38:41 mylaptop wpa_supplicant[1324]: WPA: Group rekeying completed with 00:xx:xx:xx:xx:31 [GTK=TKIP]
Aug 18 17:38:41 mylaptop NetworkManager[1109]: (wlan0): supplicant connection state: completed -> group handshake
Aug 18 17:38:41 mylaptop NetworkManager[1109]: (wlan0): supplicant connection state: group handshake -> completed
Aug 18 17:38:44 mylaptop wpa_supplicant[1324]: WPA: Group rekeying completed with 00:xx:xx:xx:xx:31 [GTK=TKIP]
Aug 18 17:38:44 mylaptop NetworkManager[1109]: (wlan0): supplicant connection state: completed -> group handshake
Aug 18 17:38:44 mylaptop NetworkManager[1109]: (wlan0): supplicant connection state: group handshake -> completed
Aug 18 18:43:38 mylaptop wpa_supplicant[1324]: WPA: Group rekeying completed with 00:xx:xx:xx:xx:31 [GTK=TKIP]
Aug 18 18:43:38 mylaptop NetworkManager[1109]: (wlan0): supplicant connection state: completed -> group handshake
Aug 18 18:43:38 mylaptop NetworkManager[1109]: (wlan0): supplicant connection state: group handshake -> completed
Aug 18 22:00:20 mylaptop NetworkManager[1109]: (wlan0): device state change: 8 -> 3 (reason 38)
Aug 18 22:00:20 mylaptop NetworkManager[1109]: (wlan0): deactivating device (reason: 38).
Aug 18 22:00:20 mylaptop NetworkManager[1109]: (wlan0): canceled DHCP transaction, DHCP client pid 2092
Aug 18 22:00:21 mylaptop wpa_supplicant[1324]: CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys
Aug 18 22:00:22 mylaptop avahi-daemon[1113]: Withdrawing address record for 192.168.2.30 on wlan0.
Aug 18 22:00:22 mylaptop avahi-daemon[1113]: Leaving mDNS multicast group on interface wlan0.IPv4 with address 192.168.2.30.
Aug 18 22:00:22 mylaptop avahi-daemon[1113]: Interface wlan0.IPv4 no longer relevant for mDNS.
Aug 18 22:00:29 mylaptop ntpd[2199]: sendto(172.16.198.81) (fd=20): Invalid argument
Aug 18 22:01:34 mylaptop ntpd[2199]: sendto(172.16.198.81) (fd=20): Invalid argument
Aug 18 22:02:38 mylaptop ntpd[2199]: sendto(172.16.198.81) (fd=20): Invalid argument
Aug 18 22:03:41 mylaptop ntpd[2199]: sendto(172.16.198.81) (fd=20): Invalid argument
Aug 18 22:03:53 mylaptop ntpd[2199]: Deleting interface #4 wlan0, 192.168.2.30#123, interface stats: received=0, sent=768, dropped=4, active_time=50101 secs

wanye@mylaptop:~$ ps -ef|grep wpa_supplicant
root 1324 1 0 Aug18 ? 00:00:00 /sbin/wpa_supplicant -u -s
wanye 10435 4846 0 08:29 pts/1 00:00:00 grep --color=auto wpa_supplicant
wanye@mylaptop:~$ ps -ef|grep network
wanye 10437 4846 0 08:31 pts/1 00:00:00 grep --color=auto network

wanye@mylaptop:~$ sudo kill 1324
[sudo] password for wanye:
wanye@mylaptop:~$ ps -ef|grep wpa_supplicant
root 10441 1 0 08:32 ? 00:00:00 /sbin/wpa_supplicant -u -s
wanye 10448 4846 0 08:32 pts/1 00:00:00 grep --color=auto wpa_supplicant

wanye@mylaptop:~$ nm-applet
** Message: applet now removed from the notification area
** Message: applet now embedded in the notification area
** (nm-applet:10554): DEBUG: old state indicates that this was not a disconnect 0
** (nm-applet:10554): DEBUG: foo_client_state_changed_cb
** (nm-applet:10554): DEBUG: foo_client_state_changed_cb

how to use the Sony NW-A3000 without that godawful connect software….

Posted on October 20, 2006

ok, I got me a Sony NWA3000 20gb mp3 player recently. I was fully aware of the horrow that was the connect software that came bundled with it, and only knew about the Sonicstage software that sony were providing as a replacement. I wanted to try and find some alternatives for sonicstage. Prefeably of the opensource variety... Normally this site doesnt do geeky stuff like this, but I thought there was a distinct lack of decent articles on what to do, so publishing here was the best bet.
So what did I find?