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.
apt-get update && apt-get upgrade && apt-get dist-upgrade
- Now install a firewall and activate it. Might as well open the ports now that we will need for the Seafile sync service.
apt-get install ufw
ufw allow 8000/tcp
ufw allow 8082/tcp
ufw allow 10001/tcp
ufw allow 12001/tcp
- 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.
- 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.
- 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!
- 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!
Recently I’ve been trying out the open source editor Light Table. It has a lot of great features, my favorite being inline evaluation. The editor will run a single line of code and display the value at the end! It’s super customizable and really reminds me of Sublime Text in terms of looks.
Here are some simple instructions on how to install Light Table and create a nice launcher for it.
- Download the correct version for your system from lighttable.com.
- Change directory to wherever the file is located.
- Unzip the archive. This will give you a folder called LightTable. The wildcard ‘*’ in the filename makes this command work for either the 32-bit or 64-bit downloads.
tar -xzf LightTableLinux*.tar.gz
- Move the unzipped folder to /opt to live with other non-traditional installations. Then delete the archive. Note: Programs in /opt are available to all users.
sudo mv LightTable/ /opt
- Create a launcher file called light-table.desktop and enter the details to make it work.
cat > ~/.local/share/applications/light-table.desktop
Make sure to hit enter at the end to leave a blank line, then hit Ctrl+D to exit the cat command.
- Make the launcher executable so Ubuntu registers it as a program.
chmod +x ~/.local/share/applications/light-table.desktop
- Last step is to create a symlink in your user /bin folder to enable calling Light Table from a terminal. You can call yours whatever you want, but here I’ve named it ltable so the command to start it up is nice and short.
ln -s /opt/LightTable/LightTable ~/bin/ltable
Edit: If ~/bin does not exist, create it. Ubuntu treats ~/bin like a per-user installation folder. If you want this shortcut to be available for all users, instead use sudo and place it in /usr/local/bin.
sudo ln -s /opt/LightTable/LightTable /usr/local/bin/ltable
That’s it! All done! Have fun using and customizing the Light Table editor! I’m certainly no Light Table expert but if you have any questions about these instructions please let me know in the comments. Have a great day!
I’m currently working on setting up a fresh install of Ubuntu 14.04 and I like to have a clean login menu with no extra options. In a previous post I showed how to disable the guest account and remote login in Ubuntu 13.04 and older. There’s no longer any “Remote Login” option, so only one thing to clear up. The process for disabling the guest account in Ubuntu 14.04 has changed a bit from previous versions. It’s very simple and only involves making a new file instead of editing an existing one.
- Enter the following command to create a new text file in
sudo nano /usr/share/lightdm/lightdm.conf.d/50-no-guest.conf
- Add this text to the file, and don’t forget to leave a blank line at the end!
- Exit and save by hitting
Ctrl + x and then
That’s it! Let me know if you have any questions.
In a case-sensitive system like Linux, I prefer naming my directories with all lowercase and underscores. This is kind of difficult when the default user directories are all uppercase (Documents, Pictures, etc.). Here’s a quick tutorial on how to change the defaults whether you’re on Ubuntu or pretty much any other X Window System desktop.
- First either edit the default names or make new directories entirely. They don’t even have to stay in your $HOME folder if you want to move them.
~/.config/user-dirs.dirs and edit each line to represent the new names.
- Save the file and that’s it!
Feel free to ask any questions in the comments below!
For a long time my favorite Terminal program has been Guake. It is “a drop-down terminal for GNOME Desktop Environment.” It is always available and hidden when not in use. Simply press a button and it pops out from top of the screen, press again and it goes away.
To install Guake simply
sudo apt-get install guake
The only problem I’ve had with it is on my desktop machine when two monitors are plugged in. Guake always defaults to the left monitor. It does a great job of determining the size of ‘monitor 1’, which in my case is a much smaller extra one to the side. To get Guake on my right-side monitor I had to tweak the source code. Here’s how you can do the same:
- Make a copy of theGuake program and put it in yourbin folder. I renamed mine toguake-dualmon but you can call it whatever you want.
cp /usr/bin/guake ~/bin/guake-dualmon
- Edit the copy in your preferred editor.
- Find the method definition
- First we will correctly position the terminal on the right monitor. Add one line at the end, between
window_rect.y = 0 and
return window_rect . The window_rect.x and window_rect.y variables tell theGuake window where to be located. Set window_rect.x to be the width of your left monitor and window_rect.y will depend on how offset the monitors are. I had to play with the ‘y’ setting to get it just right or the text starts off the top of the screen.
window_rect.x = 1280
window_rect.y = 24
- Now Guake will be positioned on your right monitor, but it will still be the size of the left one. In my case it was sized at 1280, and I needed it to be 1920. Divide your right monitor’s width by the left monitor’s width (ie. 1920/1280 = 150). Still within
get_final_window_rect(self): you will find the line
width = 100 . This setting is a percentage of your left monitor, so set it to the answer you got by dividing one width into the other. In my case it was:
- That’s it! Just make sure to always run your copy of the program, or better yet add it to your autostart so it runs automatically!
Here’s the new get_final_window_rect() method looks like with edited lines highlighted:
"""Gets the final size of the main window of guake. The height
is the window_height property, width is window_width and the
horizontal alignment is given by window_alignment.
screen = self.window.get_screen()
height = self.client.get_int(KEY('/general/window_height'))
width = 150
halignment = self.client.get_int(KEY('/general/window_halignment'))
# get the rectangle just from the first/default monitor in the
# future we might create a field to select which monitor you
# wanna use
window_rect = screen.get_monitor_geometry(0)
total_width = window_rect.width
window_rect.height = window_rect.height * height / 100
window_rect.width = window_rect.width * width / 100
if width < total_width:
if halignment == ALIGN_CENTER:
window_rect.x = (total_width - window_rect.width) / 2
elif halignment == ALIGN_LEFT:
window_rect.x = 0
elif halignment == ALIGN_RIGHT:
window_rect.x = total_width - window_rect.width
window_rect.y = 24
window_rect.x = 1280
Have any questions? Feel free to ask in the comments below. Thanks for reading!