Tag Archives: linux

Setting Up My Cloud Server with Ubuntu 14.04 LTS and Seafile

The first home server I set up was built using parts from multiple old computers. I threw in two HDD’s for my first RAID setup, then installed Ubuntu 12.04 LTS. The main purpose for my server is to host a file cloud. *Seafile is my favorite software for private cloud storage.* Knowing nothing about network security means it wasn’t long before the server was infiltrated with a Postfix (mail server) spammer. Last week one of the drives failed and I decided it’s time to start from scratch and follow some security guides this time. I also upgraded to a real server distribution, meaning I have no GUI to work with, only a command prompt. Here I’ll do an overview of the steps I took to get the server set up and syncing files between my computers.

  • Download Ubuntu. My server is old and 32-bit so I needed to grab a non-standard release (ubuntu-14.04.1-server-i386.iso) from http://releases.ubuntu.com/14.04/. If your server computer is 64-bit then the normal Ubuntu downloads page should have what you want.
  • Burn Ubuntu .iso to a disk or usb drive. I prefer using disks so I can keep a permanent collection of operating systems. When on Windows, I like using ImgBurn to create OS disks. If you’re on Ubuntu, it’s easy as right clicking the .iso file and selecting “Burn to Disk”.
  • Install Ubuntu. The install process is pretty simple so just follow along with it. When installing Linux distros, I just look up any option I don’t understand yet.

Now boot up the server and the rest is all setup.

Almost every command for setting up the server requires superuser privilege. To save myself from typing ‘sudo‘ over and over, I log into root with  sudo su. If you don’t feel comfortable logged in as root, just use ‘sudo’ before each of the following commands.

  • First step of course is updating software.
  • Now install a firewall and activate it. Might as well open the ports now that we will need for the Seafile sync service.
  • Next I followed Matt Brock’s nice guide on Security Hardening Ubuntu Server 14.04. I skipped the steps related to Apache because I won’t be serving any websites from this server for now.
  • Install and configure Fail2Ban. The Ubuntu community guide on Fail2Ban works great for this.
  • As I found out before, it’s very important to harden an email service like Postfix. It’s a commonly installed program on servers and many people want to use your computer to send spam. When we installed Fail2Ban, it automatically installed Postfix to email reports. I followed this Postfix Hardening Guide on AskUbuntu.com.
  • Configure Logwatch. Again I used an Ubuntu community guide.
  • The last and most important step for my setup, is to install Seafile. At this point you’ll probably want to exit the superuser login. It’s just too easy to put the Seafile installation in the wrong home folder.
    1. Go to the download page and find the server link for your system. For my 32-bit Linux system, the correct download is 3.1.6 32bit. Right click the link and hit Copy link address.
    2. Now I can download it on the server using the wget command. Don’t forget to change this link to the current version for your computer!
    3. After downloading the Seafile server, read the manual and follow the instructions. I went with the simplest setup, which is using the SQLite database. The walkthrough is thorough and clear so no extra explanation is needed from me.

After going through all of these steps, I now have my server set up how I want it. Just download the Seafile client on any of your computers and you’ll be syncing files in no time.

If you have any questions at all please feel free to ask. I’m still learning, so if you ask about something I don’t know yet we can learn about it together! Thanks for reading and I hope my server experiences have proven useful to you. Have a happy day!

Linux – Find Command Examples and Tutorial

The find command is a powerful and versatile tool that can do much more than search for files. There are many ‘tests’ that can be added to make the search as specific as needed. Complex searches can then be combined with ‘actions’ to be performed on files that match. Here are a few examples:

***  ALWAYS perform searches first with NO COMMANDS on the end (like -delete or -exec). There is NO UNDOING a bad command so make sure you know what files will be affected.  ***

  • Find files by name (such as copies). As with many commands, the argument right after find tells it where to start looking. Using . says to start looking from the terminal’s current directory. The -name test uses unix-style wildcards and must match a complete file or directory name. Placing a * on each side of your query will find it in the middle of a name. The last part is a test for file type. The most common flags for -type are f for file, d for directory, and l for symbolic link.
  • Find empty folders and delete them. Here were are replacing the -name test with a simple check for -empty because we are looking for empty directories. We can then specify -type d to find only directories. The last part is a call to the action -delete. Use this carefully and remember, always search first and only use actions after you know what will be affected.
  • Find iPhone screenshots and move them to a screenshots folder. This example uses the -exec action flag, which can be used to perform almost any command on the found files. This flag really shows off the incredible usefulness of the find command. This time, were are not searching from current directory, but telling find to start from the “~/iPhonePics” folder. For the -name test, we are looking for any files ending in “.png”; so in this case we need only one wildcard to fill out the start of each filename: “*.png”. The -exec action has extra requirements for a complete command. Brackets {} are where each found file path will be inserted into the command. Also, the command must be finished off with \; to let find know that’s the end. In this case, the mv command will be performed on each file and told to move them from anywhere in “iPhonePics” to my “~/Screenshots” folder.

I hope these three varied examples have given you inspiration on how to add the Linux find command into your tools. I am using this on Ubuntu 14.04 and version 4.4.2 of GNU findutils. Whatever version or Linux system you have it should work about the same. Please ask in the comments below if you have any questions! Have a great day!

New Year, New Cloud Solution

Happy New Year everyone! I’m kicking it off with a change from SparkleShare to Seafile for my private, self-hosted cloud storage. I have a server (Ubuntu 12.04) in my room that’s been running a SparkleShare cloud for about five months. It was my first time setting up anything of the like, so I’ve stuck with it through the annoying bugs. It does have many awesome features and has been super convenient, but I can’t get over the fact that it will never work with Git repositories. Admittedly I didn’t look that hard, but I thought the only other option for private cloud hosting was CloudShare.

Anyway, I was at Barnes & Noble yesterday and saw mention of Seafile in one of the many Ubuntu/Linux magazines on display. I’d never heard the name, so of course I looked it up and started reading. It was immediately apparent that the level of polish on Seafile is outstanding. It has no problem with Git repos and syncs extremely fast. It hosts a web server called Seahub so users can collaborate on and discuss files. To top it all off, the documentation is excellent, which makes installation a breeze. The installation and setup only took a few hours last night, including transferring my files from the old system and creating all of my libraries. It’s even running on an extra domain I have so I don’t need to use my IP or a freeDNS URL.

The docs alone on Seafile were almost enough to convince me it was worth changing over. Still, I’m glad I found Pat’s articles on Patshead.com about his experience with the software. They really helped answer the remaining questions I had. My time with Seafile so far may be slim, but I’m already so glad I went for it. Everything about it has been awesome and I’m very excited to have a new cloud!

Hope you all have a wonderful start to 2014!!

Finally, Netflix on Ubuntu

In my house we watch a lot of instant Netflix. So, as you can imagine, it was pretty sad finding out it wouldn’t work when I changed my laptop to Ubuntu Linux. The Netflix technical blog has talked about their eventual switch to all HTML5 video. Hopefully they won’t continue blocking Linux users after they finalize the change, as the new encoding should be platform independent.

Last time I checked, the only workaround I could find was Netflix-desktop. It runs Wine with a windowless Firefox browser inside. Many of the reviews said it was stable but with choppy playback, especially for older machines. My Acer laptop certainly wouldn’t handle that (and my tower is dual-boot so not worth it).

Enter Pipelight! This great program allows you to install Silverlight onto your Linux browser. Included are a few other normally unavailable plugins like Flash and Shockwave.  Installing Pipelight does not activate any plugins on its own. You manually decide what to activate and whether it’s system-wide or current user only. So, we add two repositories, and install the software. Make sure to quit any web browser before installing.

Now you activate Silverlight. This will be for your current user only, so just add  sudo to apply Silverlight to all users.

Now open your browser of choice and Silverlight will begin installing. There’s one more step left. Netflix will still see you as a Linux user and redirect you away from watching videos. This is where a browser plugin comes in. There are two options for Firefox and one for Chrome. I’m a fan of Chrome and went with User Agent Switcher. If you’re using Firefox, you’ll need to go with UAControl or User Agent Overrider. Whichever browser you’re on, the advice I’ve seen says to select the newest version of Firefox available in the browser plugin.

The plugin for Chrome, User Agent Switcher, had some reviews about it not deactivating properly for certain sites. Because of this, I created a new Chrome user to install it in (which can be done in Settings). Separate users have a different set of extensions, allowing your Netflix viewing to have no impact on your normal browsing.

Now you’ll be having smooth playback without a full Wine instance. Pipelight does use parts of the Wine code base, but it’s not resource heavy as far as I’ve seen. Netflix played beautifully with this setup on my four-year old Acer laptop. If you can’t live without instant streaming on your Ubuntu machine (or other Linux distro) then this seems to be the best option.

If you give it a go, let me know if you have any questions or run into any problems!

Source: WEB UPD8 Pipelight: Silverlight In Your Linux Browser | Ask Ubuntu Netflix Streaming Question