/Build a NAS/HTPC on Ubuntu/XBMC (Software Setup)
接上一篇【硬件篇】
差不多算安装过程中记录流水账,有些因为贪快用英文记录了,望看官海涵。
因为希望安装一个最小化系统,所以下载了Ubuntu minimal 12.04的ISO。找一个不用的U盘(下面称U盘A),在Unix shell下把ISO写到U盘A里:
dd if=mini.iso of=/dev/disk1
将U盘A和新采购用于做系统分区的U盘(下称U盘B)都接到新电脑上,在BOIS里设置好U盘A启动,就开始安装了,安装位置选择到U盘B。将U盘B作为系统盘是参考的OpenMediaVault的方案。好处是即使系统崩溃了,也很容易恢复数据盘上的内容。由于mini版ISO需要实时下载包文件,安装过程会比较长(好在实时下载的都是最新的包,而即便使用完整版ISO,装完之后也要apt-get upgrade,总的时间耗费甚至更长)。之后选择Basic Ubuntu Server, OpenSSH Server和Samba Server三项。用户名设置好,我就选了xbmc。如果你用其它用户名,下面命令中也要相应替换掉。
先设置网卡
vi /etc/network/interfaces
# 文件内容#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.3
netmask 255.255.255.0
gateway 192.168.1.1
vi /etc/resolvconf/resolv.conf.d/tail# 文件内容nameserver 8.8.8.8nameserver 208.67.222.222nameserver 208.67.220.220
/etc/init.d/resolvconf restart
mkdir /media/raidvi /etc/fstab# 文件内容/dev/md127 /media/raid ext4 defaults 0 0
smbpasswd -a xbmcvi /etc/samba/smb.conf# 文件内容security = user (uncomment)usershare allow guests = nomap to guest = never[public] browseable = yes path = /media/raid/pub guest ok = no read only = no create mask = 0664 directory mask = 0775 valid user = xbmc public = no
dd if=/dev/sdc of=/media/raid/os-dd.img
vi /etc/apt/sources.list# 使用速度较快的源,我这里网易的不错deb http://mirrors.163.com/ubuntu/ precise main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ precise main universe restricted multiversedeb http://mirrors.163.com/ubuntu/ precise-security universe main multiverse restricteddeb-src http://mirrors.163.com/ubuntu/ precise-security universe main multiverse restricteddeb http://mirrors.163.com/ubuntu/ precise-updates universe main multiverse restricteddeb http://mirrors.163.com/ubuntu/ precise-proposed universe main multiverse restricteddeb-src http://mirrors.163.com/ubuntu/ precise-proposed universe main multiverse restricteddeb http://mirrors.163.com/ubuntu/ precise-backports universe main multiverse restricteddeb-src http://mirrors.163.com/ubuntu/ precise-backports universe main multiverse restricteddeb-src http://mirrors.163.com/ubuntu/ precise-updates universe main multiverse restricted
安装xbmc及其它视频播放依赖的软件
apt-get install xbmc vainfo i965-va-driver alsa xinit
dpkg-reconfigure X11-common
apt-get install lm-sensorssensors-detect# 全部回车,最后一步 YES (save)# 重启sensors
apt-get install hddtemp# 安装 daemon 部分可以选 Nohddtemp /dev/sda /dev/sdb
gpasswd -a xbmc audiogpasswd -a xbmc video# 确认groups xbmc
cd /etc/initmv tty4.conf tty4.conf.bakmv tty5.conf tty5.conf.bakmv tty6.conf tty6.conf.bak
vi ~/.xinitrc#!/bin/bashexec /usr/bin/xbmc-standalonechmod +x .xinitrcvi ~/.bash_profileif [ x`pidof X` = "x" ] && [ -z "$DISPLAY" ] && [ `awk -F. '{print $1}' /proc/uptime` -lt 60 ] && [ $(tty) == /dev/tty3 ]; thenexec /usr/bin/startx;fiapt-get install mingettyvi /etc/init/tty3.conf#exec /sbin/getty -8 38400 tty3exec /sbin/mingetty --autologin xbmc tty3
wget http://xbmc-addons-chinese.googlecode.com/files/repository.googlecode.xbmc-addons-chinese-eden.zip
If you want to replace the standard Ubuntu boot screen with a custom, XBMC related one TeamXBMC provides the following in its repository:
To install the logo, type the following:
sudo apt-get install plymouth-label v86d sudo wget http://excyle.nl/plymouth-theme-xbmc-logo.deb sudo dpkg -i plymouth-theme-xbmc-logo.deb
Change the Grub-config
sudo nano /etc/default/grub
Add next line to the GRUB_CMDLINE_LINUX_DEFAULT and GRUB_GFXMODE line.
video=uvesafb:mode_option=1366x768-24,mtrr=3,scroll=ywrap GRUB_GFXMODE=1366x768
Change the Initramfs-Module
sudo nano /etc/initramfs-tools/modules
Put this in the file as last line:
uvesafb mode_option=1366x768-24 mtrr=3 scroll=ywrap
sudo nano /etc/initramfs-tools/conf.d/splash
Put this in the file:
FRAMEBUFFER=y
Update grub and the initramfs.
sudo update-grub sudo update-initramfs -u
Reboot
sudo reboot
sudo apt-get install usbmount
sudo vi /etc/usbmount/usbmount.conf
# update the lines
#FS_MOUNTOPTIONS=""
FS_MOUNTOPTIONS="-fstype=ntfs,gid=xbmc,uid=xbmc,umask=002,sync \
-fstype=vfat,gid=xbmc,uid=xbmc,umask=002,sync\
-fstype=ext2,gid=xbmc,uid=xbmc,umask=002,sync \
-fstype=ext3,gid=xbmc,uid=xbmc,umask=002,sync \
-fstype=ext4,gid=xbmc,uid=xbmc,umask=002,sync \
-fstype=hfsplus,gid=xbmc,uid=xbmc,umask=002,sync \
-fstype=exfat,gid=xbmc,uid=xbmc,umask=002,sync"
sudo mdadm --monitor --scan --daemonize --test --syslog
sudo apt-get install transmission-daemonsudo service transmisson-daemon stopsudo vi /etc/transmission-daemon/settings.json# update these lines"rpc-whitelist": "127.0.0.1,192.168.1.*","download-dir": "/pub/downloads","incomplete-dir": "/pub/downloads/incomplete","incomplete-dir-enabled": true,sudo vi /etc/init.d/transmission-daemon# update this line#USER=debian-transmissionUSER=xbmcsudo chown root:xbmc /etc/transmission-daemon/sudo chown xbmc:xbmc /etc/transmission-daemon/settings.jsonsudo chown -R xbmc:xbmc /var/lib/transmission-daemonsudo service transmission-daemon start
联系客服