Designing your Home Network

If you have been following my blog you would be well aware that I am in the process of creating a home network. I decided to do this post because it is probably important to have a goal or reason to set up a home network. This goal will determine how complex your network will be and its capabilities. Different people have different needs thus you must design your network around your needs. Whether it is to share files between devices in your house, play games online, browse the internet, run a cctv system, etc. There are literally thousands of reasons around which you can tailor your needs.

I’ve had some sort of home network for the better part of a decade now. At first it was just to have a wireless connection to the internet (probably one of the most basic needs). After that I bought a sony playstation 3 which had a LAN cable connection and a browser, so suddenly I had the ability to connect my television to the internet and surf the internet through my tv. It was awkward browsing the internet with a tv style remote, but it worked. After that I realized that it might be useful to be able to have a usb hard drive shared on the network to access files. This was probably the tipping point onto this journey to see what I can do with my home network. Suddenly there was all these options available to connect device and share anything from network connections, device and information. It’s also probably a good time to mention that your needs and budget are two different things where your needs normally far exceeds your budget. Because frankly as long as you have money you can basically achieve whatever you want, but if money is not a bottomless pit for you, suddenly you need to start getting creative. This is where my needs came in. So my goals were as follows (and remember, these goals change as you progress)

  1. I was looking at what I can do without breaking the bank in terms of setting up a home network.
  2. I wanted to interconnect all the devices in my home that could possibly connect
  3. I did not want to get tied up to a DSL account meaning having a telephone line installed
  4. However because DSL is cheaper than the alternatives, in this case 3G, I needed a cost effective why to connect to the internet
  5. Over above getting all devices connected in my home, I wanted everything as far as possible to be wireless

Internet and Router

Ok so those were my initial goals. So I went out and found a cost effective 3G package from on of the local cellular providers giving me the best available option of bandwidth and data for the amount of money I’d like to spent. Next I needed a router. Now that I’ve decided on the type of internet I can go look for the best possible router. It had to be a 3G router, allow devices to connect wireless to it, allow decent speeds in order to stream media content over the network like movie files without problems and it should be easy to set up yet still allow a certain amount of customization for future developments.

Now it is difficult to say which router is best, you would need to do your homework carefully and stick to your goals. Everybody’s preference would be different and I guess there are a whole range of routers which would all probably be able to fulfill most of your goals, so choose the one you like best or looks the best :)… after you have determined it would suite your needs though. I chose the TPLink TL MR-3420. It is a 3G/4G Wireless router, supports speeds locally up to 300mpbs, supports LTE, supports N speed protocol (future proofing), good security features and whole host of other controls which attracted me to it plus it was the cheapest one from my shortlist at the time, so it did fit into my budget.

The initial setup is almost effortless through following the Quick Setup option. So if you are a novice or non-technical person look for a router that has a easy setup option, most devices these days luckily do have this feature.  Also remember quoted speeds are rarely achievable and will vary from house to house, there are a lot of articles on this and tools to use to determine what speeds you can achieve but again you would never know until you connect it. The location and placement of your router is also very important, the more centrally you can place it in your house the better the reception would be everywhere. In my case as my requirements changed I had to move my router to one end of the house, furthest from my bedroom because I now have a server connected to it which would not have made my wife happy if it stood in the kitchen. So naturally the signal in my room is very weak. That being said depending on what you do, this doesn’t affect my needs as much. I do not sit in my bed copying files all the time, much rather my needs are browsing the internet and watching movies. With recent media players and effective buffering I have not experienced and glitches streaming a movie from an external usb to my laptop. Also my internet browsing is acceptable, however I am considering getting a signal booster and place that nearer to the areas where my signal is low. You will find the signal can drop quite fast and dramatically depending on the layout of a house. Wireless signal is generally not very happy traveling through a lot of walls and floors.

Ok thats enough on routers. Choose one that will suite your needs, do your research, talk to people, tell them what you want to do and pay and pick one, the reset you will need to live with and work around.

Connected devices

The next thing you need to consider is how many devices you want to connect. Normally the router specifies how many device it can connect simultaneously. If you are a more advanced user you would know there are ways of extending that through switches and network setup but generally you just want everything to connect to the router for your home network. Initially I wanted to connect 2 laptops and 2 smartphones. For your average run-of-the-mill home router this is no problem luckily. To share hard drives I had to setup shares on the various laptops. Thus when we wanted to share something on a usb hard drive it had to be plugged in to a laptop and shared in order for the other devices to connect to it. Another important factor if you want to share media files like music and movies is to enable Universal Plug-and-Play (UPnP) on the router, you will find this setting somewhere in your router configuration. This will also need to be enabled on the laptops in order to share media. If you use Windows media player, just follow their manuals on how to set this up for instance this article. There are a lot of resources on the internet for this, just search for network sharing or UPnP.

Depending on what you have some devices cannot connect directly to your network, for instance we have an older tv, which does not have a network interface. Most newer tv’s or home entertainment systems come with a network interface whether it is a LAN connection, built-in wireless or via a wireless usb dongle. Most brands call it “SMART” tv’s. With these newer type devices it is easy to connect to the internet by following the manufacturer’s manual. However in my case I needed an intermediary device if I want to connect it to my network. At first I used my playstation 3, but I am not using it anymore so I had to look for something else. I looked at various media players, especially the Android based devices because I am an android fan. In the end I chose the Samsung Allshare Cast Hub. Because I had a Samsung Galaxy S3 and my wife recently bought the Galaxy S4 and I did not forsee myself changing from the galaxy anytime soon as well as buying a Smart TV, this was the best option for getting my tv wirelessly on the network.

So now I have two options playing content on my tv, 1. plug in a laptop via a hdmi cable or 2. Stream content from my phone via the Allshare hub. You might now be thinking well how do I get the content from an external usb via your phone onto the television? Well I have tried many things. First I used this smartphone app, Skifta,  in my opinion the best and easiest of the lot. It allowed me to wireless connect to a my UPnP enabled laptop running windows media player 11 and stream it via the Allshare Cast hub to my tv. Lately as my network changed, and I set up a server (discussed throughout my Linux posts), I know have my usb hard drive connected to the server and on my Samsung Galaxy S3 I downloaded ES File Explorer which is a file sharing app on steroids for an Android smartphone device. Now I can wirelessly search for content on my usb hard drive and stream it through the Allshare Cast hub to my tv pretty much effortlessly.

Ok so I don’t really want to get carried away on the technical stuff to much in this post, I’m just giving you an idea of what to consider and what is possible by looking at what I have. Another device I have connected is my printer. Again as with a lot of modern devices you get printers that can connect directly to your network. However as with anything, they are pricier than a normal printer. Now I already had a normal inkjet printer (Cannon Pixma IP-6220D) which does not have a network interface. So if you have a need to share a printer you need to take this into consideration, spending the extra bit and buying a network printer (look for the home network printers, they are cheaper than the expensive office network printers, or buy one of those all-in-one devices, they are normally well priced) or try and connect your current printer to the network. Another thing I did not mention about routers is that these days a lot of them come with usb ports allowing you to share a printer or usb hard drive directly. This is a fantastic option and I tried my usb port and both my printer and hard drive could be shared through this interface. But be careful here, although your router has a usb port does not mean it can share any hard drive or printer because it needs the drivers of that device in order to share it. First search the internet and the manufacturer’s site a bit to find out if your device is supported. This can save you a lot of money and headaches. On my network I share my printer through my server which is a bit more technical but that was the route I wanted to go because that was one of the requirements when I decided I want to set up a server for my home network. When you have your printer connected on the network, just follow your operating system’s instructions on connecting to a network printer, this is normally straight forward and would include a wizard approach to connect to the printer.

Round up

Ok I think that about covers most of the basic needs of a home network. First you need to decide why you want a home network, then you need to decide what you want from your home network, then you need to get the basic devices to set up your network like a router, internet connection and devices that you want to connect to the network. The best strategy is to built your network around the devices you already have or plan to obtain in the near future, this will make your life a lot easier. A home network is a great tool and really makes things so much easier at home by sharing internet connections and devices but a home network can also be a nightmare if you constantly struggle with it. Plan it carefully and take time setting it up and understanding each component so that troubleshooting becomes easier. Remember if you have a problem the chances of someone else already ran into the same problem is very good, so use the internet for solutions.

That is it for this edition of my home network blog. I hope this helped you making decisions for your home network, and remember if it’s not fun, you probably should not be doing it🙂

 

 

Linux(Part 4) – Connecting usb hard drives

Following on from my first post, Linux (Part 3 – Setting up remote access to your server), let’s continue with our Linux server configuration.

OK so it’s been a while since my last post, I have been busy lately but it’s time to continue with my linux home network setup. Let’s quickly recap what we have so far. I started out installing Ubuntu 12.04 server on an old laptop. After installation we set up a print server so that you can print over your home network. And in our last edition we installed OpenSSH so that we can manager our server installation from the convenience of the living room couch.

Today I am going to show you how to attach external usb hard drives to your server and make them visible on your home network. This was very tricky first time round. I did this already some time ago so hopefully I haven’t forgotten everything already. Personally the most challenging part here was connecting to the drive from my windows 7 laptop and also when the usb drive is disconnected, how do you mount it again? I have overcome both issues so hopefully I can provide you with enough information to do the same.

OK so what do we need:

  1. 1 or more external usb hard drives that you want to make available over your home network
  2. A file server. As I have explained from the start, I only use applications that are well known and widely documented. It just makes life easier installing and configuring when you are a novice at Linux. So for my file server I used SAMBA

First things first, lets install SAMBA. Before you install SAMBA, just have a look if its not installed already as follows:

SAMBA

dpkg –list | grep samba

If Samba appears as a result it is already installed and you can skip the next step, if not lets install it. By now you should be familiar with the install command (Follow the documentation at SAMBA file server):

sudo apt-get instal samba

After it finished installing we need to configure the config file. The config file is in /etc/samba and is called smb.conf. Remember to back it up first before you start editing it by copying the original to a backup file. Remember you need to use sudo in order to edit this file so you need your root password. As the documentation says, you need to change the “workgroup” directive so that it matches your network. In this case I made it the same as what my windows 7 PC was by going to Control Panel->System. Somewhere in that window you will see you “Workgroup” name. The next important change is to set the “security” directive to “user”. Essentially this means that the user accessing a drive specified in your samba config file must be a system user, thus one you have created on your server. Because I have my own local user I am going to just use this one for now. But you can create users on your server and give them each individual access to media as you require. To keep things simple, I will setup all my devices with my local user because all devices are known devices and under my control. Both settings we’ve now done are in the Global section, thus this pertains to SAMBA as a whole.

Ok now that the Global settings are done we are ready to share an external usb drive. Now this is where things can become a little tricky. Firstly we have not yet connected a device and secondly we have thus not mounted anything yet. But this does not yet matter, we will set up the shared device as if it is already connected. Remember for each usb hard drive you connect you need to mount it individually and you need to create their own section in the smb.conf file. OK so when you look at the documentation You can see precisely what you need to do. The section needs to look as follow:

 

[share]
    comment = Ubuntu File Server Share
    path = /srv/samba/share
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0755

The documentation explains everything nicely, but just to summarize, the [share] line is important because this is what you will use to refer to your device that you want to share on the network, so make this a unique and easily identifiable name that is descriptive of the drive that you going to connect. The path is where the device is mounted. Now because we have not mounted the device yet just make up a path so long. I have done some reading and a good place to mount devices is in /media. Thus I created a folder in the location called something like “myExtDrive”:

sudo mkdir /media/myExtDrive

The other important setting is the create mask. This essentially specifies the permission the users will have on the mounted drive. In this case, full access. The last thing to do is to exit and restart SAMBA in order for the settings to take affect. Depending on the text editor you are using, remember to write the config file and exit it properly. To restart SAMBA type:

sudo restart smbd
sudo restart nmbd

Ok now that SAMBA is configured and running we need to connect an external usb drive.

 

Mount

First connect your usb device. Give it a second until you here your hard drive spin. Now type “lsusb” in the command line. You should be able to identify your connected device from the list of usb connected devices.

usb connected devices

External drive location

 

From above image you can see my connected Seagate drive in the second position in the list.

Before we can mount the device, we need to know where it is located. To do this type the following:

sudo fdisk -l

This will give you a list of all partitions on your server as well as the newly connected hard drive. Find the connected usb drive from the list. Look at image below of fdisk output:

fdisk output

fdisk output

If you look closely at the image above you can see all the information about your connected hard drive but only one piece of information is important at this stage and that is the “device boot” (highlighted in red). This is where your external device is located and what we will need to mount it.

Now to mount this device to the location specified in our SAMBA config file, type the following:

sudo mount <origin> <target>
i.e.
sudo mount /dev/sdd1 /media/myExtDrive

Now your external drive is mounted and seen as a local device on your server. To read more about the mount command go look here. I will not fuss about it to much, I just want to gain access to my device. OK now that is mounted go to the device and list its content to see if it did indeed work.

 ls /media/myExtDrive

You should see a listing of all the files and directories of that drive. Just to make sure that Samba also sees the mounted drive, restart samba again as explained above.

Ok now lets go to our window 7 device and try and connect to our new share. First go to “My Computer”. Right click somewhere in the open space and select “Add a Network Location”.  Click “Next” in the first window. In the next window double-click on “Choose a custom Network Location”. Here you can either browse or you can enter the location directly. I like to enter the location directly because it is known thus skipping the network search part for the new device. So to enter the location first type 2 backslashes then the server IP address and then the name given to the share. Remember the name you typed in the square brackets when you configured the SAMBA smb.conf file, this is the name to use here:

\\192.168.0.5\MySharedDrive

If this is correct the next window will show you a summary of the device you are about to add, so give it a descriptive name on your PC. I just left it as it was and clicked “Next”. The last screen will show a confirmation of the device and location you have just added. When you click OK, this device will be opened in a new window. Voila! You have just added a shared usb drive on your home network that can be accessed from any connected PC on your home network following the same setup. Just a note here, the first time I add a drive to the PC via “Add custom Network Location”, I was requested for a username and password. If you also get this prompt, this should be the user on your server that you have setup to connect to the external drive. Because we set up our security as “user”, we need to connect as a server user. The problem is (and this caused me some headaches) that it requires a domain\username to log in with (if you are use to a windows setup, this is familiar, but now you probably don’t have this). So I figured out that you only need to type “\[username]”. This bypasses the domain part which you do not require. Supply your password and this should connect you and allow you to connected the the file share.

Ok now we have a shared drive on the network, but you will soon realize that something else is required. Every time you restart the server or unplug the drive and connect it again, it doesn’t get mounted automatically and you have to mount it manually. Frustrating! The answer: fstab.

fstab

So what is fstab. In short it is a way of auto-mounting devices connected to your server.Here are 2 links I used to setup my fstab, first one, and second one.

Essentially the important thing to do here is first get the UUID of the connected usb hard drive with the following command:

sudo blkid

Look for your device specified by it’s location, i.e. /dev/sdd1. Write down or copy the UUID. Now you must edit the fstab config file located at /etc/fstab. You need to use the sudo command again

sudo vi /etc/fstab

Look at below image of an example of the fstab config file:

fstab config

fstab config

Above you can see the content of a fstab config file. I have stripped out some personal info but you can see that important stuff. What you need to do is add a new line at the bottom for your device. The format is <uuid> <location> <files system type> OPTIONS dump fsck. Please look at above links for explanation of fstab. Basically what I did was pasted the UUID of my device, typed the mount location where I want this device to be mounted to, gave it a file system type (this should also be visible when you run the “sudo blkid” command) and gave it the required options. No there are a lot of options, I just googled until I found the correct ones for my device which is a ntfs device. If your device is a ntfs drive, you can use the same options. Now save and exit the config file. Restart your server and when it comes back up see if you can access the drive from your other devices. To restart type the following:

sudo shutdown -r now

“-r” tells the shutdown command to restart again and “now” tells the shutdown command to do it now, pretty obvious. Wait until the server boots up, then type “mount” to see if your external hard drive has mounted. I normally just ping the server until I get a response, then I know it has booted up again.

OK so now we have a connected drive shared on our network that will always be mounted when the server start. Happy? Not quite! I have found that unlike Windows, when you disconnect the drive and connect it again the device is not mounted. Being a regular windows user makes this a bummer because I don’t normally make use of the “safely disconnect device” option that often, I just plug it out. And on Ubuntu server this is even more laborious if you have to type the mount/unmount commands all the time. To test this, run the command “sudo tail -f /var/log/syslog”. Disconnect your device and what until a message appears saying that a usb device was disconnected. Now connect the device again and wait for a message saying the device was connected again. if you run the “mount” command all will seem OK, the device will be listed as mounted. But try and list the contents of the mounted device will give you and error and you will also not be able to open the device on another device on your network. Not good! So what to do. I tried various options, in the end the easiest option was to install another application called usbmount. This application will listen for connected device and check fstab how to mount the device and do it automatically for you. You can install the application as usual with “sudo apt-get install usbmount”. After installation do the same test, disconnect and connect the device. List device content or navigate to it on the network, you should be able to access the device. It might take a few seconds before it’s mounted but it should now be there. This makes life so much easier because if you have other people in the house that also use the drives, they might disconnect it to plug in somewhere else and when they connect it again nobody can access it which is very frustrating! After all we are trying to set up a hassle free home network!

To connect more devices, just follow the same steps for each. One thing I have noticed when connecting multiple drives. When setting up multiple drives and their mount points and fstabs, just do one at a time, unmount it properly and then do the next. For some reason when I did the second external usb hard drive after I just plugged the first drive out, I could not reconnect it as the drive kept spinning like it wasn’t unmounted correctly. I powered the drive off, unmounted all drives, restarted the server and connected the drives 1 by 1 and usbmount then picked both up and mounted them automatically.

Well that is it for this part of my Linux home network installation. We now have connected hard drives making our home network ever more useful. In the next section I will discuss a little more about the home network rather than the Ubuntu server side of things and after that I will look at setting up a web server and create a web page that can be viewed from the internet!

Cheers and happy exploring!

Linux (Part 3) – Setting up remote access to your server

Following on from my first post, Linux (Part 2 – Setting up a print server), let’s continue with our Linux server installation.

Lets look at how you can setup access to your server on your home network so that you can manage it from any other computer within the bounds of your home network. Why would you want to do this? Well there are a few reasons, your server is normally a static physical machine, meaning it’s not something like a laptop so every time you want to change something on the server you need to physically go to it. A second reason might be that the pc you set up as your server does not have to have a monitor or might not have one, so if you cannot access it remotely you need to connect a screen to it every time. Another reason is that your server is normally directly connected to your router via a LAN cable in order to achieve maximum network speed which wireless normally cant achieve. Whatever your reason, you are bound to want to access your server remotely.

So lets see what we need:

  1. Some application that runs on the server and acts as the remote server (OpenSSH)
  2. A client application on the machine accessing the server remotely (Putty)

SSH

So what is SSH. SSH stands for secure shell. It’s basically a program that allows you to  connect securely to a remote device using public key cryptography. When you connect to a remote server you need to gain access with a username and password that exists on that server. The first time you connect the SSH program generates a key that links that user with the client application connecting to the server.When connecting via a client application to the server, a secure connection is then establish between the client and the server. SSH is used in preference over older applications such as telnet which is not encrypted. SSH normally connects on port 22. For more information go read up further on Wikipedia for SSH.

Server setup

Ok so as with most of the applications I use to set up my home network with a Linux server, I choose the ones that seems to be most popular and have readily available resources because as I said in my first post, whilst setting up a home network, I am also learning Linux as I go along. Thus by choosing the most popular application with enough online help you are less likely to struggle. So for the server application I chose OpenSSH. Doing a few searches and looking at Ubuntu help I found that this is the most popular option. The setup is pretty straight forward, lets have a quick look at the server setup.

Here is the link to the Ubuntu online help for OpenSSH.

In Ubuntu the generated key produced by the SSH program is then stored in the home directory on the server for the user that you are connecting with. As with everything Linux, there is a config file where you can customize OpenSSH as you want your setup to be. The config file is located at /etc/ssh/sshd_config. Just remember as Ubuntu also suggests everytime, when you make changes to config files, first copy it away before changing the “in use” version. Because I am a newbie user, fiddling with a secure connection application does not sound like the best thing to do, so lets leave the program as is for now. The installation is easy, first lets install OpenSSH via the apt-get command.

sudo apt-get install openssh-server

One thing to look at in the config file is whether the public key feature is activated, so look for the directive PubKeyAuthentication yes. Make sure it’s not commented out and that is set to “yes”. So after installing OpenSSH and making changes you must restart the application as follows:

sudo /etc/init.d/ssh restart

What the keys also allow you to do is not having to type in the password in every time you connect from your remote client, that is why the generated key gets stored in the users’ home directory when you generate a public key for your user. But I want to leave this in tack and rather log in with my credentials from my remote clients. Ok so that’s it for the server set up, see that was very easy. No lets get to the client.

Client setup

If you think the server setup was easy, well the client setup is even easier. I searched for a popular SSH client application and found Putty. Putty allows various types of connection including SSH. I downloaded and installed Putty on my windows 7 laptop and was as straight forward as downloading the exe file and start using it. When you first open Putty the best thing to do is to save a new session, this is the connection to a specific server which includes the IP, port and protocol. So every time you want to connect to a particular server, you only need to load the session and it will connect automatically.

Putty

Putty

The first time you click open, a popup will ask you to acknowledge the generated key for this session, just click Ok. After this you will have a command line interface of your server, just like if you were physically working on the server itself! You will need to log in just as if you were on the server with an existing server user. To exit the client just type “exit”, this will log you out and exit the SSH client application.

Putty Logged in

Remote session

And this is how you can set up remote access to your remote server, allowing you to work on your server from your laptop wherever you are in the house. So what usefulness does this have in terms of you home network? Well lets look a little further into the future, once your home network has grown with connected printers, external hard drives, a web server and maybe multiple users, you will soon find yourself having to quickly change config files, mount drives, give users access, restart applications, add new applications, etc. The reasons are endless. Having the option to do it from anywhere on the network is just an added convenience. Doing it early in you home network setup will save you a lot of time and trouble.

Smartphone Client

After I finished my remote access setup I thought, lets see if I can connect from my Samsung Galaxy S3 also via SSH. I went to the Play store and search for “ssh client”. Quite a few options appeared. I chose JuiceSSH. After installing it on my smartphone I selected Connections->New Connection. In the New Connection window I gave my server a “Nickname”, which I chose as the server name. Remember when we installed Ubuntu, we gave the server a name, well I just chose that name. In the Type dropdown, select SSH. Type in the IP address for your server. The next option is the identity. This confused me a bit, but in fact is very easy. This is just where you store the connection username and password and link it also to a “Nickname”. So just use your server login details and give it an identifiable name. If you have the paid for version of JuiceSSH you have the ability to generated a public/private key pair which is probably just a safer way to connect, but for now the free option is  fine. After entering your username and password and a nickname for this identity, click Save. You will now be back at the main New Connection window. The next thing you need to enter is the port. Because we didn’t change it on the server and left it default, this will stay port 22. Click Save again, now you have a stored SSH session on your phone. After the save, you will be back at the home screen. Go back into Connections and click on your new connection you just set up. The application will open a remote session just like Putty where you can log into you server and do exactly what you can do from a computer. Neat hey!

Well that’s it for this edition of our Linux home network setup. We are slowly building with each post. Soon we will have a fully functional home network. In the next section I will look at connecting an external hard drive. This is a home network, and one thing you would most probably want to access on your home network are files, movies and music right? So this sounds like the next logical step.

Cheers until next time!

Linux (Part 2) – Setting up a print server

Following on from my first post, Linux… Feeling the water, let’s continue with our linux server installation.

OK so I’ve decided to go with Ubuntu Server 12.04.4 as my chosen operating system for my home network. Reason for this is to learn Linux, so by setting up my home network with Ubuntu, I can kill 2 birds with on stone. Also I was feeling patriotic since fellow contryman Mark Shuttleworth created it.

After installing Ubuntu I had to decide what’s next. Something easy to get me going. I decided to set up a network printer because this sounded like any easy first step into installing a new application using Aptitude and configuring my first configuration file. Note: you fill soon find out that working with linux server edition requires a lot of configuring of various configuration files. OK so lets see what we need:

  • Printer: I have a Canon Pixma IP6220D at home so this is the one that will be used as my net work printer
  • CUPS print server: After some googling CUPS (Common Unix Printer System) came up as the default Ubuntu solution so I decided to go with that.

CUPS  handles all the queuing and print jobs and supposedly supports a large variety of printers, this is important otherwise you will need to find drivers for your printer and install that first. Luckily for me my printer was supported so I could just continue. CUPS uses IPP (Internet Printing Protocol) which makes it easier to install an use network printers. IPP has a whole bunch of features like authentication and authorization which I will not touch on here but suffice to say that CUPS is a very robust printing system. Read more about it here:

CUPS help

Ok first things first, my printer is connected via USB to my server. If you have some experience of Linux you will know you have to “mount” devices connected to your server. I’ve had some interaction with Ubuntu and Red Hat some years ago so knew that this was my first step. Lo and behold my surprise when Ubuntu picked up my connected printer automatically. I did a quick search and found that newer Linux distributions have been updated with this automount feature:

If this is not the case on your setup, you need to manually mount the device, you can found more information on mounting here.

OK so lets see which USB connection contains my printer by running the “lsusb” command. Thus will give you more or less the following:

LSUSB

In the image above you can see my printer is at the top of the list. OK now that I know my printer has been identified by the system lets install CUPS with the following command:

sudo apt-get install cups

Sudo

Sudo will be discussed at a later stage (when I have learned more about it) but for know it is probably sufficient to say that it allows you to run a command as an elevated user or super user. Certain commands need to run as a higher privileged user in order to install correctly on your system because they need access resources that run under this elevated privileges. Thus most often when you install new applications you would need to do it, but make sure this is required, don’t just accept that it needs to. You will know when to use sudo when to command you try to run warns you that you do not have sufficient privileges to execute the command. When you run a command with sudo you need to have the administrator password otherwise you will not be able to run the command. Thus when you run “sudo apt-get install cups” it will ask you for the password for the administrator user. More info on sudo here.

Configuration

Let’s continue with our print server installation. After CUPS have installed you guessed it, the next step is editing your cupsd.conf file. This file is by default located at “/etc/cups/”. Navigate to this directory as follows: “cd /etc/cups”. Now run the “ls” command. This command is the list directive to list everything in the current directory. Just a side note here, I will not explain everything for example all the commands in depth, there are enough information on the internet where you can read up on it, that is mostly what I do anyway, but when you need some information on a command you can type “–help” after the command, for example “ls –help”, or you can use the “man” directive which will display the full manual for that command for example “man ls”. When you run the “ls” command you will see all the files and folders within the current directory. Look for the file “cupsd.conf”, this is your CUPS configuration file. The Ubuntu help site recommends making a backup of the file before editing it, this is good practice so lets create a backup first with the copy command (cp):

sudo cp cupsd.conf cupsd.conf.original

Right, now we have the original configuration file in tack and we can edit the cupsd.conf file knowing that if we screw up we can quickly revert back to the original by deleting the conf file that is corrupt and just copy the original file back with the same command as above except you will copy the backup to the main conf file this time. Again you can use the man directive to readup on the configuration files as well with “man cupsd.conf”. This is a good thing to do to get some background info. OK here is where I have to admit I have already made the changes and set up my printer and got my web interface running and that changed my cupsd.conf file as I later discovered so I cannot go through all the steps initially required to get it working but will point to some help on the internet. So after you have done all the required changes from the CUPS installation guide and you’ve done the restart with “sudo /etc/init.d/cups restart” command, you still cannot see your printer on the network (I used my laptop running Windows 7). This will cause you some frustration but is actually an easy fix. You need to go back and edit your cupsd.conf file as explained in the post. In short what I did was to change the “listening” line to use the IP assigned to my server and not let it say localhost. Leave the port as 631, this is the default port setup for printing. In the section “Show shared printers on the local network” add a new line “BrowseAllow all” as well as “BrowseAddress @LOCAL”. Also look at that link above for this fix, I added all the lines with @LOCAL to update my cupsd.conf file. After this I ran the restart command again and that did the trick!

OK but you still don’t have a printer. CUPS have a web interface where you can edit printer settings and after you made all the configuration file changes you will no have access to this web interface. In a browser window type the following “http://%5Bserver ip]:631”, i.e. http://192.168.10.5:631. If  you are asked to enter a username and password, this will be your administrator user. Now you have an interface to add printers, edit them, view jobs and queues, etc. Click on “Add Printers and Classes”. Now click on “Add Printer”. The next screen should list your printer, in my case it said “Local Printers: Canon_IP6220D”. I selected this one because this is the one I want to share on the network. Next you will be asked to give it a name to refer too as well as some other options and the option to share the printer, select this option. It will also show where this device is located starting with something like: usb://. This is not important for now, but note this because you can use this to easily get to your printer. When you are done you can click next and this will add you printer. I named my printer “Canon_iP6220D_Network” so that I know which printer it is and that this is my network printer but you can name it anything. So now when you go the the “Printers” tab you will see your installed printer.

So how do you find the network printer on you Windows machine? Go to “Control Panel”, “Devices and Printers”, select “Add Printer”, “Add a Network printer”. The program will immediately start searching for printers, but mine did not show up so I selected the “The printer that I want isn’t listed” option. This will give you the option to enter the shared printers’ name. This we do have. Remember when you added your printer on the web interface you gave it a name, well this is the name to use here. This is a tricky part but after some googling this is how you do it “http://%5Bserver ip]:631/printers/[printer name]”, i.e. http://192.168.10.5:631/printers/Canon_iP6220D_Network. This did the trick. No you will be presented with a Print wizard setup where you need to select you printer in a series of screens in order to set up the correct drivers. After this is done your network printer will be added. I set this as my default printer and Voila! Print a test page to make sure it’s working. Go back to your printers’ web interface and browse through the options to familiarize yourself with them.

OK that’s it for this edition on my path to start learning Linux (Ubuntu) and setting up a home network. I have created another category called “Home network” where I will add some entries not specifically related to Linux but will be more related to other parts of the home network I am creating.

One last thing I did not discuss but you would have come across in this post was editing your configuration file. I briefly mentioned editors in my previous post but now surely you need to start learning how to work a Linux editor. I use “vim” because this came installed with Ubuntu and is just as daunting as any Linux editor when you first have to use them. There are a lot of information on the internet on how to use them. So start to get to know one and familiarize yourself with some commands. The important commands I am starting off with are how to insert (i), how to get out of editing mode (esc), how to find text (/f [text to find]), find next based on the word you are looking for (n), find the previous word when in searching mode (N), how to write to the file after editing (:w [enter]), how to quit (:q! [enter]), how to write and quit (:wq! [enter]). This is good enough for now!

Next I will explore how to manage your server remotely within your network because you don’t always want to sit at your server right!

Linux … Feeling the water

So I’ve been meaning to explore the “other side” of the the computing world, the free side, the “it’s to complicated world so we stick to Windows” world… Linux. I’ve decided to blog on my path towards Linux enlightenment as I go and this is the first step, starting the blog🙂

So why have I decided to do this? Well I am a software developer and have been for the last 8 years and I’ve studied Information Systems, so anything IT related interests me, and if it grabs my attention enough, I will try and make sense of it. Unfortunately as with the majority of the computer literate world I have been confined to the Microsoft realm, why, well as with most users, because it works out-of-the-box, its what most of the companies we work at use by default and when you buy a PC or laptop, it comes loaded with guess what.. Windows. Don’t get me wrong, I like windows, nothing wrong with using it on a daily basis, I will not trash talk it based on a few little niggles. Just look at what it has achieved, do you really think there would be so many internet users if everybody had to figure out some or other linux distribution?

Ok so lets get down to what I want to achieve. My aim is to learn how to work proficiently on a Linux environment, understand it’s structure, commands, editing files, setting it up, configuring it, etc. Also as with anybody starting out on a linux system, it is difficult to find information even though there are a lot of info out there it is still difficult sometimes to understand it. I don’t proclaim that my blog will helpful to everybody, but hopefully someone somewhere came across the same issues I have and hopefully this blog would be able to help out, as did many other blogs helped me so far! So I will explain step-by-step what I did and why I did it.  For this I’ve decided on setting up a home network. I don’t have to know everything, just enough to be able to say that I can navigate my way around a linux system just as I would a Windows system. So what have a chosen, lets look at my setup:

  • Server hardware: 1 x Old laptop (10 years old) (AMD mobile Athlon XP 2600+ processor, 512MB RAM, 10/100 ethernet adapter and wireless card, 60GB harddrive, 4xusb slots)
  • OS: Ubuntu Server 12.04.4
  • Router: TP-Link TL-MR3420 3G
  • Internet Connection: 3G dongle in router
  • Devices I want to connect on the network: USB hard drives, laptops, mobile phones and a printer… for now.

As you can see Ubuntu will run on almost anything🙂

So where did I start, well I downloaded Ubuntu Server 12.04.4 from http://www.ubuntu.com/download/server, and followed these initial instructions. The download is an ISO image so I wrote that to a CD (OS download size is about 680mb so a CD will work) and followed these instructions to install from a CD. During the installation you will be asked to set up a user, remember this username and password otherwise you will not be able to log into the system and have to re-install all over again. The rest I just kept the basic settings the same. Selected the language I want, my time zone as well a supply the computer with a name. This name will be what your system will be identified as, so choose one you like! My computer was not connected to the internet so it could not update the time but thats ok, you can change this at a later stage, just click next. For the hard drive layout I just selected the default option to format my whole drive and use LVM. Some more info later on LVM, once I know what it means fully. From the update system section I selected install security update automatically, this sounded like the right thing to do. After that, the installation came to a section where you can configure it with some pre-selected applications, I didn’t select anything because the whole point is to learn how to do it myself, so I just clicked next here.  After the installation my computer rebooted and it went to the login screen. Just a note here I chose the server setup without a GUI, I wanted to keep it clean, simple and leave all the resources for processing power not displaying nice looking windows!

Ok that’s all for now. In my next post I will look at some basic commands and set up my first application, CUPS, a print server.