Posts Tagged ‘cjjulius’

h1

Syncing Between Linux and Windows with BitTorrent

28/06/2013
Skip the insecure Cloud with BitTorrent Sync

Skip the insecure Cloud with BitTorrent Sync

I’ve always been a DIY kind of guy when it came to technology, and the idea of giving my data to cloud services such as Dropbox or Box.com (and whoever has access to that data besides them) seemed a little iffy. The cloud, as great as it is for some things, isn’t really built for too much security. Keeping data private on an internal system is hard enough, but throwing it out to the internet only multiplies these issues.

That’s where BitTorrent Sync comes in. Built by BitTorrent Labs (and using the BitTorrent Protocol), this solution boasts that it will allow you to sync between different OSes, securely, and without throwing any of it out to the cloud. This increases security incredibly, and isn’t that hard to set up. I put it on my Linux laptop (Stu) and a Windows 8 desktop (Zer0), both of which I’ve used in previous projects. It works, but it has a few caveats as you’ll see below.

Installation on Linux

Linux installation is fairly easy, if a bit obtuse. Instead of an installer of any kind, the package for BitTorrent Sync comes with a License.txt file and a single btsync binary. To start up the software, simply unpack it, navigate to the containing folder in a terminal and run the ./btsync command. That’s it.

$ cd /Location/of/File
$ ./btsync
The Linux binary can be configured through the webGUI (kinda) or the more robust sync.conf file.

The Linux binary can be configured through the webGUI (kinda) or the more robust sync.conf file.

However, unlike it’s Windows and MacOS brethren, there’s no independent GUI to use. You’ll need to open a browser and head to a webpage to administer it. In most cases you can use the address 127.0.0.1:8888

From there you can select the folder you want to sync as well as generate a secret key for said location. The key is to allow other computers on your network to access the folder securely. Barring any conflicting firewall settings on your local machine, this should just be a matter of putting in the secret when you add a folder.

If you need the key from a folder you’ve set up previously, you can get it again from the gear icon next to the listing in BitTorrent Sync. Also, if you head to the Advanced tab you can grab a “Read-Only” secret. If you use this key when setting up another computer, it will read from the folder but never write to it. This is useful if you want the updates to go only one way or you want to give someone the ability to see what’s on your machine without running the risk of them deleting or altering the files.

Installation on Windows

Next, I went to Zer0, my Windows machine, and installed the software. From what I understand, the Windows and MacOS versions are pretty much the same, so other than the intricacies of the Mac platform the installation and use should be very similar.

The Windows application is a little plain, but gets the job done.

The Windows application is a little plain, but gets the job done.

After running the installer, you’ll be presented with a page that has several tabs. Go to the “Shared Folders” tab and click on “Add”. Put in the secret from the share that we want to access and click “Okay”. It should have all the information it needs to connect and start syncing. Mine did it automatically and pulled the four or so test files with no further work on my part.

You can also add a local folder and sync it here. By default it’s the btsync folder in your Documents directory. I just left this as it is for my testing purposes.

Tweaking the System

Now that it’s set up, you can do a few more things to shape it to your preferences. As you first may have noticed you can add any number of folders to sync, for no cost unlike most cloud services. So if your primary concern is just moving files back and forth behind the scenes (as I do) then that’s probably this setup’s greatest strength beyond security.

There are further options as well that fall into the more advanced users’ category. On the Preferences page in both the Linux WebGUI and the Windows application, you can set rate limits, alter whether the software loads at boot and some other odds and ends. In the Advanced section, you can do even more. Here’s a quick rundown of these options:

The conf file has pretty good explanations for every editable line

The conf file has pretty good explanations for every editable line

disk_low_priority: If True, BitTorrent Sync will set itself to Low Priority on the system. Turn this on if you’re noticing serious speed problems when using BitTorrent Sync

lan_encrypt_data: If True, BitTorrent Sync will encrypt data sent over the local network. Turn this on if you want to hide your traffic from others who may be using the same network as you.

lan_use_tcp: If True BitTorrent Sync will use TCP instead of UDP for local transfers. Will use more bandwidth but will be (at least theoretically) more reliable.

rate_limit_local_peers: If True, BitTorrent Sync will apply rate limits (set in General Preferences) to local users. By default rate limits are only applied to external peers (those not on your network).

In Linux, these options as well as a few others are all stored in the configuration of btsync. You’ll need to go to the folder that you have btsync running in to access it. First, you’ll probably want to output a sample configuration and open it in a text editor to see all options you have. There are quite a few.

$ ./btsync --dump-sample-config > sync.conf
$ gedit sync.conf

It’s pretty self-explanatory, but I want to direct your attention to the username/password fields. Remember that webpage we went to earlier to set up the shared folder on Linux? Well it’s actually hosted from your machine, meaning that anyone who as the access to the network can pull up your BitTorrent Sync options and mess with them. So it might behoove you to set this option.

Once you’ve organized things the way you want them in your sync.conf file, save it. Now, you can import it back into the BitTorrent Sync application by running btsync with the modified conf file as such:

$ ./btsync --config sync.conf

Worth the Effort?

And that’s pretty much the ins-and-outs of the BitTorrent Sync application. I imagine that I’ll be using this not as my primary software to sync things between machines or as backups, but I will have it move files and folders from one machine to another periodically. Perhaps one could set up a backup drive on a server that just copies one way from all the machines that are linked to it. I imagine that could be a project for a different day.

On the whole this is a nice piece of software that pretty much does what it says it’s going to do, and securely. I know it’s Linux, but the lack of a real GUI and the complication of editing advanced options by way of the .conf file is kind of a downer. I’m totally fine with using the command line (in some cases I prefer it), but that drags down the score a bit on this one because it’s not very user friendly. Still, a fine piece of software that I will definitely be utilizing in the future.

Rating: 4.5/5 – Pretty darn good. However, the Linux version takes a little work to get customized and the Windows/MacOS advanced pages are a little confusing at first.

-CJ Julius

Advertisements
h1

Creating a Simple Linux Webcam Server

31/05/2013

Whether you’re needing to create your own security camera, or you’re wanting to set up an always-on web video, having constant, recorded video feed can be useful. It’s even more so if you can access it while you’re not at home, say, over the internet. That’s what I did a few weeks ago, with an old computer (Crusher) that I’ve been using as a file server. Now it’s pulling double duty as a constantly-streaming video service that broadcasts over the internet.

See and Record from anywhere

See and Record from anywhere

Now, this setup is quite simple, and as such has a few drawbacks. There is no security implemented in this guide, though that can be done fairly easily afterwards. There is a little bit of upkeep, and it doesn’t do everything on its own (such as file cleanup). On the flipside, it’s not very resource intensive, records everything, can be set up, sent off and running in an afternoon and is extremely stable. I’d also like to mention that it’s dirt cheap, as this can be put on almost any machine made in the last decade.

If these strengths and weaknesses sound like what you’re trying to do, here’s how to put it together.

The Tools

What you’ll need:

  • A PC with at least one free USB port.
  • Ubuntu Linux 10.04LTS or later installed.
  • A Linux-compatible webcam.
  • Access to the internet (from the PC).
  • A Router that can support Virtual Servers or Port Forwarding.

The USB port can be 1.1 or higher. Most webcams don’t push through enough data to really need the higher speeds. Though if you did get a higher-resolution webcam, then make sure you’re attaching it to a port that can handle the load.

This old Dell Optiplex GX1 is enough power to run both a Linux fileserver and webcam server.

This old Dell Optiplex GX1 is enough power to run both a Linux fileserver and webcam server.

In my case, I’m assuming that you picked up a really cheap webecam. For my purposes, I chose the Logitech C200. Everything Logitech is pretty much plug-n-play (ie “It just works”) with Linux. You can pick up that cam for about $12-20, but there are even less expensive ones out there that will function just as well.

The PC that I’m showing you this on is a very old one (Pentium 3-era) with about 512MB of RAM and running Ubuntu 10.04 LTS (server repositories). Now, 10.04 is out of date as of this writing, but I’ve since migrated the repositories over to the sever versions. This guide will still work on 12.04, as I tested it on that system as well, but for the sake of consistency, I’ll be showing you everything from my actual server’s view.

The router needs to support port-forwarding or virtual servers for you to be able to get to it from the internet. If you’re not worried about that, then you can ignore this requirement. Most routers support this anyway, so you’re probably fine. In either case, your “server” will need to able to access the internet.

Motion Setup

Booting your computer with the webcam plugged in should be sufficient to register it in the system. To find out if it is indeed in the system, use the lsusb command (List USB) to see all of the devices connected to your computer via USB. You should get output that says something like the following:

cjjulius@CRUSHER:~$ lsusb
Bus 001 Device 002: ID 046d:0802 Logitech, Inc.
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

The Logitech device is being registered by the system. If you don’t see your device here, then you’re most likely looking at a hardware issue, as Logitech uses the standard uvcvideo drivers and software-wise sets up very smoothly. If you’re not using Logitech and you’re not seeing your device here, then you’ve got some troubleshooting to do.

Next, we’ll need to find out where in the system our camera is mounted so we can point our software to it. Use the following command to see where your usb device is currently mounted. Basically this command lists all the devices connected to your system, then sends that to the grep tool which in turn filters everything out but devices with the word “video” in them.

cjjulius@CRUSHER:~$ ls /dev/ | grep video
video1

Make a note of this device’s lotion, which in my case is: /dev/video1

Now we need to install motion, our webcam recording software. So, we’ll act as a superuser, telling aptitude to get the software from the repositories and install it:

sudo apt-get install motion

Then we’ll go to the configuration file and edit it, so we can point motion to our webcam and maybe edit a few options. First I’ll copy a backup (in case we goof) and then we’ll edit the original. You can use either nano or gedit, depending on your preference. I’ll use nano, because it is low-resource and Crusher is an old computer doing a lot of stuff. Again, we’ll need to act as a superuser to do so.

sudo cp /etc/motion/motion.conf /etc/motion/montion.conf.bak
sudo nano /etc/motion/motion.conf

In here are a lot of options, and some you’ll probably want to tweak at a later date. Right now we’re just interested in getting this thing rolling and we don’t want to get bogged down in the details. We’re looking for a line labeled “videodevice” under the “Capture Devices” heading. It should be pretty close to the top.

On the same line as videodevice, we want the /dev/video0 line to point to our webcam that we found earlier. So, in my case it reads:

videodevice /dev/video1

Your device line should look something like this in motion.conf

Your videodevice line should look something like this in motion.conf

Save the file and exit the editor. Again, there are lots of options in here (including password protection) but we’re not interested in that right now. We just want to get a simple webcam server up and going, though I encourage you to come back and tweak the settings, or at the very least see what you can do with this program.

Now, you can run motion by simply typing “motion” at the command line. Remember that motion stores video streams as .jpgs and uses the folder you run the command from to store the files. This can fill up smaller drives very quickly.

My method to deal with this is simple, but isn’t elegant. I navigate to the Trash folder and run motion from there. Then, when I want to clear the files, I just log in and empty the trash.

cd ~/.local/Trash/files/
motion

Webcam Viewing

Assuming that motion is now running successfully in your terminal, we can see what your camera is seeing. Open a browser and go to http://127.0.0.1:8081

If you go to any other computer on your network, you can simply put into your browser the following to see your webcam:

(PC's IP address):8081

If you don’t know your Webcam Server’s IP address, we can look at the interface configuration output and filter it for an internet address. You can do this by opening a terminal and typing:

ifconfig | grep "inet addr"

It should be the first one on the first line. Not the 127.0.0.1 line. In my case it’s 192.168.100.6

But, if we’re away from the building with the webcam, that’s not very helpful. We want to be able to access our server from anywhere in the world. So, we need to set up a method of getting to our home machine from elsewhere.

First, we need to forward the appropriate ports so we can see the video stream. Motion, by default, uses only the one you saw before: 8081. We just need to get our router to connect the dots between any connection that comes in from the internet on that port, with our server.

This is what mine looks like, but they're all a little bit different.

This is what mine looks like, but they’re all a little bit different.

Go into your router’s settings page, in my case it’s an Arris modem/router, and go to the Firewall/NAT page (or something like it). Look for “Port Forwarding” or “Virtual Servers”. Select that you want to “Add New”.

Use the 8081-8081 range for both incoming and local ports and then put the local PC’s IP address that we got with the ifconfig above. The description can be anything.

Now, if you go outside your network, you can put in your own home IP address with the :8081 on the end and connect to your webcam. If you don’t know your outside IP address go to a site like WhatisMyIP.com and it will tell you.

Again, this is all well and good, but your IP can change, and even if it doesn’t for a while, that number is hard to remember. So, as our last step, let’s make this more human-readable and dynamic. We’ll go get a free dynamic DNS account and use it to redirect traffic from a more user-friendly name. Keep in mind that while useful, this is still an option and you can still use the IP web address [Your Outside IP]:8081 to get to your webcam.

This is approximately what the Dynamic DNS redirect setup should look like.

This is approximately what the Dynamic DNS redirect setup should look like.

Go to a site like NoIP.com and sign up for a free account. Select that you want to Add a Host and then come up with a unique hostname and use one of the default domains; usually only a few are available for free. You should see your outside IP listed in the box.*

Set it to a port 80 redirect and that you want it to connect to port 8081. You can also mask the URL if you want, but I’ve found that rarely works. Add the host and you should be good to go. Now pointing any browser to your no-ip domain name (without the :8081 on the end) will pipe you from anywhere to your webcam server.

And that’s it, you can go to any computer that has internet access and see what’s going on wherever you set up your webcam.

*I chose NoIP because they have a Linux software package that will update the IP your redirect is associated with automatically. Eventually, your IP is going to rotate and it’s nice to have that piece of software watching that for you. See their page for instructions on how to install it.

-CJ Julius

h1

How I Got My Android Tablet to Boot Windows 95

24/05/2013

I was rummaging through some old software of mine a few weeks ago and taking stock of the old operating systems that I had commercially. I noticed that along with some older versions of Redhat and Ubuntu Server, I owned every version of Windows since 95, including quite a few server versions. I wondered what I could possibly do with them, since I don’t even use my store-bought copy of Windows XP anymore.

Hey, I remember you.

Hey, I remember you.

Then I looked at my new Galaxy Note 10.1 tablet and got an idea. I wondered if I could get Windows 95 to boot on it. So, I fired up Virtual Box and an old machine I had and got to work.

Note: I am using Ubuntu 12.04LTS and a Galaxy Note 10.1 to do this project. Also, I had access to another, older machine with which I could install Windows 95 myself. Your mileage may vary.

Build 95

There are a few ways to go about this. One is to use Virtual Box to create working Windows 95 VDI file and then convert that to an IMG after you’ve got it running and another is to just find a computer with Windows 95 and make an image of the drive. Either way you’ll have to do three things:

  1. Install DOS 5.x or better before installing Windows.
  2. Install Windows 95 and get it working.
  3. Make your image (.IMG) file.
Click to Enlarge

In Virtual Box, you’ll need to set up an MS-DOS environment first and then probably migrate to 95 later.

Now, I’ve tried both ways, and they’re both complex. In the first example, using Virtual Box to create a Windows 95 compatible area for the OS to work in is a pain. This is because the Windows 95 disk is not bootable (and neither is Windows 98 for that matter). You have to have DOS 5.x or later installed first and THEN go to Windows 95. This is as much work today as it was back in when Win95 came out.

Then, once you have Windows 95 running you need to get all the drivers (and you’ll probably have to use an older version of Virtual Box because of compatibility issues), some of them custom-made, install them, and squash bugs as they come up.

When you have everything set up Virtual-Box side, you can convert the VDI to an IMG file to make it usable with the vboxmanage command in termninal:

vboxmanage clonehd Win95.vdi Win95.img --format RAW

This is not the method I recommend, as it is the hardest even with a walk-through, however it may be the easiest for people with limited access to hardware. I had, luckily, a piece of hardware that would run Win95 with minimal effort so I went that route.

First, I put I installed MS-DOS 5.0.7 (available legally and for free here) from some image files to actual real-live 720KB disks. Yes, I still have a few of those. Then I set up my CD-ROM*, no small feat, and began the Windows 95 install.

Once this had been done, I pulled the HDD out of the computer and connected it to an IDE slot in another machine. I then used the dd command to make a raw image file of the newly-added drive. This ended up giving me a large file because I had given a Gig of space to the virtual drive so I’d have lots of space to move around. You could probably get away with only 200 or 300 MB if you wanted to do so. In any case, the command to image the drive was:

dd if=/where/drive/is/mounted/ of=where/you/want/image/ bs=4K

Now I had my Windows 95 image and it was time to get it running on the tablet!

Install 95

There are multiple ways to get Windows to run on your tablet once you have an image you like. I personally went through my version and pulled out all the things I didn’t want so I could create a smaller image. I eventually got the entire thing down to 200MB, but that was with a lot of work. There are also two ways to get the image running on your tablet. There’s the way I did it initially, and then the easy way. I’ll be showing the easy way and then give a brief overview of the more difficult path.

The Easy Way

You’re also going to want to use something like AirDroid, which I’ve reviewed before, to move the files over because chances are you’re going to be doing this a lot. As you make tweaks or move different things back and forth that GUI is going to come in real handy.

Click to Enlarge

After you put in the image location and name, it will need to copy it to the SDLlib’s directory, probably on your internal memory.

Move your image file over to your device and take note of its location. You’ll probably want to write it down or something, make sure you note the CASE of the letters, because that will be very important. Also you’ll need to make sure you have enough space to copy the image over to the working directory of the emulator that we’re going to use here in a minute. So you’ll need at least twice the space of the original IMG file to use it.

Go to the Play Store and find Motioncoding’s Emulator. It looks like an Android with the Windows XP flag colors on it. Download, install and run it.

Once running, go through the menus (using the forward/back buttons, it really couldn’t be more simple) until it asks you to install libSDL and do so. Then select the option under “Import from Library” to Add Custom Images. Name the image whatever you want and put in the path to the image in there. For example, mine is:

/storage/extSdCard/SDL/Win95.img

Select the image from My Images and continue to the end. You should see your OS boot.

The Hard Way

The reason I’m putting the hard way on here is because it gives you a bit more control over your install and, I think at least, runs a bit faster. In any case I’m going to assume that you’re doing it this way because you’re a little more experienced/curious and don’t need me to hold your hand.

Click to Enlarge

Copying over the SDL apk and related software.

Step one is getting a working version of the SDL apk and installing it. You can do a quick Google search for it, but I’m not sure of the legal ramifications (or its copyright) so I’m not putting a direct link here. Keep in mind that you will need to allow “Apps from Unknown Sources” to be installed on your device. This can usually be found in the “Application Settings” area, depending on your version of Android.

Place your Win95 image in the SDL folder with the APK and rename it c.img, and load SDLlib. You may have to do more tweaking at this point as Networking didn’t work out-of-the-box for me. I needed to modify some already existing .bin and .inf files to coax them into doing what I needed to do, and even then it’s a little haphazard. You’ll need to have some method of editing the img file if you can’t get networking going or you’re going to need to re-image the drive every time you want to make a change.

This way you’ll also have access to the BIOS and VGABIOS bin files, if needed, but I didn’t end up touching them.

Android 95

My reasons for doing this were purely academic. I just wanted to see if I could get it to boot and get it usable. After several weeks of poking at it I was, by all of the above methods, able to get 95 and 98 going this way. Windows 98 was just a matter of upgrading 95 and creating a new image file. I can’t think of many reasons to do this other than for the learning experience, though there are lots of pieces of software out there that don’t work so well in modern versions of Windows and maybe you want to take them with you.

Click to Enlarge

Windows 95 successfully running on my Galaxy Note 10.1 with mouse and keyboard support

Also, I was able to get my Logitech keyboard/mouse combo to work through the 30-pin charging port, and while dragging the cursor across the screen and “clicking” by tap was interesting, the keyboard is the way to go. It’s just too cumbersome for daily use otherwise.

So there it is, an Android tablet booting Windows 95/98! You can supposedly do this with Windows 2000 or XP, but I have not tried. If you have let me know, because I’d be interested in how you got native NTFS to work.

*There’s no instruction here because it really depends on your CD-ROM as to how you’d go about this. You’ll have to find one that will work with Win95 and DOS. I had one in the machine already so it was just a matter of setting it up manually through DOS.

-CJ Julius

h1

Setting Up a Raspberry Pi with Ubuntu

17/05/2013

I had been putting off posting about this project until I had gotten RaspBMC to work, as that was step two, but it looks like the problem I need to be resolved is going to be a little while coming. So, I’m going to come back later and put an update if I get it running correctly. Either way, the Raspbian (the Debian Wheezy Raspberry Pi distro) setup is pretty clear and the same for every model of Raspberry Pi.

Here is the hardware that I’m working with:

  • Raspberry Pi Model B
  • Logitech USB Wireless Mouse Keyboard combo
  • 4GB SDHC Class 10 Memory Card
  • Edimax USB wireless adaptor
  • 4GB USB stick (for extra storage)
  • Gearhead Passive USB hub
  • USB 1.0A power adapter and Micro USB cable
Raspberry Pi Model B with SD card and wireless adapter inserted.

Raspberry Pi Model B with SD card and wireless adapter inserted.

I did this all in Ubuntu 12.04, so my work will be related to that OS; though commands are pretty similar across many distributions. Also, I have an SD card slot in my laptop, which means I did not need an adaptor to access the card directly.

The first step is to get the image on the card. I snapped in the card, it mounted and I went to the disk utility to find out where it had put it (in the system). It was mounted at /dev/mmclbk0. Once I knew that, I was ready to go get the Raspbian OS.

You can get the latest image off of Raspberrypi.org’s downloads page. I’d recommend the straight Raspberry Pi Wheezy image, as the “soft float” one is slow, and the others are more for advanced users that want to do very specific things.

Raspberry Pi booting for the first time

Raspberry Pi booting for the first time

In any case, once I had it downloaded I checked the SHA1 sum, because we’d hate to have a corrupted image from the word go. If you’re unfamiliar with SHA1, then it’s simply a method of verifying file integrity. Quite basically, an algorithm generates a unique number for a file and then that number can be checked against a copy of a file to make sure that it’s in good condition. In terminal, and in the folder that I downloaded the file into you put the command:

sha1sum 2013-02-09-wheezy-raspbian.zip

And you’ll get an output that looks something like the string listed on the downloads page. In my case, I was looking for the following: b4375dc9d140e6e48e0406f96dead3601fac6c81

Then, I just opened the archive and drag/dropped the file into a folder I had created previously, and returned to terminal. We’re going to be using the dd command to copy the extracted image (input file) to the card (output file). We’ll set the byte size to 4M and need be superuser to do this. My command was:

sudo dd bs=4M if=2013-02-09-wheezy-raspbian.img of=/dev/mmcblk0

Raspberry Pi Wheezy default Desktop

Raspberry Pi Wheezy default Desktop

Once it was done, I unmounted my card and slapped it in my Raspberry Pi for boot. On first boot you’ll get a lot of options. I’m not going to go through them one by one, as it’s pretty clear what each one is. The two I want to point you to however, are the expand rootfs and the memory split.

Expand rootfs is necessary if you have, like me, a larger than 2GB SD card. This opens up the rest of your card to be used by the system, so you have more storage space for your OS.

The memory split is important because the Raspberry Pi has a unified memory structure, meaning that it has one unified “bank” of memory that it divides towards certain tasks. If you’re going to be doing processor-heavy tasks like number crunching or multiple cron jobs, then you might want to push this towards the system memory side. However, if you intend to be using a lot of the graphical features, then you might want to lean towards the GPU.

My Raspberry Pi as it I use it now.

My Raspberry Pi as it I use it now.

The system is installed and ready to go. If you hit a command-line on boot, use startx to start the X Windows system (the GUI), and that’s it. I spent a good few hours customizing it, changing the wallpaper and such, but also removing and adding some software from the system to make it more useful to me, but that’s the basic setup.

I’ll come back at a later date if I get RaspBMC working, but as of right now it forgets that I have a mouse and keyboard attached to it, and there isn’t a simple solution that works so far. Everything works in Raspbian, and I’ve got quite a few things that I want to do in that, including Python that I mentioned in a previous post.

-CJ Julius

h1

Using Python 3 on Ubuntu 12.04

14/05/2013
Python on Linux

Python on Linux

Recently, I’ve turned my attention to Python, the programming language. I had some work with it in the past, but never really gotten that far. As a hobby, it was time consuming and other things got in the way. Now that I’ve freed up a small chunk of time every week I’ve decided to devote that to working on learning the new Python 3, since 2.x is going away eventually.

I quickly found out that Python 3 is not directly supported on my platform of choice: Ubuntu 12.04 LTS. So, I needed to get this running from scratch, which involves downloading, compiling and making it easy to get to for working in.

Compiling and Installing

If you haven’t done so already, you’ll need to get a C compiler for Ubuntu. In general, it’s good to keep this resident on your machine anyway, since you don’t always know when you’ll need it and it doesn’t take up a whole lot of space.

sudo apt-get install build-essential

Then, we’ll need to get our Python installer from the web. I’m currently pointing towards the 3.3.1 version, but there will always be newer versions on the horizon, so check the download page.

wget http://www.python.org/ftp/python/3.3.1/Python-3.3.1.tar.bz2

This will download and the bzip tarball of the source code from the python website. Then, we need to un-ball it and change to the newly created directory.

tar jxf ./Python-3.3.1.tar.bz2
cd ./Python-3.3.1

Lastly, we’ll configure the source code, tell it where to install and then point our compiler (the first thing we did) at Python and tell it to put it all together.

./configure --prefix=/opt/python3.3
make && sudo make install

And now the basic Python core is ready to go. You can test it by putting the following in the command line.

/opt/python3.3/bin/python3

You should get the following output, or something quite similar:

Python 3.3.1 (default, May 12 2013, 22:10:01)
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

Getting Fancy

A command line-type of person may want to create a symbolic link that will let them have a sort of “python command”. Keep in mind that in the following code, you can substitute the “/bin/python” for anything you want the command to be (ie. “/bin/py” or “/bin/pthn” which will make the command py or pthn respectively).

mkdir ~/bin
ln -s /opt/python3.3/bin/python ~/bin/python

Alternatively, you may want to install a virtual environment for testing or whatnot. To do this and activate it, use this in the command line.

/opt/python3.3/bin/pyvenv ~/py33
source ~/py33/bin/activate

Integrated Development Environments

If you’re anything like me, then coding directly from gedit or the like is cumbersome and not really all that fun. I like options, a GUI and all the bells and whistles, so I went looking for a an IDE.

KomodoEdit install is as simple as downloading it and running the install.sh

KomodoEdit’s install is as simple as downloading it and running the install.sh

Netbeans was the first choice, as I’d used that before for PHP work. Here, I wanted something more dedicated to Python. If you do decide to go this route, make sure that you get the one from the Netbeans website and install it yourself. The version in the Ubuntu Software Center is terribly out of date and judging from the reviews, fatally flawed.

My second choice was KomodoEdit, the stripped down version of the Komodo IDE which I’ve heard some good things about (but never used). You can get it for both x86 and x64 as an AS package from their website.

If you have another IDE that you like better, let me know and I’ll take a look at it. I’m always on the hunt for a better/easier way to code.

-CJ Julius

h1

Teaching Windows 8 and Ubuntu Linux to Share

08/05/2013
Rinder500 being shared on Zero.

Rinder500 being shared on Zero.

A few weeks ago, I had put together a project to turn a few eSATA drives that I had lying around into a few mobile digital vaults. This was a complete success, and gave me a bunch more room to do future projects. However, it did not give me an easy way to access these drives, especially the one attached to my main Windows machine and my laptop. Having to unplug/replug every time was proving cumbersome.

So, I decided to make my “mobile” drives a little more permanent, and then just give access to them across a system of three computers via wireless. This would give me 750GB between the machines with which to divvy up as I saw fit.

I’ll be approaching this in three parts:

  1. Setting up the 500GB on the Windows 8 machine (Zero) and sharing.
  2. Setting up the 250GB on my Ubuntu File Server (Crusher) and sharing.
  3. Connecting a Laptop (Stewart) and Zero and Crusher.

In my scenario I did not need to share to my file server from my Windows 8 machine. There’s no reason for it to access it, if successful, from anything other than Zero or Stewart.

Zero Trouble

The Rinder 250 share as viewed from the Windows 8 machine (Zero)

The Network as viewed from the Windows 8 machine (Zero)

So, step one was getting my shares running on Zero. The first thing I did was make sure my networking was all in line. Prior to this, I’d only ever used the Windows 8 computer to connect to the internet, never as part of any network. It had been part of another network previously, but not since the OS was upgraded.

In System Properties> Network ID I set it up as part of a Home Computer and gave it the Workgroup “ZRO_WG”. This is so I have an easy way of recognizing this machine on the network uniquely. Then, I simply shared the Rinder500 drive and set it to require a password.

Even though on Windows 8 your login is an email address, you’re only concerned with the username of the account. So if your account is SomeGuy@Somewhere.com then your user name is most likely going to be just “SomeGuy”. In my advanced sharing options (right-click, Advanced Sharing) I put a comment on the share to easily identify it, required a password and a simple name “rinder500”.

And that was it.

Doing Samba

Rinder250 shared on Linux

Rinder250 shared on Linux

In Ubuntu it was almost just as easy. I’m currently running Ubuntu 10.04 Server LTS on my file server, because I’m trying to stay away from Unity as long as I can*, and that’s what was around when I first put this machine together. That should also give you an idea of its age. Keep this in mind as I proceed as some of my methods may not work for new versions or the problems I had may not even be an issue anymore.

You can Share a drive on Ubuntu just like you would share any folder, since that’s how they’re treated when mounted. You do this by heading into the drive, in my case /media/Rinder250 and right-click to share. Then, I used the shares-admin command from terminal and added the users I wanted and verified that my shares had been added properly.

Shares-admin shows all the users and your shares.

Shares-admin shows all the users and your shares.

Your Workgroup defaults to your machine name, so it was Crusher for the file server. I used a local user (me) as someone with full rights to the share, just to keep it simple. But, you can use this method to add any number of users to the share and give them different permissions if you want.

To do any of this however, you will need to install Samba. You will be prompted for it when you try to share, so this isn’t an issue, unless your server isn’t connected to the internet for whatever reason.

Building the Intranet

Now that I had both of the shares created, it was time to link all of them together. I had three machines that I wanted to link together: Zero, Stewart and Crusher. All three had different OS’s and different needs so I’m detailing them individually.

Laptop's (Stewart) view of the network.

Laptop’s (Stewart) view of the network.

Zero

Zero is the Windows 8 machine and sharing the 500GB eSATA drive. The only one that it needed to link to was Crusher. I scanned the network (by doing the cumbersome task of clicking on the Network) and selecting Crusher.local. Then I put in my username and password for the share and Viola! everything was able to be read from and written to.

Crusher

Crusher is the Ubuntu 10.04 Server sharing the 250GB eSata drive. This got complicated, mostly because of the way Samba (on 10.04 at least) handles Windows shares. You can’t just find the share in the network, double click on it and be good. You have to manually type in the address and then fill out the user/pass information. Using the Go > Location menu and then putting in something like:

smb://WORKGROUP;username@ip.address.of.server/share/

Note the case of the case of the words, as they are important. The workgroup has to be in upper case and the username and share need to be in lower case. If it isn’t put in exactly as you see here, then it won’t work.

Stewart

Stewart shared nothing, but needed to access both shares on Crusher and Zero using Ubuntu 12.04. This one was finished just like Ubuntu 10.04 machine, except that I had to put in two shares. Also, instead of an IP for Crusher I was able to put in just crusher.local. Other than that, exactly the same.

In Production

On the two Ubuntu machines I ended up making bookmarks for them, so I could easily get to them without having to type in that long address every time. If I reboot the server, which is rarely, and I don’t have a static IP assigned, I will need to add the share again and bookmark it again.

Now that I have put together these shared drives, I can move or save things to them across the network. I will be using these network drives in the future, when I will attempt to digitize my movie library.

*As mentioned, I do have 12.04 on my laptop, Stewart.