Web

Setting up Raspberry Pi as Print-Scan-(CUPS)-Music-Media-VPN Server

Do you have a age-old printer? or a storage HDD? Raspberry Pi is one of the easiest way to manage all of them.

Raspberry Pi Kit

Where to buy? You can get the board for as cheap as $40 on Amazon or eBay

What else? Out of all the accessories available, not all are necessary

  1. Case – just to protect it and looks more handy.
  2. SD Card – Dont buy just any class 4 card, which is okay for booting but really slow. Get a 8/16GB Class 10 card. If you have an old lying micro card, go ahead and buy a micro to sd adapter.
  3. Heatsink – Slightly ignored by people but it really heats up. Buy a 3-piece aluminium heat sinks for better results than 1-piece central heatsink.
  4. Micro USB power supply – Any old android cable would work here, despite slight power differences.
  5. HDMI cable – How else will you connect it to a display? You may want to buy hdmi-to-dmv cable for older monitors or systems. There are alternatives for installation, avoiding the need for display.
  6. USB Wifi Dongle – Unless you have a lan cable and a port nearby, this is a must.

These solved my purpose. Fanatics working on something different may want to buy Camera Model, HotPi etc as per need.

raspberry-pi

Raspbian Installation

You need to install Raspbian OS on SD card. If you are using display over HDMI and want to use step by step installation, go for NOOBS. Just format your SD card and unzip the contents into card.

For users not having an external monitor, use one of the Raw Images (wheezy-raspbian). Use Win32DiskImager as instructed instead of unzipping directly.

Once Raspberry Pi gets booted. Connect it using a LAN wire and you can confirm its IP by scanning on your network or via router admin console. Default username: pi password: raspberry

Configuring Pi as Print Server

There are several tutorials which insist on using SAMBA server as medium, but that is not actually required. CUPS is sufficient to access printer directly by port. Start by installing CUPS.

Debian $ sudo apt-get install cups
Arch Linux $ sudo pacman -S cups

Once the installation is done, you need to add the raspberry user (pi) to the printer admin group.

$ sudo usermod -a -G lpadmin pi

To access the print server remotely, we need to change config files.

$ sudo nano /etc/cups/cupsd.conf

 

# Listen localhost:631
Listen *:631

Next, look for all <Location .. tags and just before closing </Location>, add “Allow @Local” or “Allow all”

<Location />
  Order allow,deny
  Allow all
</Location>
<Location /admin>
  Order allow,deny
  Allow all
</Location>
<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM
  Order allow,deny
  Allow all
</Location>

Just restart the CUPS server.

Debian $ sudo /etc/init.d/cups restart

Your printer server is up and running. Access it via web at http://127.0.0.1:631 or http://ip:631. Go to Administration >> Add Printer. Your USB connected printer will get detected here. Choose the printer and go next. CUPS will list all the possible driver models. Choose and finish.

cups-adminadd-printerlocal-printerprinter-nameprinter-driver

You can now add the printer directly on your client OS by printer name URL, Eg: https://192.168.0.3:631/Canon_MP160 .

windows-printer

Configuring Pi as Scanner Server

No extra configuration is required. Since you can directly access printer at port 631. Download the Sane Twain client. You can directly add the scanner using same ip:port and it’ll allow you to scan documents directly placed under the scanner.

Configuring Pi as Music Server

Raspod is an easy to use Music server for Raspberry Pi, written in Python. The wiki details steps required for installation and adding media files.

Configuring Pi as Media Server

You can also use Raspberry Pi as server to connect your external HDD as file storage. Connect the HDD via USB port. External powered ones are easy to work with and USB powered ones may not get detected. In that case, use a powered USB Hub as medium between HDD and Raspberry Pi.

sudo fdisk -l

Your HDD will most likely be detected as /dev/sda1 . Next decide a directory for mounting the HDD. I’ve chosen /home/pi/hdd .  In case your external HDD is not in FAT32 format, but NTFS, you also need to install NTFS driver.

$ sudo apt-get install ntfs-3g
$ sudo mkdir /home/pi/hdd
$ sudo chown pi:pi /home/pi/hdd

You can mount the HDD using the mount command. Use -t vfat for FAT32 file system HDD.

$ sudo mount -t ntfs-3g -o uid=pi,gid=pi /dev/sda1 /home/pi/hdd

Mounting the HDD everytime is not the solution, hence we’ll update the fstab file to automount on boot. Add the /dev/sda1 line at end in exactly same format as existing ones.

$ sudo leafpad /etc/fstab &

proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
/dev/sda1 /home/pi/hdd ntfs defaults 0 0

Thats it! Rebooting your Raspberry Pi will give access to /home/pi/hdd .

Configuring Pi as Personal VPN Server

Privacy freak? ReadWrite has a great two parts tutorial on configuring Pi as VPN Server.

In short Raspberry Pi is one of the factors for revolution in Internet of Things (IoT).
What are you planning to do with your Pi?

Tagged , , , , , , , , , , , , , , , , , , , , , ,